import { Loader, NameValueTable, PercentageBar, PercentageCircle, SectionBox, SectionHeader, StatusLabel, } from '@kinvolk/headlamp-plugin/lib/CommonComponents'; import React from 'react'; import { AuditData, computeScore, countResults, ResultCounts } from '../api/polaris'; import { usePolarisDataContext } from '../api/PolarisDataContext'; 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 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 }, ]; return ( <> {counts.pass}, }, { name: 'Warning', value: {counts.warning}, }, { name: 'Danger', value: {counts.danger}, }, ]} /> ); } export default function DashboardView() { const { data, loading, error } = usePolarisDataContext(); if (loading) { return ; } const counts = data ? countResults(data) : null; return ( <> {error && ( {error}, }, ]} /> )} {data && counts && } {!data && !error && ( )} ); }