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:
@@ -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
@@ -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.
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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>
|
||||
);
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user