mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-04-09 11:41:56 -07:00
Refactor network tree data structure and improve device status handling
- Updated the network tree data structure to use consistent naming conventions for device properties (e.g., devName, devMac). - Enhanced the initTree function to utilize the new property names and improved the rendering of device nodes. - Refactored the getStatusBadgeParts function to include additional parameters for archived and new device statuses. - Introduced convenience functions (badgeFromDevice and badgeFromDataAttrs) to streamline badge generation from device objects and data attributes. - Updated various language files to include new status labels and ensure consistency across translations. - Modified the renderSmallBox function to allow for custom icon HTML, improving flexibility in UI components.
This commit is contained in:
@@ -75,8 +75,17 @@ const GRAPHQL_EXTRA_FIELDS = [
|
||||
"devLastNotification",
|
||||
"devIsNew",
|
||||
"devIsArchived",
|
||||
"devIsSleeping",
|
||||
];
|
||||
|
||||
// Row positions for extra (non-display) fields.
|
||||
// In dataSrc, extra fields are appended AFTER the display columns in each row,
|
||||
// so their position = DEVICE_COLUMN_FIELDS.length + their index in GRAPHQL_EXTRA_FIELDS.
|
||||
// Use COL_EXTRA.fieldName to access them in createdCell rowData.
|
||||
const COL_EXTRA = Object.fromEntries(
|
||||
GRAPHQL_EXTRA_FIELDS.map((name, i) => [name, DEVICE_COLUMN_FIELDS.length + i])
|
||||
);
|
||||
|
||||
// Maps Device_TableHead_* language keys to their GraphQL/DB field names.
|
||||
// Used by getColumnNameFromLangString() in ui_components.js and by
|
||||
// column filter logic in devices.php.
|
||||
|
||||
Reference in New Issue
Block a user