fix: restore badge emoji, fix aria-label, and correct service proxy URL

Three root causes for E2E test failures since March 4:

1. Service proxy URL missing http: protocol prefix — Kubernetes requires
   the format http:service-name:port, not service-name:port. This caused
   all data fetches to fail, making data-dependent components render
   empty states instead of expected content.

2. AppBarScoreBadge aria-label "Polaris cluster score: X%" doesn't match
   the E2E test regex /Polaris: \d+%/. Simplified to "Polaris: X%".

3. Shield emoji was removed from badge in commit 514de78 but E2E tests
   still assert its presence.

Fixes PRI-20

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
gandalf-the-greybeard[bot]
2026-03-08 01:21:51 +00:00
parent 8f69329764
commit 61bf1fe753
5 changed files with 7 additions and 6 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
## Project
Headlamp plugin surfacing Fairwinds Polaris audit results. Queries the Polaris dashboard API via Kubernetes service proxy (`/api/v1/namespaces/polaris/services/polaris-dashboard/proxy/results.json`). Read-only — no cluster write operations except exemption annotation patches.
Headlamp plugin surfacing Fairwinds Polaris audit results. Queries the Polaris dashboard API via Kubernetes service proxy (`/api/v1/namespaces/polaris/services/http:polaris-dashboard:80/proxy/results.json`). Read-only — no cluster write operations except exemption annotation patches.
- **Plugin name**: `polaris`
- **Target**: Headlamp >= v0.26
+1 -1
View File
@@ -218,7 +218,7 @@ const REFRESH_STORAGE_KEY = 'polaris-plugin-refresh-interval';
const DEFAULT_INTERVAL_SECONDS = 300; // 5 minutes
const URL_STORAGE_KEY = 'polaris-plugin-dashboard-url';
const DEFAULT_DASHBOARD_URL = '/api/v1/namespaces/polaris/services/polaris-dashboard:80/proxy/';
const DEFAULT_DASHBOARD_URL = '/api/v1/namespaces/polaris/services/http:polaris-dashboard:80/proxy/';
/**
* Retrieves the configured refresh interval from localStorage.
+1 -1
View File
@@ -131,6 +131,6 @@ describe('AppBarScoreBadge', () => {
mockUsePolarisDataContext.mockReturnValue({ data, loading: false });
render(<AppBarScoreBadge />);
expect(screen.getByLabelText('Polaris cluster score: 100%')).toBeInTheDocument();
expect(screen.getByLabelText('Polaris: 100%')).toBeInTheDocument();
});
});
+2 -1
View File
@@ -54,8 +54,9 @@ export default function AppBarScoreBadge() {
alignItems: 'center',
gap: '4px',
}}
aria-label={`Polaris cluster score: ${score}%`}
aria-label={`Polaris: ${score}%`}
>
<span>{'\u{1F6E1}\uFE0F'}</span>
<span>Polaris: {score}%</span>
</button>
);
+2 -2
View File
@@ -105,7 +105,7 @@ export default function PolarisSettings(props: PluginSettingsProps) {
type="text"
value={currentUrl}
onChange={handleUrlChange}
placeholder="/api/v1/namespaces/polaris/services/polaris-dashboard:80/proxy/"
placeholder="/api/v1/namespaces/polaris/services/http:polaris-dashboard:80/proxy/"
style={{
width: '100%',
padding: '4px 8px',
@@ -125,7 +125,7 @@ export default function PolarisSettings(props: PluginSettingsProps) {
>
Examples:
<br /> K8s proxy:{' '}
<code>/api/v1/namespaces/polaris/services/polaris-dashboard:80/proxy/</code>
<code>/api/v1/namespaces/polaris/services/http:polaris-dashboard:80/proxy/</code>
<br /> Full URL: <code>https://my-polaris.example.com</code>
</div>
</div>