diff --git a/src/components/DashboardView.tsx b/src/components/DashboardView.tsx index a65a804..0b4a0d1 100644 --- a/src/components/DashboardView.tsx +++ b/src/components/DashboardView.tsx @@ -1,6 +1,8 @@ import { Loader, NameValueTable, + PercentageBar, + PercentageCircle, SectionBox, SectionHeader, StatusLabel, @@ -9,30 +11,31 @@ import React from 'react'; import { AuditData, computeScore, countResults, ResultCounts } from '../api/polaris'; import { usePolarisDataContext } from '../api/PolarisDataContext'; -function scoreStatus(score: number): 'success' | 'warning' | 'error' { - if (score >= 80) return 'success'; - if (score >= 50) return 'warning'; - return 'error'; -} +const COLORS = { + pass: '#4caf50', + warning: '#ff9800', + danger: '#f44336', + skipped: '#9e9e9e', +}; function OverviewSection(props: { data: AuditData; counts: ResultCounts }) { const { counts } = props; const score = computeScore(counts); - const status = scoreStatus(score); + + const chartData = [ + { name: 'Pass', value: counts.pass, fill: COLORS.pass }, + { name: 'Warning', value: counts.warning, fill: COLORS.warning }, + { name: 'Danger', value: counts.danger, fill: COLORS.danger }, + { name: 'Skipped', value: counts.skipped, fill: COLORS.skipped }, + ]; return ( <> - - {score}%, - }, - ]} - /> + + - + + {counts.danger}, }, - { - name: 'Skipped', - value: {counts.skipped}, - }, + { name: 'Skipped', value: String(counts.skipped) }, ]} /> diff --git a/src/components/NamespaceDetailView.tsx b/src/components/NamespaceDetailView.tsx index 2edfd3b..99891de 100644 --- a/src/components/NamespaceDetailView.tsx +++ b/src/components/NamespaceDetailView.tsx @@ -120,7 +120,7 @@ export default function NamespaceDetailView() { }, { name: 'Skipped', - value: {counts.skipped}, + value: String(counts.skipped), }, ]} /> diff --git a/src/components/NamespacesListView.tsx b/src/components/NamespacesListView.tsx index 1b0b3bc..2dfbe3f 100644 --- a/src/components/NamespacesListView.tsx +++ b/src/components/NamespacesListView.tsx @@ -1,5 +1,5 @@ +import { Router } from '@kinvolk/headlamp-plugin/lib'; import { - Link, Loader, NameValueTable, SectionBox, @@ -8,6 +8,7 @@ import { StatusLabel, } from '@kinvolk/headlamp-plugin/lib/CommonComponents'; import React from 'react'; +import { Link } from 'react-router-dom'; import { computeScore, countResultsForItems, @@ -91,7 +92,11 @@ export default function NamespacesListView() { { label: 'Namespace', getter: (row: NamespaceRow) => ( - + {row.namespace} ), @@ -118,7 +123,7 @@ export default function NamespacesListView() { }, { label: 'Skipped', - getter: (row: NamespaceRow) => {row.skipped}, + getter: (row: NamespaceRow) => String(row.skipped), }, ]} data={rows}