-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/editable routing tables #103
Conversation
…acking - Implemented editable fields for routing table entries, allowing users to modify IP, mask, and interface values directly. - Introduced a 'manuallyEdited' flag in each routing table entry to track manual modifications and prevent them from being overwritten during table regeneration. - Modified the regenerateRoutingTable function to retain manually edited entries while updating only non-modified ones. Currently, only changes to the 'interface' column have an effect, while modifications to the IP and mask columns do not affect the logic yet.
- Added a focus check to prevent shortcut execution when the user is typing in input or textarea fields.
… on invalid input
…d manual entry issues - Implemented persistence for routing tables to ensure they are saved and restored correctly. - Fixed the undo functionality for RemoveDevice to properly restore device connections and routing tables. - Resolved issues related to manually edited routing table entries: - Ensured manually edited entries are retained only if the corresponding connection exists. - Fixed overwriting issues caused by index-based management by switching to IP-based matching. - Improved consistency when regenerating routing tables after topology changes. These improvements enhance the stability and accuracy of the routing table management system.
Refactored the logic for preserving manually edited entries in the routing table. The previous implementation conditionally added entries to the new table if they were still connected. The updated logic now only updates existing entries and logs a warning if no matching entry is found, preventing unintended additions and ensuring data consistency.
Implemented logic to store and restore routing tables when a device is removed and then restored. Now, when a router is deleted, its routing table, along with the routing tables of connected devices, is saved. During an undo operation, the device and its connections are restored, ensuring that all routing tables are reinstated correctly.
Improved the user interface by implementing a popup modal for cell editing. Now, when a cell is clicked, a modal appears allowing users to edit values with validation and a better user experience. The modal is positioned next to the right sidebar for better accessibility.
- Added functionality to refresh the routing table. - Added support for row deletion, ensuring both UI and data are updated. - Integrated event listeners for handling table updates and row removal.
## 📌 Main Changes: ### 🛠 Refactored Routing Table Regeneration: - Created a `generateRoutingTable(id, preserveEdits)` function to eliminate duplicated code in `regenerateRoutingTableClean` and `regenerateRoutingTable`. - `generateRoutingTable` now handles route generation, and if `preserveEdits = true`, it preserves manually edited and deleted entries. - Improved code clarity with a cleaner and more reusable structure. ### 🎨 Improved Editable UI in Routing Table: - Removed the modal, making table cells directly editable (`contentEditable = "true"`). - Added column-based validation before saving changes: - **IP** → Ensures valid IP format. - **Subnet Mask** → Validates correct subnet mask values. - **Interface** → Only allows values in the `ethX` format. - If an invalid value is entered, it is reverted to the previous one, and a warning is displayed in the console. ### ⌨️ Keyboard Shortcut Handling: - Added a `keydown` event listener to prevent `Delete` or `Backspace` from triggering the shortcut for removing a device when editing a cell. ✅ **Results**: - More modular and reusable code. - Improved user experience when editing the table. - Easier maintenance for route generation logic. 🚀 Ready for testing and future enhancements!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a single comment. LGTM otherwise
connections: DeviceId[], | ||
viewgraph: ViewGraph, // Pasamos la vista para obtener las tablas de enrutamiento |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't need to do this anymore. I previously refactored CreateDevice
to store the node data from the datagraph, so if the data is in the datagraph, CreateDevice
has it.
Routing Table Editing:
Persistence Improvements:
Undo/Redo Enhancements:
TODO: Evaluate alternative UI approaches for routing table editing to improve user experience.
closes #73