refactor(ui): single source for diagnostics deck shortcuts; drop redundant .deck-menu.hidden #183

Open
opened 2026-09-28 13:58:46 +00:00 by gabogg · 0 comments
Owner

Follow-up from review pass 2 on #173 (deferred P3 standards/smell findings).

Findings

  1. Duplicated code: DIAGNOSTICS_DECKS (app/static/js/src/ui/deck_menu.js:10-14) repeats the F-key-to-deck pairs from KEY_DECK_MAP (app/static/js/app.js:44-53) (probes/F4, console/F6, logs/F7). Changing a shortcut means editing both files.
  2. Redundant CSS rule: .deck-menu.hidden { display: none; } (app/static/css/tactical-telemetry.css:1386) repeats the global .hidden { display: none !important; } rule.

Acceptance criteria

  • Each diagnostics deck's shortcut key is defined in one place. For example, initDiagnosticsMenu could derive the menu item keys from KEY_DECK_MAP.
  • The redundant .deck-menu.hidden rule is removed, and the menu still hides.
  • The frontend tests pass.

Not filed, because they match the existing deck-selector idiom: plain-text shortcuts instead of <kbd> (§3.3), no 1px pressed offset (§5.4), and the button label naming only F4.

Follow-up from review pass 2 on #173 (deferred P3 standards/smell findings). ## Findings 1. **Duplicated code:** `DIAGNOSTICS_DECKS` (`app/static/js/src/ui/deck_menu.js:10-14`) repeats the F-key-to-deck pairs from `KEY_DECK_MAP` (`app/static/js/app.js:44-53`) (`probes`/F4, `console`/F6, `logs`/F7). Changing a shortcut means editing both files. 2. **Redundant CSS rule:** `.deck-menu.hidden { display: none; }` (`app/static/css/tactical-telemetry.css:1386`) repeats the global `.hidden { display: none !important; }` rule. ## Acceptance criteria - [ ] Each diagnostics deck's shortcut key is defined in one place. For example, `initDiagnosticsMenu` could derive the menu item keys from `KEY_DECK_MAP`. - [ ] The redundant `.deck-menu.hidden` rule is removed, and the menu still hides. - [ ] The frontend tests pass. Not filed, because they match the existing deck-selector idiom: plain-text shortcuts instead of `<kbd>` (§3.3), no 1px pressed offset (§5.4), and the button label naming only F4.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gabogg/hikcentral#183
No description provided.