Skip to content

Commit

Permalink
frontend: Adds links to charts
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent T <vtaylor@microsoft.com>
  • Loading branch information
vyncent-t committed May 31, 2024
1 parent c3d2412 commit a147b14
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion frontend/src/components/common/Chart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export interface PercentageCircleProps {
size?: number;
dataKey?: string;
label?: string | null;
title?: string | null;
title?: string | JSX.Element | null;
legend?: string | null;
total?: number;
totalProps?: {
Expand Down
8 changes: 7 additions & 1 deletion frontend/src/components/workload/Overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import Pod from '../../lib/k8s/pod';
import ReplicaSet from '../../lib/k8s/replicaSet';
import StatefulSet from '../../lib/k8s/statefulSet';
import { getReadyReplicas, getTotalReplicas } from '../../lib/util';
import Link from '../common/Link';
import { PageGrid, ResourceLink } from '../common/Resource';
import ResourceListView from '../common/Resource/ResourceListView';
import { SectionBox } from '../common/SectionBox';
Expand Down Expand Up @@ -93,6 +94,11 @@ export default function Overview() {
);
});

function ChartLink(name: string) {
const linkName = name.toLowerCase() + 's';
return <Link routeName={linkName}>{name + 's'}</Link>;
}

return (
<PageGrid>
<SectionBox py={2} mt={1}>
Expand All @@ -102,7 +108,7 @@ export default function Overview() {
<WorkloadCircleChart
workloadData={workloadsData[name] || null}
// @todo: Use a plural from from the class itself when we have it
title={name + 's'}
title={ChartLink(name)}
partialLabel={t('translation|Failed')}
totalLabel={t('translation|Running')}
/>
Expand Down

0 comments on commit a147b14

Please sign in to comment.