Skip to content

Hide the green lock for all encrypted devices in compact views#745

Open
bdraco wants to merge 1 commit into
mainfrom
fix-1369-list-detail-lock
Open

Hide the green lock for all encrypted devices in compact views#745
bdraco wants to merge 1 commit into
mainfrom
fix-1369-list-detail-lock

Conversation

@bdraco

@bdraco bdraco commented Jun 10, 2026

Copy link
Copy Markdown
Member

What does this implement/fix?

The green encryption lock showed in the device detail drawer but not in the device list for confirmed-encrypted devices, so the two views disagreed. The list and the drawer were deriving the lock through separate code paths, and the list only hid the lock for mDNS-confirmed devices; YAML-encrypted-but-unconfirmed ones still showed it, which read as random.

Now the compact views (table rows, cards) hide the lock for every encrypted (active) device, so the list shows only attention states (plaintext, pending, mismatch). The drawer still shows the full encrypted badge for single-device inspection, and it now reads from the same VISUALS source the list uses so the two can't drift apart again.

Related issue or feature (if applicable):

Types of changes

  • Bugfix (non-breaking change which fixes an issue) — bugfix
  • New feature (non-breaking change which adds functionality) — new-feature
  • Enhancement to an existing feature — enhancement
  • Breaking change (fix or feature that would cause existing functionality to not work as expected) — breaking-change
  • Refactor (no behaviour change) — refactor
  • Documentation only — docs
  • Maintenance / chore — maintenance
  • CI / workflow change — ci
  • Dependencies bump — dependencies

Checklist

  • The code change is tested and works locally.
  • npm run lint passes.
  • npm run test passes.
  • Tests have been added to verify that the new code works (where applicable).

@github-actions github-actions Bot added the bugfix Bug fix label Jun 10, 2026
@bdraco bdraco force-pushed the fix-1369-list-detail-lock branch from e603efe to dd4c67c Compare June 10, 2026 02:29
@esphbot

esphbot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Previous review — superseded by a newer review below.

@esphbot esphbot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking issues found.

The device list/cards and the detail drawer derived the encryption lock
through separate code, so a confirmed-encrypted device showed no lock in
the list but a green badge in the drawer. Suppress the lock for every
active state in compact views and feed the drawer badge from the same
VISUALS source so the two can't drift.
@bdraco bdraco force-pushed the fix-1369-list-detail-lock branch from dd4c67c to f58ab8f Compare June 10, 2026 02:32
@bdraco

bdraco commented Jun 10, 2026

Copy link
Copy Markdown
Member Author

Tightened badgeClass to a literal union; it's a CSS class, so that matches the cssClass precedent and lets tsc catch a class typo. Left labelKey (and the adjacent tooltipKey) as string on purpose; those are i18n keys, and the whole codebase types localization keys as plain string (LocalizeFunc takes key: string), so a union there would be the inconsistent one.

@esphbot

esphbot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

@bdraco: Tightened badgeClass to a literal union; it's a CSS class, so that matches the cssClass preceden...

Correct split. badgeClass is a CSS class, union matches cssClass and lets tsc catch typos. labelKey matches its sibling tooltipKey, both i18n keys, both string — consistent with LocalizeFunc. No change needed.

@esphbot

esphbot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

PR Review — Hide the green lock for all encrypted devices in compact views

Clean, well-scoped bugfix; merge-ready, no blocking issues.

  • getCompactEncryptionVisual now returns null for any "active" state — exactly the #1369 fix, hiding the lock for YAML-encrypted-but-unconfirmed devices too.
  • Drawer renderEncryptionBadge now reads shared VISUALS via getEncryptionVisual instead of a duplicate local map; the new badgeClass/labelKey/iconName/tooltipKey values are byte-identical to the old map, so drawer output is preserved and future drift is eliminated.
  • No new translation keys; comments updated to match new behavior; tests updated to assert the new branch (null for api_encryption_active: null) and the new interface fields.
  • The lone nit (literal-union typing) was already resolved: badgeClass tightened to a union, labelKey left as string to match sibling tooltipKey and the codebase-wide i18n-key convention — the correct split.


Checklist

  • Behavior change matches intent (#1369)
  • Drawer output preserved after VISUALS consolidation
  • No orphaned/added translation keys
  • Tests cover changed branches
  • Type strictness consistent across interface

Automated review by Kōan (Claude) HEAD=f58ab8f 26s

@esphbot esphbot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking issues found.

@bdraco bdraco marked this pull request as ready for review June 10, 2026 03:08
Copilot AI review requested due to automatic review settings June 10, 2026 03:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Aligns encryption-state visuals between compact device listings (table rows/cards) and the device detail drawer by centralizing the drawer badge rendering on the shared VISUALS mapping, while hiding the “healthy/active encrypted” lock indicator in compact views for all encrypted-active devices (including YAML-encrypted but not yet mDNS-confirmed).

Changes:

  • Extend EncryptionVisual with drawer badge metadata (badgeClass, labelKey) and source drawer rendering from getEncryptionVisual() to prevent drift between views.
  • Change getCompactEncryptionVisual() to return null for all "active" encryption states, so compact views only surface attention states (plaintext/pending/mismatch).
  • Update and strengthen unit tests to validate the expanded visual contract and the new compact-view behavior.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/util/encryption-state.test.ts Updates tests to assert new EncryptionVisual fields and the “hide lock for all active” compact-view behavior.
src/util/encryption-state.ts Adds badge/label metadata to the shared visual map and changes compact-view logic to hide all "active" states.
src/components/device-card/render-bits.ts Updates compact-view comment to match new behavior (no functional change).
src/components/dashboard/table-columns.ts Updates compact-view comment to match new behavior (no functional change).
src/components/dashboard/device-drawer-content/render-sections.ts Refactors drawer encryption badge rendering to use getEncryptionVisual() + shared VISUALS mapping.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Green lock icon not displayed sometimes in device list

3 participants