feat: Add comprehensive CRUD functionality for controls and tanks wit…#10
Merged
StuartF303 merged 1 commit intomainfrom Nov 6, 2025
Merged
Conversation
…h provider configuration
Implements full create, read, update, and delete operations for both controls and tanks
with hardware provider configuration options.
Controls.razor:
- Add "Add Control" button in header
- Add Edit and Delete icon buttons on each control card
- Create Add/Edit dialog with form validation
- Control name, type (Toggle/Dimmer/Momentary/Selector), icon selection
- Provider configuration section with three options:
* Simulated (for testing)
* GPIO Pin (pin number, active low option)
* Modbus Device (address, register, register type)
- Implement SaveControl method (handles both create and update)
- Implement DeleteControl method with confirmation dialog
- Add ControlPlugin and ControlConfiguration properties to ControlDto
- Wire up all CRUD operations to backend API
Tanks.razor:
- Add "Add Tank" button in header
- Add Edit and Delete icon buttons on each tank card
- Create Add/Edit dialog with form validation
- Tank name, type (FreshWater/WasteWater/LPG/Fuel/Battery)
- Capacity (liters), low/high level thresholds (%)
- Sensor provider configuration section with four options:
* Simulated (for testing)
* I2C Sensor (I2C address, channel number)
* Modbus Device (address, register, register type)
* Analog Input (pin, min/max voltage for calibration)
- Implement SaveTank method (handles both create and update)
- Implement DeleteTank method with confirmation dialog
- Add SensorPlugin and SensorConfiguration properties to TankDto
- Wire up all CRUD operations to backend API
Index.razor (Dashboard):
- Add LoadControls method to fetch controls from API
- Add CreateOverlaysFromControls method to display controls on diagram
- Update OnControlToggle to call API and update control state
- Add ControlDto class definition
- Controls now appear as interactive switches on the van diagram
- Control state changes are sent to backend and broadcast via SignalR
- Both tanks and controls are now fully interactive on the diagram
Key Features:
- All changes default to "Simulated" provider for easy testing
- Provider configurations are stored in *Configuration dictionaries
- Dynamic form fields based on selected provider type
- Full validation on all form inputs
- Success/error notifications for all operations
- Confirmation dialogs before deletion
- Seamless integration with existing SignalR real-time updates
This enables users to:
1. Add custom tanks and controls via UI (no code changes needed)
2. Configure hardware connections (GPIO, Modbus, I2C, Analog)
3. Test with simulated providers before connecting real hardware
4. Edit configurations without redeployment
5. Remove unused tanks/controls easily
6. See all controls as interactive switches on the dashboard diagram
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…h provider configuration
Implements full create, read, update, and delete operations for both controls and tanks with hardware provider configuration options.
Controls.razor:
Tanks.razor:
Index.razor (Dashboard):
Key Features:
This enables users to: