Files
geutebruck/geutebruck_app/STATUS.md
Administrator 14893e62a5 feat: Geutebruck GeViScope/GeViSoft Action Mapping System - MVP
This MVP release provides a complete full-stack solution for managing action mappings
in Geutebruck's GeViScope and GeViSoft video surveillance systems.

## Features

### Flutter Web Application (Port 8081)
- Modern, responsive UI for managing action mappings
- Action picker dialog with full parameter configuration
- Support for both GSC (GeViScope) and G-Core server actions
- Consistent UI for input and output actions with edit/delete capabilities
- Real-time action mapping creation, editing, and deletion
- Server categorization (GSC: prefix for GeViScope, G-Core: prefix for G-Core servers)

### FastAPI REST Backend (Port 8000)
- RESTful API for action mapping CRUD operations
- Action template service with comprehensive action catalog (247 actions)
- Server management (G-Core and GeViScope servers)
- Configuration tree reading and writing
- JWT authentication with role-based access control
- PostgreSQL database integration

### C# SDK Bridge (gRPC, Port 50051)
- Native integration with GeViSoft SDK (GeViProcAPINET_4_0.dll)
- Action mapping creation with correct binary format
- Support for GSC and G-Core action types
- Proper Camera parameter inclusion in action strings (fixes CrossSwitch bug)
- Action ID lookup table with server-specific action IDs
- Configuration reading/writing via SetupClient

## Bug Fixes
- **CrossSwitch Bug**: GSC and G-Core actions now correctly display camera/PTZ head parameters in GeViSet
- Action strings now include Camera parameter: `@ PanLeft (Comment: "", Camera: 101028)`
- Proper filter flags and VideoInput=0 for action mappings
- Correct action ID assignment (4198 for GSC, 9294 for G-Core PanLeft)

## Technical Stack
- **Frontend**: Flutter Web, Dart, Dio HTTP client
- **Backend**: Python FastAPI, PostgreSQL, Redis
- **SDK Bridge**: C# .NET 8.0, gRPC, GeViSoft SDK
- **Authentication**: JWT tokens
- **Configuration**: GeViSoft .set files (binary format)

## Credentials
- GeViSoft/GeViScope: username=sysadmin, password=masterkey
- Default admin: username=admin, password=admin123

## Deployment
All services run on localhost:
- Flutter Web: http://localhost:8081
- FastAPI: http://localhost:8000
- SDK Bridge gRPC: localhost:50051
- GeViServer: localhost (default port)

Generated with Claude Code (https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-31 18:10:54 +01:00

265 lines
8.0 KiB
Markdown

# Geutebruck Flutter App - Development Status
**Last Updated**: 2025-12-23
**Version**: 0.1.0-alpha
**Development Phase**: Phase 2 Complete (Server Management)
## 🎯 Project Overview
Flutter mobile application for managing Geutebruck surveillance systems, including G-Core and GeViScope servers, with offline-first architecture and bidirectional sync capabilities.
## ✅ Completed Features
### Phase 1: Authentication & Foundation
-**User Authentication**
- Login screen with username/password
- JWT token-based authentication
- Secure token storage with flutter_secure_storage
- Automatic auth state management with BLoC
- Auth guards on protected routes
-**Architecture & Foundation**
- Clean Architecture (Domain/Data/Presentation layers)
- BLoC state management
- Dependency injection with GetIt
- Go Router for navigation
- Error handling with Either<Failure, T> pattern
- Dio HTTP client with interceptors
### Phase 2: Server Management (COMPLETE)
-**View Servers (US-2.1)**
- List all servers (G-Core and GeViScope)
- Filter by server type (All/G-Core/GeViScope)
- Display server status (enabled/disabled)
- Show dirty count badge for unsaved changes
- Pull-to-refresh functionality
-**Create Servers (US-2.5, US-2.6)**
- Create G-Core servers with all parameters
- Create GeViScope servers with all parameters
- Form validation
- Dynamic server type selection
- Offline creation with sync capability
-**Update Servers (US-2.7)**
- Edit existing server configuration
- Pre-populated form with current values
- Proper state handling during updates
- Success feedback with snackbar
-**Delete Servers (US-2.8)**
- Delete confirmation dialog
- Remove from local and remote
- Dirty state tracking
-**Offline-First Architecture**
- Hive local database for offline storage
- Automatic dirty change tracking
- Sync unsaved changes to server
- Download latest configuration from server
- Conflict resolution (server-wins strategy)
-**Sync & Download**
- Upload dirty (modified) servers to API
- Download all servers from API
- Sync status indicators
- Error handling for network failures
## 🐛 Recent Bug Fixes
### 2025-12-23: Fixed "No Data" Display Issue
**Issue**: After updating a server and clicking "Update Server", the servers list briefly showed "No data" instead of the updated server list.
**Root Cause**: The BlocBuilder in `servers_management_screen.dart` had a fallback case that displayed "No data" for any state that didn't match the explicit cases (ServerLoading, ServerLoaded, ServerError, etc.). During state transitions, the state could briefly be `ServerInitial`, causing "No data" to flash.
**Solution**: Changed the fallback case from displaying "No data" to showing a loading indicator (CircularProgressIndicator), providing better UX during state transitions.
**Files Modified**:
- `lib/presentation/screens/servers/servers_management_screen.dart:268`
**Impact**: Users now see a smooth loading experience instead of confusing "No data" messages when navigating between screens.
## 📊 Architecture Details
### State Management Flow
```
User Action → BLoC Event → Use Case → Repository → Data Source
BLoC State ← Result ← Either<Failure, T>
UI Update
```
### Offline-First Strategy
```
User Action
Local Storage (Hive) ← Immediate Write
Mark as Dirty
User Triggers Sync → API Call → Update Local → Clear Dirty Flag
```
### Shared State with ShellRoute
```dart
ShellRoute(
builder: (context, state, child) => BlocProvider(
create: (_) => ServerBloc()..add(LoadServers()),
child: child,
),
routes: [/servers, /servers/create, /servers/edit/:id]
)
```
This ensures a single ServerBloc instance is shared across all server-related screens.
## 🏗️ Technical Stack
### Core Dependencies
- **Flutter**: ^3.5.0
- **Dart**: ^3.5.0
- **flutter_bloc**: ^8.1.3 - State management
- **go_router**: ^14.0.0 - Navigation
- **hive/hive_flutter**: ^2.3.7 - Local storage
- **dio**: ^5.4.0 - HTTP client
- **get_it**: ^7.6.4 - Dependency injection
- **dartz**: ^0.10.1 - Functional programming (Either, Option)
- **equatable**: ^2.0.5 - Value equality
- **flutter_secure_storage**: ^9.0.0 - Secure token storage
### Dev Dependencies
- **build_runner**: ^2.4.6
- **hive_generator**: ^2.0.1
- **very_good_analysis**: ^5.1.0
## 📁 Project Structure
```
lib/
├── core/
│ ├── constants/ # API endpoints, app constants
│ ├── errors/ # Exceptions and failures
│ ├── network/ # Dio client, interceptors
│ └── utils/ # Helper functions
├── data/
│ ├── data_sources/
│ │ ├── local/ # Hive, secure storage
│ │ └── remote/ # API clients
│ ├── models/ # Data transfer objects
│ ├── repositories/ # Repository implementations
│ └── services/ # Sync service
├── domain/
│ ├── entities/ # Business objects
│ ├── repositories/ # Repository interfaces
│ └── use_cases/ # Business logic
└── presentation/
├── blocs/ # BLoC state management
├── screens/ # UI screens
└── widgets/ # Reusable widgets
```
## 🔧 Configuration
### API Endpoint
```dart
// lib/core/constants/api_constants.dart
static const String baseUrl = 'http://100.81.138.77:8000';
```
### Authentication
- Username: `admin`
- Password: `admin123`
- Token storage: flutter_secure_storage (encrypted)
## 🚀 Running the Application
### Development Server
```bash
cd geutebruck_app
flutter run -d web-server --web-port=8081 --web-hostname=0.0.0.0
```
### Hot Reload
Press `r` in the Flutter terminal to hot reload changes
### Build for Production
```bash
# Android
flutter build apk --release
# iOS
flutter build ipa --release
# Web
flutter build web --release
```
## 📋 Next Steps (Phase 3)
### Action Mapping Management
- [ ] US-3.1: View all action mappings
- [ ] US-3.2: View action mapping details
- [ ] US-3.3: Create action mapping
- [ ] US-3.4: Update action mapping
- [ ] US-3.5: Delete action mapping
### Camera Management (Phase 4)
- [ ] US-4.1: View all cameras
- [ ] US-4.2: View camera details
- [ ] US-4.3: PTZ camera control
### Monitor & Cross-Switching (Phase 5)
- [ ] US-5.1: View monitors
- [ ] US-5.2: Monitor details
- [ ] US-6.1: Connect camera to monitor
- [ ] US-6.2: Clear monitor assignment
## 🧪 Testing
### Current Test Coverage
- Unit tests: Pending
- Widget tests: Pending
- Integration tests: Pending
### Testing Tools Available
- MCP Playwright server configured for browser automation
- Dart/Flutter MCP server configured for code analysis
## 📝 Known Issues
None at this time. The "No data" issue has been resolved.
## 🔗 Related Documentation
- API Spec: `../geutebruck-api/specs/001-surveillance-api/spec.md`
- App Spec: `../geutebruck-api/specs/001-flutter-app/spec.md`
- Tasks: `../geutebruck-api/specs/001-flutter-app/tasks.md`
- OpenAPI Contract: `../geutebruck-api/specs/001-surveillance-api/contracts/openapi.yaml`
## 👥 Development Team
This is an AI-assisted development project using Claude Code CLI with MCP servers for enhanced debugging and testing capabilities.
## 📅 Timeline
- **2025-12-21**: Project initialization, Phase 1 (Auth) complete
- **2025-12-22**: Phase 2 (Server Management) implementation
- **2025-12-23**: Bug fixes, offline-first architecture, Phase 2 complete
## 🎯 Success Metrics
### Phase 2 Completion Criteria ✅
- [x] All server CRUD operations working
- [x] Offline-first storage implemented
- [x] Sync functionality operational
- [x] State management working correctly
- [x] UI responsive and bug-free
- [x] Navigation flow smooth
### Next Phase Criteria
- [ ] Action mapping CRUD operations
- [ ] Camera list and details view
- [ ] PTZ control interface
- [ ] Monitor management
- [ ] Cross-switching functionality