fix: badge navigation uses window.location.pathname for cluster extraction

* fix: badge navigation uses window.location + correct settings plugin name

- AppBarScoreBadge: Read cluster from window.location.pathname instead of
  useCluster() (returns null in AppBar context) or useLocation() (may not
  reflect cluster prefix outside cluster route context)
- registerPluginSettings: Use 'polaris' to match the deployed directory name
  (plugin is at static-plugins/polaris, not headlamp-polaris)
- Add unit test for no-cluster fallback navigation

Supersedes the source-code fixes from PR #55 without the workflow/deploy
script changes that broke CI.

Co-Authored-By: Paperclip <noreply@paperclip.ing>

* fix: use Object.defineProperty for window.location in test

Replace `as Location` cast with Object.defineProperty to match the
existing beforeEach pattern and fix TypeScript strict mode error.

Co-Authored-By: Paperclip <noreply@paperclip.ing>

---------

Co-authored-by: Gandalf the Greybeard <gandalf@privilegedescalation.dev>
Co-authored-by: Paperclip <noreply@paperclip.ing>
This commit was merged in pull request #56.
This commit is contained in:
gandalf-the-greybeard[bot]
2026-03-17 17:06:14 +00:00
committed by GitHub
parent d64db24240
commit 76c7a5bc1f
3 changed files with 54 additions and 12 deletions
+1 -1
View File
@@ -99,7 +99,7 @@ registerRoute({
});
// Register plugin settings
registerPluginSettings('headlamp-polaris', PolarisSettings, true);
registerPluginSettings('polaris', PolarisSettings, true);
// Register details view section for supported controller types
registerDetailsViewSection(({ resource }) => {