Skip to content

Conversation

@pgallino
Copy link
Collaborator

@pgallino pgallino commented May 23, 2025

This pull request introduces significant enhancements to the Table component and its usage across various files. The changes include adding support for row-level metadata, enabling dynamic row addition, and refining callback methods for editing and deleting rows. These updates improve flexibility and maintainability for tables in the application.

Enhancements to the Table Component (src/graphics/basic_components/table.ts):

  • Introduced the TableRow interface to encapsulate row data and metadata (e.g., edited status). Updated the rows property in TableOptions to use TableRow[] instead of string[][].
  • Added support for dynamically adding rows via the onAddRow callback and a new "Add Row" button in the table UI.
  • Improved row rendering by applying a CSS class (edited-row) for rows marked as edited and updated the logic for handling editable cells. [1] [2]
  • Added a utility method getRowHash to generate a key-value mapping of a row's data based on table headers. This is used for callbacks like onEdit.

Updates to ARP Table (src/graphics/renderables/arp_table.ts):

  • Refactored ARP table rows to use the TableRow interface, enabling metadata tracking (e.g., edited status).
  • Enhanced callbacks for editing and deleting rows to work with row keys (e.g., IP address) instead of indices. Added support for adding new rows.
  • Replaced direct calls to ARP table methods with utility functions (e.g., getArpTable, removeArpTableEntry) for improved modularity.

Updates to Device Info (src/graphics/renderables/device_info.ts):

  • Updated methods for adding ARP, routing, and switching tables to use TableRow for rows and track metadata like edited status. [1] [2] [3]
  • Replaced direct method calls with utility functions for fetching table data (e.g., getRoutingTable, getSwitchingTable). [1] [2]

Updates to Program Runner Info (src/graphics/renderables/program_runner_info.ts):

  • Refactored rows in the program runner table to use TableRow for consistency and added metadata support. Updated the onDelete callback to work with row keys (e.g., PID) instead of indices.

These changes collectively improve the extensibility and usability of tables across the application while ensuring better alignment with modern design patterns.

close #150

pgallino added 4 commits May 22, 2025 23:46
…tedIps

Persisted the routingTableEdited flag and routingTableEditedIps array in DataRouter to track and restore manual routing table edits across reloads.
@pgallino pgallino marked this pull request as draft May 23, 2025 16:50
pgallino added 21 commits May 23, 2025 14:35
… switching tables to a dedicated tables directory
…RP, routing, and switching tables to utilize new callback signatures
…arameter for better control over entry state
@pgallino pgallino changed the title Refactor/routing tables Refactor/routing-arp-switching table May 27, 2025
@pgallino pgallino changed the title Refactor/routing-arp-switching table Refactor/routing-arp-switching tables May 27, 2025
@pgallino pgallino marked this pull request as ready for review May 27, 2025 03:11
@pgallino pgallino marked this pull request as draft May 27, 2025 14:32
@pgallino pgallino marked this pull request as ready for review May 27, 2025 19:32
@pgallino pgallino merged commit 4c74067 into main May 28, 2025
3 checks passed
@pgallino pgallino deleted the refactor/routing_tables branch May 28, 2025 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow Manual Entry of Routing Table Entries

3 participants