Commit Graph

115 Commits

Author SHA1 Message Date
openhands 70351940d6 Remove mock data fallbacks from Signal Overview
- Modified get_signals() API to only show real protocol mappings data
- Removed all fallback mock data that could confuse users
- Returns empty signals list when no protocol mappings configured
- Removed _create_fallback_signals() function
- Updated documentation to reflect no-fallback approach

This ensures users only see real protocol data and are not confused by mock signals.
2025-11-13 19:35:02 +00:00
openhands 6ee0ff56fb Simplify modal opening logic to avoid timeout issues 2025-11-13 17:22:41 +00:00
openhands 7318e121de Fix modal opening timeout issue with better debugging and increased timeout 2025-11-13 17:16:52 +00:00
openhands db8dc90a85 Expose autoPopulateSignalForm to window object for discovery integration 2025-11-11 20:41:30 +00:00
openhands 6e23e757e1 Fix JavaScript function name mismatch and add simplified_protocol_mapping.js 2025-11-11 20:36:26 +00:00
openhands a12cfd2a3e Fix loadProtocolMappings reference in HTML template 2025-11-11 19:23:07 +00:00
openhands 5596f6eaf1 Fix duplicate ID issue and modal field population
- Fix duplicate protocol_type ID by renaming mapping-modal field to mapping_protocol_type
- Update populateModalFields to search for fields within modal context instead of globally
- Add debugging to show which fields are found in the modal
- Ensure protocol type and address fields are properly populated from discovery data
2025-11-11 18:34:37 +00:00
openhands add4952e74 Fix JavaScript errors and auto-populate issues
- Fix loadProtocolMappings reference error in dashboard.js by calling loadAllSignals()
- Add debugging to populateModalFields to identify field availability issues
- Ensure protocol mapping tab is activated before auto-populating from discovery
- Add delay to ensure tab content is loaded before attempting auto-population
2025-11-11 17:52:32 +00:00
openhands ece4952330 Fix discovery service integration and JavaScript execution issues
- Add simplified protocol signals table for discovery integration
- Add signal modal for discovery data population
- Fix JavaScript null element reference issues with fallback selectors
- Improve auto-populate function to work with both signal and mapping forms
- Add error handling for missing DOM elements
- Fix global function exposure for discovery integration
- Update template to include discovery-compatible UI elements
2025-11-11 17:35:41 +00:00
openhands 698c114609 Fix discovery scan button integration and add debugging
- Add event binding for discovery scan button
- Implement startDiscoveryScan method with proper UI updates
- Add comprehensive debug logging to track discovery flow
- Fix discovery results container detection
- Improve error handling and user feedback

Now the discovery workflow should work properly:
1. Click 'Start Discovery Scan' button
2. See progress status and results
3. Click 'Use This Signal' to populate form
4. Click 'Apply All as Protocol Signals' to create all
2025-11-09 14:30:50 +00:00
openhands a639e3159a Fix discovery to protocol mapping integration
- Fix global function references between discovery.js and protocol_mapping.js
- Add 'Apply All as Protocol Signals' functionality to discovery results
- Implement bulk signal creation from discovery results
- Add proper CSS styling for discovery results and notifications
- Expose key functions to global scope for cross-script communication
- Improve modal auto-population with better timing and error handling

Now discovery results properly:
- Populate the signal form when clicking 'Use This Signal'
- Create all signals at once when clicking 'Apply All as Protocol Signals'
- Show clear notifications for success/failure
- Refresh the protocol signals display automatically
2025-11-09 14:18:45 +00:00
openhands f0d6aca5ed Complete migration to simplified protocol signals architecture
- Replace complex ID system with intuitive signal name + tags approach
- Update main dashboard protocol mapping interface to use simplified system
- Add comprehensive API endpoints for protocol signals management
- Create simplified configuration manager and data models
- Implement discovery integration with auto-population of signal forms
- Add migration scripts and comprehensive test suite
- Update JavaScript files to use simplified system
- Create modern UI with filtering, tag cloud, and responsive design

Key improvements:
- Human-readable signal names instead of complex IDs
- Flexible tag-based categorization and filtering
- Seamless discovery to signal conversion
- Cleaner architecture with reduced complexity
- Better user experience and maintainability
2025-11-09 13:16:29 +00:00
openhands 04404674ee Fix protocol discovery modal integration and timing issues
- Add robust modal opening with multiple fallback methods
- Implement proper timing waits for modal and dropdown loading
- Add comprehensive logging for debugging
- Fix field population sequence and validation
- Add waitForStationsLoaded method to handle async dropdown loading
- Ensure all form fields are properly populated including mapping_id
- Set default database source based on device name

Co-authored-by: openhands <openhands@all-hands.dev>
2025-11-08 13:23:18 +00:00
openhands 87cc40a802 Fix protocol discovery form prefilling issues
- Update field IDs to match actual form (station_id, equipment_id, data_type_id)
- Add validation methods to check if metadata IDs exist
- Use actual sample metadata IDs instead of hardcoded defaults
- Fix station/equipment/data type dropdown population
- Update Apply All functionality to use real metadata
- Ensure discovery results properly prefill protocol mapping form

Co-authored-by: openhands <openhands@all-hands.dev>
2025-11-08 13:13:56 +00:00
openhands 305a9d2a96 Improve sample metadata consistency and coverage
- Add Control Station to demonstrate more location types
- Add Control Valve and PLC Controller to use more equipment types
- Add Valve Position and Emergency Stop data types
- Better coverage of core tag categories
- More realistic industrial automation scenario
- Maintains same custom tags but with better categorization

Co-authored-by: openhands <openhands@all-hands.dev>
2025-11-08 11:44:06 +00:00
openhands b6dda1b10d Update summary with sample metadata information
Co-authored-by: openhands <openhands@all-hands.dev>
2025-11-08 11:32:29 +00:00
openhands afeac4bf84 Add sample metadata initialization for demonstration
- Create metadata initializer to load sample data on application startup
- Add sample metadata file with realistic water system configuration
- Update main application to initialize metadata during startup
- Sample includes 2 stations, 4 equipment, 4 data types with descriptive tags
- Provides realistic data for protocol mappings UI testing

Co-authored-by: openhands <openhands@all-hands.dev>
2025-11-08 11:31:20 +00:00
openhands de26bfe9d0 Update summary with UI improvements for human-readable names
Co-authored-by: openhands <openhands@all-hands.dev>
2025-11-08 11:20:53 +00:00
openhands 86e92f6111 Improve protocol mappings UI with human-readable names
- Update displayProtocolMappings to show station/equipment/data type names from tag metadata
- Ensure tag metadata is loaded before displaying protocol mappings
- Update table headers to indicate Name & ID format
- Users now see descriptive names instead of raw IDs in the mappings table

Co-authored-by: openhands <openhands@all-hands.dev>
2025-11-08 11:20:04 +00:00
openhands 5a2cdc2324 Complete legacy system removal and tag metadata integration
- Remove legacy configuration classes: PumpStationConfig, PumpConfig, SafetyLimitsConfig
- Update ProtocolMapping model with tag metadata validators
- Replace text inputs with dropdowns in UI templates
- Add tag metadata loading functions to JavaScript
- Remove legacy API endpoints and add tag metadata endpoints
- Update security permissions to remove configure_safety_limits
- Clean up configuration manager and hardware discovery
- All integration tests pass successfully

Co-authored-by: openhands <openhands@all-hands.dev>
2025-11-08 10:31:36 +00:00
openhands c741ac8553 Fix discovery count doubling and apply results errors
- Fix total_discovered_endpoints count to use DISTINCT device_id instead of counting all endpoints
- Fix apply_discovery_results endpoint to handle dictionary data correctly
- Replace object attribute access with dict.get() methods for scan results

Resolves issues where discovery count doubled with each scan and
apply results failed with '[object Object]' errors.
2025-11-07 10:59:19 +00:00
openhands a41d638268 Fix discovery service persistence and API issues
- Add persistent discovery service auto-initialization in start_dashboard.py
- Fix 'is_scanning' field in discovery status API
- Fix scan results API to handle dictionary data correctly
- Fix database schema issues for discovery_results table
- Add debugging for service initialization

Resolves issues with discovery service not persisting across restarts
and API endpoints returning incorrect data formats.
2025-11-07 10:56:14 +00:00
openhands 1339b8bc55 Fix discovery service persistence issue
- Add discovery_results table to database schema
- Create persistent discovery service with database storage
- Update dashboard API to use persistent discovery service
- Initialize persistent discovery service on application startup
- Fix 404 errors when polling discovery scan results
2025-11-07 09:28:47 +00:00
openhands d0433f45d2 Fix dashboard JavaScript errors and add favicon
- Fixed syntax error in dashboard.js (missing closing bracket for DOMContentLoaded)
- Added favicon.ico file to static directory
- Added favicon link to dashboard HTML template
- All JavaScript errors should now be resolved
- Dashboard should load without console errors
2025-11-07 07:58:15 +00:00
openhands 11baac8f21 Fix deployment script health check bug
Fixed TypeError in SSHDeployer.execute_remote() method by adding 'silent' parameter
- Added silent parameter with default value False
- Modified print statements to respect silent mode
- Health checks now work correctly during deployment

This ensures the deployment script can properly wait for services to start and validate the deployment
2025-11-06 20:19:55 +00:00
openhands 2f94c083b9 Add comprehensive deployment documentation
Created detailed deployment guides:
- DEPLOYMENT.md: Complete step-by-step deployment guide with configuration and key management
- DEPLOYMENT_CHECKLIST.md: Quick reference checklist for deployment process

Both guides cover:
- SSH key configuration and management
- Environment setup and configuration
- Multiple deployment methods (Python SSH, shell script, manual)
- Post-deployment verification and health checks
- Troubleshooting and rollback procedures
- Security considerations

Documentation provides clear instructions for production, staging, and test deployments
2025-11-06 20:03:16 +00:00
openhands 2beb0d1436 Fix file references after repository reorganization
Updated references in:
- deploy/deploy-onprem.sh: Fixed paths for test-deployment.sh and test_dashboard_local.py
- deploy/validate-deployment.sh: Fixed path for test-e2e-deployment.py
- tests/integration/test-e2e-deployment.py: Fixed paths for mock servers

All file references now point to correct locations in the new organized structure
2025-11-06 19:56:13 +00:00
openhands 744e8f6946 Reorganize repository structure for better organization
Created organized directory structure:
- scripts/ - for utility scripts (test runners, etc.)
- tests/mocks/ - for mock servers
- deploy/ - for all deployment scripts
- src/dashboard/ - for dashboard assets

Moved files:
- Test runners: run_tests_by_system.py, run_tests_detailed.py, run_tests_with_db.sh → scripts/
- Deployment scripts: deploy-onprem.sh, setup-server.sh, etc. → deploy/
- Mock servers: mock-optimization-server.py, mock-scada-server.py → tests/mocks/
- Individual tests: test_*.py files → tests/
- Integration tests: test-e2e-deployment.py, test-remote-integration.py → tests/integration/
- Dashboard assets: fixed-dashboard.js → src/dashboard/

Deleted redundant files:
- pytest-mock.ini (redundant with pytest.ini)
- setup-server-backup.sh (duplicate of setup-server.sh)

Kept essential files in root:
- Core documentation (README.md, QUICKSTART.md, etc.)
- Environment templates
- Docker files
- Main test runner (run_tests.py)
- Application entry point (start_dashboard.py)
2025-11-06 19:53:39 +00:00
openhands 94da8687b1 Fix .gitignore formatting and add htmlcov exclusion 2025-11-06 19:40:51 +00:00
openhands 72c51d5ee6 Clean up repository by removing legacy files and temporary documents
Removed:
- Temporary test databases (*.db files)
- Coverage files (.coverage)
- Legacy planning documents (COMPLETION, SUMMARY, PLAN, VERIFICATION files)
- Duplicate test files (_debug, _direct, _fast, _v2, _fix variants)
- Temporary Python files (_modified.py)
- Redundant documentation files

Kept essential documentation:
- README.md, QUICKSTART.md, SECURITY.md
- Core documentation in docs/ directory
- Essential deployment guides
2025-11-06 19:39:35 +00:00
openhands d9481b7246 Add untracked test files and update deployment scripts
- Add discovery protocol test files for debugging and direct testing
- Add remote test integration scripts and configuration
- Update deployment and monitoring scripts with recent changes
- Include test-remote.yml configuration for remote testing
2025-11-06 19:29:21 +00:00
openhands 079ae7a1b2 Fix discovery API endpoints and JavaScript dashboard
- Updated discovery service import to use protocol_discovery_fast
- Fixed recent discoveries endpoint to properly extract endpoints from scan results
- Enhanced dashboard JavaScript with complete functionality
- Updated Docker configuration for discovery module inclusion
- Added remote deployment documentation

This resolves the discovery API 404 errors and ensures all dashboard features work correctly.
2025-11-06 14:31:50 +00:00
openhands d21804e3d9 feat: Implement protocol discovery service with auto-discovery capabilities
- Add ProtocolDiscoveryService with network scanning for all protocols
- Create discovery API endpoints for scan management and results
- Implement discovery UI components in dashboard
- Add comprehensive unit tests for discovery functionality
- Integrate discovery with configuration manager for automatic mapping creation
- Support background task execution for long-running discovery scans
- Include discovery status monitoring and recent discoveries endpoints
2025-11-04 10:01:28 +00:00
openhands 48a1a49384 Add comprehensive test suite for protocol mapping functionality
- Created 35 comprehensive tests covering ConfigurationManager, protocol validation, and database integration
- Added unit tests for ConfigurationManager with database persistence
- Added protocol-specific validation tests for all 4 protocols (Modbus TCP, Modbus RTU, OPC UA, REST API)
- Added integration tests for protocol server integration
- Enhanced existing API tests for protocol mapping endpoints
- Fixed database integration issues in ConfigurationManager
- Improved validation logic and error handling
- All tests passing with comprehensive coverage of Phase 1 functionality
2025-11-04 09:14:11 +00:00
openhands f55a4ccf68 Fix Modbus performance registers and add protocol architecture documentation
- Extended Modbus server input register range from 300 to 400 registers
- Fixed IllegalAddress errors for performance registers (400-499)
- Added timeout protection for Modbus operations in dashboard API
- Added protocol architecture diagram to documentation
- Confirmed both OPC UA and Modbus servers are running correctly
- Protocol clients now successfully read real data with 0% error rate

Test Results:
- OPC UA: 15/15 signals active, 0% error rate
- Modbus: 18/18 signals active, 0% error rate
- REST: 3/3 signals active, 0% error rate
2025-11-01 22:33:22 +00:00
openhands 3413ca4a85 Fix OPC UA server security policy configuration
- Use correct SecurityPolicyType enum values instead of strings
- Server now properly offers NoSecurity (0) policy endpoint
- Fixes 'No matching endpoints' error in client connections
2025-11-01 21:10:17 +00:00
openhands f2bedcd183 fix: Remove await from synchronous Modbus client disconnect call
The Modbus client disconnect method is synchronous, not async
2025-11-01 20:32:04 +00:00
openhands c53d224874 fix: Use actual Modbus client methods for reading registers
- Replace get_pump_data with direct register reads
- Read holding register 350 for pump speed
- Read input register 0 for flow rate
- Calculate derived values for power, pressure, and status
2025-11-01 20:29:54 +00:00
openhands 76eb59036b fix: Remove await from synchronous Modbus client connect call
The Modbus client connect method is synchronous, not async
2025-11-01 20:26:48 +00:00
openhands 4a3db6a3fc fix: Correct Modbus client class name in signals endpoint
Use correct class name 'ModbusClient' instead of 'ModbusTCPClient'
2025-11-01 20:24:04 +00:00
openhands 74a6f5e865 fix: Fix logging error in signals endpoint
Fix logger call to use proper string formatting instead of keyword arguments
2025-11-01 20:21:53 +00:00
openhands ea3ec2b3f9 feat: Restore protocol client integration for Modbus in signals endpoint
- Use real Modbus data when available
- Keep fallback for OPC UA until security policy issues are resolved
- Maintain graceful fallback to mock data if protocol clients fail
2025-11-01 20:20:08 +00:00
openhands 7917fb0968 fix: Fix OPC UA server security configuration
Only configure secure security policies when certificates are available. When certificates are not available, only offer the None security policy and skip certificate validation configuration.
2025-11-01 20:12:50 +00:00
openhands 9c92c5c47f fix: Remove explicit security policy setting from OPC UA client
Let the client automatically negotiate security policy with the server instead of trying to set it explicitly
2025-11-01 20:03:20 +00:00
openhands 2bad8c9ea0 fix: Fix OPC UA client async security policy setting and handle missing Modbus registers
- OPC UA client: Await set_security_string method call
- Modbus client: Handle case where performance metrics registers might not exist
2025-11-01 19:59:59 +00:00
openhands ac89d72aa9 fix: Update protocol clients to fix security policy mismatch and register address issues
- OPC UA client: Explicitly set security policy to 'None' to match server
- OPC UA client: Fix connection handling to check if connection succeeded
- Modbus client: Update register addresses to match server configuration
- Modbus client: Add proper connection success checking
2025-11-01 19:52:58 +00:00
openhands 7cf7ed928b fix: Simplify signals endpoint to use only fallback data to avoid protocol client issues 2025-11-01 19:27:45 +00:00
openhands b15b37658e fix: Add timeout handling to protocol clients to prevent hanging 2025-11-01 18:46:44 +00:00
openhands 400563ac28 fix: Add timeouts and fallback data to signals endpoint to prevent hanging 2025-11-01 18:16:02 +00:00
openhands 66e56eb70c fix: Update test deployment scripts to use port 8081 for test environment
- Updated test-deployment.sh to use port 8081 instead of 8080
- Updated test-e2e-deployment.py to use port 8081 instead of 8080
- Updated setup-test-environment.sh to use port 8081 instead of 8080
- All test scripts now work correctly with test environment configuration
2025-11-01 17:50:28 +00:00