Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8b8c447983 | |||
| 7b794f540f | |||
| 0f00fd2f29 | |||
| f95a74c6ae | |||
| 60fc377442 | |||
| dd3e877580 | |||
| da1ef7e0c3 |
@@ -0,0 +1,3 @@
|
|||||||
|
module.exports = {
|
||||||
|
extends: ['@headlamp-k8s/eslint-config'],
|
||||||
|
};
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container: node:20
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Lint
|
||||||
|
run: npx eslint --ext .ts,.tsx src/
|
||||||
|
|
||||||
|
- name: Type-check
|
||||||
|
run: npx tsc --noEmit
|
||||||
|
|
||||||
|
- name: Format check
|
||||||
|
run: npx prettier --check src/
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
module.exports = require('@headlamp-k8s/eslint-config/prettier-config');
|
||||||
@@ -7,3 +7,4 @@ RUN npx @kinvolk/headlamp-plugin build
|
|||||||
|
|
||||||
FROM alpine:3.20
|
FROM alpine:3.20
|
||||||
COPY --from=build /app/dist/ /plugins/polaris-headlamp-plugin/
|
COPY --from=build /app/dist/ /plugins/polaris-headlamp-plugin/
|
||||||
|
COPY --from=build /app/package.json /plugins/polaris-headlamp-plugin/
|
||||||
|
|||||||
+3
-3
@@ -1,4 +1,4 @@
|
|||||||
version: 0.0.3
|
version: 0.0.4
|
||||||
name: polaris-headlamp-plugin
|
name: polaris-headlamp-plugin
|
||||||
displayName: Polaris
|
displayName: Polaris
|
||||||
createdAt: "2026-02-05T19:00:00Z"
|
createdAt: "2026-02-05T19:00:00Z"
|
||||||
@@ -22,7 +22,7 @@ maintainers:
|
|||||||
- name: cpfarhood
|
- name: cpfarhood
|
||||||
email: "chris@farhood.org"
|
email: "chris@farhood.org"
|
||||||
annotations:
|
annotations:
|
||||||
headlamp/plugin/archive-url: "https://github.com/cpfarhood/polaris-headlamp-plugin/releases/download/v0.0.3/polaris-headlamp-plugin-0.0.3.tar.gz"
|
headlamp/plugin/archive-url: "https://github.com/cpfarhood/polaris-headlamp-plugin/releases/download/v0.0.4/polaris-headlamp-plugin-0.0.4.tar.gz"
|
||||||
headlamp/plugin/version-compat: ">=0.26"
|
headlamp/plugin/version-compat: ">=0.26"
|
||||||
headlamp/plugin/archive-checksum: sha256:4997063bd44fbdd3610727f58616bd1fb2920b78c8e955b5279e0e017e718773
|
headlamp/plugin/archive-checksum: sha256:4c460681d389c8977d7e7ae57ac6aedd64281de4b58284b0bcc9fb34525432f2
|
||||||
headlamp/plugin/distro-compat: in-cluster
|
headlamp/plugin/distro-compat: in-cluster
|
||||||
|
|||||||
+6
-2
@@ -1,12 +1,16 @@
|
|||||||
{
|
{
|
||||||
"name": "polaris-headlamp-plugin",
|
"name": "polaris-headlamp-plugin",
|
||||||
"version": "0.0.3",
|
"version": "0.0.4",
|
||||||
"description": "Headlamp plugin for Fairwinds Polaris audit results",
|
"description": "Headlamp plugin for Fairwinds Polaris audit results",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "headlamp-plugin start",
|
"start": "headlamp-plugin start",
|
||||||
"build": "headlamp-plugin build",
|
"build": "headlamp-plugin build",
|
||||||
"package": "headlamp-plugin package",
|
"package": "headlamp-plugin package",
|
||||||
"tsc": "tsc --noEmit"
|
"tsc": "tsc --noEmit",
|
||||||
|
"lint": "eslint --ext .ts,.tsx src/",
|
||||||
|
"lint:fix": "eslint --ext .ts,.tsx --fix src/",
|
||||||
|
"format": "prettier --write src/",
|
||||||
|
"format:check": "prettier --check src/"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@kinvolk/headlamp-plugin": "^0.13.0"
|
"@kinvolk/headlamp-plugin": "^0.13.0"
|
||||||
|
|||||||
+1
-1
@@ -157,7 +157,7 @@ export function usePolarisData(refreshIntervalSeconds: number): PolarisDataState
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const intervalId = window.setInterval(() => {
|
const intervalId = window.setInterval(() => {
|
||||||
setTick((t) => t + 1);
|
setTick(t => t + 1);
|
||||||
}, refreshIntervalSeconds * 1000);
|
}, refreshIntervalSeconds * 1000);
|
||||||
return () => window.clearInterval(intervalId);
|
return () => window.clearInterval(intervalId);
|
||||||
}, [refreshIntervalSeconds]);
|
}, [refreshIntervalSeconds]);
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
import {
|
import { Loader, SectionBox, SectionHeader } from '@kinvolk/headlamp-plugin/lib/CommonComponents';
|
||||||
Loader,
|
|
||||||
SectionBox,
|
|
||||||
SectionHeader,
|
|
||||||
} from '@kinvolk/headlamp-plugin/lib/CommonComponents';
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import {
|
import {
|
||||||
AuditData,
|
AuditData,
|
||||||
@@ -20,19 +16,16 @@ const INTERVAL_OPTIONS = [
|
|||||||
{ label: '30 minutes', value: 1800 },
|
{ label: '30 minutes', value: 1800 },
|
||||||
];
|
];
|
||||||
|
|
||||||
function RefreshSettings(props: {
|
function RefreshSettings(props: { interval: number; onChange: (seconds: number) => void }) {
|
||||||
interval: number;
|
|
||||||
onChange: (seconds: number) => void;
|
|
||||||
}) {
|
|
||||||
return (
|
return (
|
||||||
<div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
|
<div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
|
||||||
<label htmlFor="polaris-refresh-interval">Refresh interval:</label>
|
<label htmlFor="polaris-refresh-interval">Refresh interval:</label>
|
||||||
<select
|
<select
|
||||||
id="polaris-refresh-interval"
|
id="polaris-refresh-interval"
|
||||||
value={props.interval}
|
value={props.interval}
|
||||||
onChange={(e) => props.onChange(Number(e.target.value))}
|
onChange={e => props.onChange(Number(e.target.value))}
|
||||||
>
|
>
|
||||||
{INTERVAL_OPTIONS.map((opt) => (
|
{INTERVAL_OPTIONS.map(opt => (
|
||||||
<option key={opt.value} value={opt.value}>
|
<option key={opt.value} value={opt.value}>
|
||||||
{opt.label}
|
{opt.label}
|
||||||
</option>
|
</option>
|
||||||
@@ -69,9 +62,7 @@ function ScoreBadge(props: { score: number }) {
|
|||||||
const color = props.score >= 80 ? '#4caf50' : props.score >= 50 ? '#ff9800' : '#f44336';
|
const color = props.score >= 80 ? '#4caf50' : props.score >= 50 ? '#ff9800' : '#f44336';
|
||||||
return (
|
return (
|
||||||
<div style={{ textAlign: 'center', marginBottom: '16px' }}>
|
<div style={{ textAlign: 'center', marginBottom: '16px' }}>
|
||||||
<div style={{ fontSize: '3rem', fontWeight: 'bold', color }}>
|
<div style={{ fontSize: '3rem', fontWeight: 'bold', color }}>{props.score}%</div>
|
||||||
{props.score}%
|
|
||||||
</div>
|
|
||||||
<div style={{ fontSize: '0.875rem', opacity: 0.8 }}>Cluster Score</div>
|
<div style={{ fontSize: '0.875rem', opacity: 0.8 }}>Cluster Score</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -135,13 +126,12 @@ export default function PolarisView() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<SectionHeader title="Polaris" actions={[
|
<SectionHeader
|
||||||
<RefreshSettings
|
title="Polaris"
|
||||||
key="refresh"
|
actions={[
|
||||||
interval={interval}
|
<RefreshSettings key="refresh" interval={interval} onChange={handleIntervalChange} />,
|
||||||
onChange={handleIntervalChange}
|
]}
|
||||||
/>,
|
/>
|
||||||
]} />
|
|
||||||
|
|
||||||
{error && (
|
{error && (
|
||||||
<SectionBox title="Error">
|
<SectionBox title="Error">
|
||||||
@@ -153,9 +143,7 @@ export default function PolarisView() {
|
|||||||
|
|
||||||
{!data && !error && (
|
{!data && !error && (
|
||||||
<SectionBox title="No Data">
|
<SectionBox title="No Data">
|
||||||
<div style={{ padding: '16px' }}>
|
<div style={{ padding: '16px' }}>No Polaris audit results found.</div>
|
||||||
No Polaris audit results found.
|
|
||||||
</div>
|
|
||||||
</SectionBox>
|
</SectionBox>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
|
|||||||
+1
-4
@@ -1,7 +1,4 @@
|
|||||||
import {
|
import { registerRoute, registerSidebarEntry } from '@kinvolk/headlamp-plugin/lib';
|
||||||
registerRoute,
|
|
||||||
registerSidebarEntry,
|
|
||||||
} from '@kinvolk/headlamp-plugin/lib';
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PolarisView from './components/PolarisView';
|
import PolarisView from './components/PolarisView';
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"extends": "@kinvolk/headlamp-plugin/config/plugins-tsconfig.json",
|
||||||
|
"include": ["src"]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user