Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed minor ui issues #50

Merged
merged 1 commit into from
Dec 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 22 additions & 11 deletions src/apps/console/components/commons.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { CopySimple, Info, Question } from '@jengaicons/react';
import { CopySimple, Question } from '@jengaicons/react';
import { ReactNode, useState } from 'react';
import { ProdLogo } from '~/components/branding/prod-logo';
import { WorkspacesLogo } from '~/components/branding/workspace-logo';
import useClipboard from '~/root/lib/client/hooks/use-clipboard';
import { generateKey, titleCase } from '~/components/utils';
import { Badge } from '~/components/atoms/badge';
import {
Kloudlite__Io___Pkg___Types__SyncStatusState as SyncState,
Kloudlite__Io___Pkg___Types__SyncStatusAction as SyncAction,
Expand Down Expand Up @@ -136,7 +135,7 @@ interface IStatusMeta {
};
}

type IResourceType = 'nodepool'
type IResourceType = 'nodepool';

type ICommonMeta = IUpdateMeta & IStatusMeta;

Expand All @@ -146,25 +145,31 @@ const parseStatusComponent = ({ status }: { status: IStatus }) => {
return <div className="bodySm text-text-soft pulsable">Deleting...</div>;
case 'notready':
return <div className="bodySm text-text-soft pulsable">Not Ready</div>;
case 'notready':
case 'syncing':
return <div className="bodySm text-text-soft pulsable">Syncing</div>;
default:
return null;
}
};

export const parseStatus = ({item, type}:{item: IStatusMeta, type?:IResourceType}) => {
export const parseStatus = ({
item,
type,
}: {
item: IStatusMeta;
type?: IResourceType;
}) => {
let status: IStatus = 'none';

if (item.markedForDeletion) {
status = 'deleting';
} else if (!item.status?.isReady) {
switch(type){
switch (type) {
case 'nodepool':
status = 'syncing'
status = 'syncing';
break;
default:
status = 'notready'
status = 'notready';
}
}

Expand Down Expand Up @@ -192,12 +197,18 @@ export const listRender = ({
),
};
},
statusRender: ({ className, type }: { className: string, type?:IResourceType }) => {
statusRender: ({
className,
type,
}: {
className: string;
type?: IResourceType;
}) => {
return {
key: generateKey(keyPrefix, 'status'),
className,
render: () => parseStatus({item:resource, type}).component,
status: parseStatus({item:resource, type}).status,
render: () => parseStatus({ item: resource, type }).component,
status: parseStatus({ item: resource, type }).status,
};
},
};
Expand Down
Loading