mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-11 13:17:07 +00:00
refactor(web-app-dashboard): hide a tile through services.dashboard.enabled instead of display
services.dashboard.enabled already says whether a role takes part in the dashboard: roles_with_service lists only roles with enabled and shared as tile-reachability targets, the CSP filter adds the dashboard to frame-ancestors only when it is set, and docker_cards uses it as the card's iframe flag. A separate display key duplicated that switch and left a role with enabled false still rendering a card. docker_cards now skips the card when services.dashboard.enabled is false (a role without a dashboard binding keeps its card, and a value that is not a boolean fails loudly), so display, its validator exception and its roles_with_service filter go again; base.md documents enabled as the per-host switch. An inventory hides a tile with applications.<role>.services.dashboard.enabled: false, which also drops the dashboard framing of that role. Unit tests cover false, true, a missing binding, a rendered string and a non-boolean; forcing the helper to always show the card fails four of them. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
ae7f2bbcb2
commit
c855efc30a
10 files changed
+48
-123
No files matched your search
@@ -105,33 +105,6 @@ class TestCompareApplicationKeys(unittest.TestCase):
|
||||
defaults = {"web-app-cst-demo": {"services": {"port": 8080}}}
|
||||
self.assertEqual(compare_application_keys(apps, defaults, "src"), [])
|
||||
|
||||
def test_dashboard_display_is_legal_where_dashboard_is_declared(self):
|
||||
apps = {"app1": {"services": {"dashboard": {"display": False}}}}
|
||||
defaults = {"app1": {"services": {"dashboard": {"enabled": False}}}}
|
||||
self.assertEqual(compare_application_keys(apps, defaults, "src"), [])
|
||||
|
||||
def test_dashboard_display_is_legal_where_a_variant_declares_dashboard(self):
|
||||
apps = {"app1": {"services": {"dashboard": {"display": False}}}}
|
||||
defaults = {"app1": {"services": {}}}
|
||||
variants = {"app1": [{"services": {"dashboard": {"enabled": True}}}]}
|
||||
self.assertEqual(compare_application_keys(apps, defaults, "src", variants), [])
|
||||
|
||||
def test_dashboard_display_without_a_dashboard_binding_is_flagged(self):
|
||||
apps = {"app1": {"services": {"dashboard": {"display": False}}}}
|
||||
defaults = {"app1": {"services": {"port": 8080}}}
|
||||
result = compare_application_keys(apps, defaults, "src")
|
||||
self.assertEqual(
|
||||
sorted(err.rsplit(": ", 1)[1] for err in result),
|
||||
["services.dashboard", "services.dashboard.display"],
|
||||
)
|
||||
|
||||
def test_other_undeclared_dashboard_keys_stay_flagged(self):
|
||||
apps = {"app1": {"services": {"dashboard": {"dispaly": False}}}}
|
||||
defaults = {"app1": {"services": {"dashboard": {"enabled": False}}}}
|
||||
result = compare_application_keys(apps, defaults, "src")
|
||||
self.assertEqual(len(result), 1)
|
||||
self.assertIn("services.dashboard.dispaly", result[0])
|
||||
|
||||
def test_declaration_keys_on_an_in_tree_role_are_flagged(self):
|
||||
apps = {"app1": {"custom": True, "source": {"url": "https://x/y.git"}}}
|
||||
defaults = {"app1": {"services": {}}}
|
||||
|
||||
Reference in new issue
Block a user