Skip to content

Commit

Permalink
Fix status label for apps
Browse files Browse the repository at this point in the history
Signed-off-by: ashu8912 <aghildiyal@microsoft.com>
  • Loading branch information
ashu8912 committed Sep 5, 2024
1 parent e9ef5ec commit d543645
Showing 1 changed file with 6 additions and 30 deletions.
36 changes: 6 additions & 30 deletions flux-plugin/src/flux-applications/applicationcustomresource.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DateLabel, Link, SectionBox, Table } from '@kinvolk/headlamp-plugin/lib/components/common';
import { DateLabel, Link, SectionBox, StatusLabel, Table } from '@kinvolk/headlamp-plugin/lib/components/common';
import { KubeObject } from '@kinvolk/headlamp-plugin/lib/lib/k8s/cluster';
import { KubeCRD } from '@kinvolk/headlamp-plugin/lib/lib/k8s/crd';
import { Alert } from '@mui/material';
Expand All @@ -13,35 +13,11 @@ export default function FluxCustomResource(props: {
const [resource] = resourceClass.useList();

function prepareStatus(item: KubeCRD) {

if(item.spec.suspend) {
return <Alert style={{
padding: '0px'
}} p={0} severity="info">Suspended</Alert>;
}

// know if the flux kustomization is ready, not ready or suspendend or error
const conditions = item.status.conditions;
if (conditions) {
const ready = conditions.find(c => c.type === 'Ready');
if (ready) {
if (ready.status === 'True') {
return <Alert style={{
padding: '0px'
}} p={0} ml={-1} severity="success">Ready</Alert>;
} else {
return <Alert style={{
padding: '0px'
}} p={0} severity="error">Not Ready</Alert>;
}
}
}



return <Alert style={{
padding: '0px'
}} severity="warning" ml={-1}>Unknown</Alert>;
console.log("preparing status ",item);
const ready = item.status?.conditions?.find(c => c.type === 'Ready');
return <StatusLabel status={item.spec.suspend ? 'warning' : ready ? 'success':'error'} >
{item.spec.suspend ? 'Suspended' : ready ? 'Ready' : 'Not Ready'}
</StatusLabel>;
}

return (
Expand Down

0 comments on commit d543645

Please sign in to comment.