From 5858581d257dbef9ad0dee9352722a5492d6bf69 Mon Sep 17 00:00:00 2001 From: Bikash Date: Thu, 21 Dec 2023 15:02:57 +0530 Subject: [PATCH] Fixed status issue in nodepool --- src/apps/console/components/commons.tsx | 22 ++++++++++++++----- .../nodepool-resources.tsx | 5 ++--- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/apps/console/components/commons.tsx b/src/apps/console/components/commons.tsx index eb67cd09e..3aea4e453 100644 --- a/src/apps/console/components/commons.tsx +++ b/src/apps/console/components/commons.tsx @@ -120,7 +120,7 @@ interface IUpdateMeta { } // Component for Status parsing -export type IStatus = 'deleting' | 'notready' | 'none'; +export type IStatus = 'deleting' | 'notready' | 'syncing' | 'none'; interface IStatusMeta { markedForDeletion?: boolean; @@ -136,6 +136,8 @@ interface IStatusMeta { }; } +type IResourceType = 'nodepool' + type ICommonMeta = IUpdateMeta & IStatusMeta; const parseStatusComponent = ({ status }: { status: IStatus }) => { @@ -144,18 +146,26 @@ const parseStatusComponent = ({ status }: { status: IStatus }) => { return
Deleting...
; case 'notready': return
Not Ready
; + case 'notready': + return
Syncing
; default: return null; } }; -export const parseStatus = (item: IStatusMeta) => { +export const parseStatus = ({item, type}:{item: IStatusMeta, type?:IResourceType}) => { let status: IStatus = 'none'; if (item.markedForDeletion) { status = 'deleting'; } else if (!item.status?.isReady) { - status = 'notready'; + switch(type){ + case 'nodepool': + status = 'syncing' + break; + default: + status = 'notready' + } } return { status, component: parseStatusComponent({ status }) }; @@ -182,12 +192,12 @@ export const listRender = ({ ), }; }, - statusRender: ({ className }: { className: string }) => { + statusRender: ({ className, type }: { className: string, type?:IResourceType }) => { return { key: generateKey(keyPrefix, 'status'), className, - render: () => parseStatus(resource).component, - status: parseStatus(resource).status, + render: () => parseStatus({item:resource, type}).component, + status: parseStatus({item:resource, type}).status, }; }, }; diff --git a/src/apps/console/routes/_.$account.$cluster.nodepools/nodepool-resources.tsx b/src/apps/console/routes/_.$account.$cluster.nodepools/nodepool-resources.tsx index 1e56e50c5..f602eccf0 100644 --- a/src/apps/console/routes/_.$account.$cluster.nodepools/nodepool-resources.tsx +++ b/src/apps/console/routes/_.$account.$cluster.nodepools/nodepool-resources.tsx @@ -117,8 +117,7 @@ const ListDetail = ( } return (
- {/* {minCount} - {maxCount} nodes */} - 99 - 99 nodes + {minCount} - {maxCount} nodes
); }; @@ -154,7 +153,7 @@ const ListDetail = ( } }; - const statusRender = lR.statusRender({ className: 'w-[180px]' }); + const statusRender = lR.statusRender({ className: 'w-[180px]', type:'nodepool' }); return (