Skip to content

Commit

Permalink
Merge pull request #264 from kloudlite/update/cluster-ui
Browse files Browse the repository at this point in the history
Update/cluster UI
  • Loading branch information
nxtcoder19 authored Jul 26, 2024
2 parents dd547bd + 2ce4a07 commit 0e1e7bd
Show file tree
Hide file tree
Showing 13 changed files with 153 additions and 428 deletions.
111 changes: 0 additions & 111 deletions gql-queries-generator/doc/queries.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -181,117 +181,6 @@ query consoleListAllClusters($search: SearchCluster, $pagination: CursorPaginati
}
totalCount
}
clusters: infra_listClusters(search: $search, pagination: $pagination) {
totalCount
pageInfo {
startCursor
hasPrevPage
hasNextPage
endCursor
}
edges {
cursor
node {
id
displayName
lastOnlineAt
markedForDeletion
metadata {
name
annotations
generation
}
creationTime
lastUpdatedBy {
userId
userName
userEmail
}
createdBy {
userEmail
userId
userName
}
updateTime
status {
checks
checkList {
description
debug
name
title
}
isReady
lastReadyGeneration
lastReconcileTime
message {
RawMessage
}
resources {
apiVersion
kind
name
namespace
}
}
syncStatus {
action
error
lastSyncedAt
recordVersion
state
syncScheduledAt
}
recordVersion
spec {
messageQueueTopicName
kloudliteRelease
clusterTokenRef {
key
name
namespace
}
accountId
accountName
availabilityMode
aws {
k3sMasters {
iamInstanceProfileRole
instanceType
nodes
nvidiaGpuEnabled
rootVolumeSize
rootVolumeType
}
nodePools
region
spotNodePools
}
gcp {
credentialsRef {
name
namespace
}
gcpProjectID
region
}
cloudProvider
backupToS3Enabled
cloudflareEnabled
clusterInternalDnsHost
clusterServiceCIDR
output {
keyK3sAgentJoinToken
keyK3sServerJoinToken
keyKubeconfig
secretName
}
publicDNSHost
taintMasterNodes
}
}
}
}
}

query consoleListClusters($search: SearchCluster, $pagination: CursorPaginationIn) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ import { Badge } from '~/components/atoms/badge';
import { CopyContentToClipboard } from '~/console/components/common-console-components';
import { NN } from '~/root/lib/types/common';
import { getClusterStatus } from '~/console/utils/commons';
import TooltipV2 from '~/components/atoms/tooltipV2';
import HandleIntercept from './handle-intercept';
import { IEnvironmentContext } from '../_layout';
import TooltipV2 from '~/components/atoms/tooltipV2';

const RESOURCE_NAME = 'app';
type BaseType = ExtractNodeType<IApps>;
Expand Down Expand Up @@ -128,7 +128,7 @@ const ExtraButton = ({ onAction, item }: IExtraButton) => {
icon: <GearSix size={iconSize} />,
type: 'item',
to: `/${account}/env/${environment}/app/${parseName(
item,
item
)}/settings/general`,
key: 'settings',
},
Expand Down Expand Up @@ -339,7 +339,7 @@ const ListView = ({ items = [], onAction }: IResource) => {
},
},
to: `/${parseName(account)}/env/${parseName(
environment,
environment
)}/app/${id}`,
};
}),
Expand All @@ -359,9 +359,9 @@ const AppsResourcesV2 = ({ items = [] }: Omit<IResource, 'onAction'>) => {
useWatchReload(
items.map((i) => {
return `account:${parseName(account)}.environment:${parseName(
environment,
environment
)}.app:${parseName(i)}`;
}),
})
);

const interceptApp = async (item: BaseType, intercept: boolean) => {
Expand All @@ -388,7 +388,7 @@ const AppsResourcesV2 = ({ items = [] }: Omit<IResource, 'onAction'>) => {
intercept
? 'App Intercepted successfully'
: 'App Intercept removed successfully'
}`,
}`
);
reload();
} catch (error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type BaseType = ExtractNodeType<IImportedManagedResources>;
const parseItem = (item: BaseType, templates: IMSvTemplates) => {
const logoUrl = getManagedTemplateLogo(
templates,
item.managedResource?.spec?.resourceTemplate.apiVersion || '',
item.managedResource?.spec?.resourceTemplate.apiVersion || ''
);
return {
name: item?.displayName,
Expand Down Expand Up @@ -272,7 +272,7 @@ const ManagedResourceResourcesV2 = ({
templates: IMSvTemplates;
}) => {
const [showDeleteDialog, setShowDeleteDialog] = useState<BaseType | null>(
null,
null
);
const [showSecret, setShowSecret] = useState<BaseType | null>(null);
const api = useConsoleApi();
Expand All @@ -284,7 +284,7 @@ const ManagedResourceResourcesV2 = ({
useWatchReload(
items.map((i) => {
return `account:${account}.environment:${environment}.managed_resource:${i.name}`;
}),
})
);

const props: IResource = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ const SecretItemResources = ({
return true;
}
return false;
}),
})
);
}, [searchText, modifiedItems]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,11 @@ const EnvironmentResourcesV2 = ({ items = [] }: { items: BaseType[] }) => {
useWatchReload(
items.map((i) => {
return `account:${parseName(account)}.environment:${parseName(i)}`;
}),
})
);

const [showDeleteDialog, setShowDeleteDialog] = useState<BaseType | null>(
null,
null
);
const [visible, setVisible] = useState<BaseType | null>(null);
const api = useConsoleApi();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,7 @@ import {
Trash,
} from '~/console/components/icons';
import { Link, useOutletContext, useParams } from '@remix-run/react';
import {
generateKey,
titleCase,
useAppend,
useMapper,
} from '~/components/utils';
import { generateKey, titleCase, useMapper } from '~/components/utils';
import { listRender } from '~/console/components/commons';
import ConsoleAvatar from '~/console/components/console-avatar';
import {
Expand Down Expand Up @@ -54,9 +49,8 @@ import { Badge } from '~/components/atoms/badge';
// import { Github__Com___Kloudlite___Api___Pkg___Types__SyncState as SyncStatusState } from '~/root/src/generated/gql/server';
import { ViewClusterLogs } from '~/console/components/cluster-logs-popop';
import { ensureAccountClientSide } from '~/console/server/utils/auth-utils';
import Tooltip from '~/components/atoms/tooltip';
import HandleByokCluster from '../byok-cluster/handle-byok-cluster';
import TooltipV2 from '~/components/atoms/tooltipV2';
import HandleByokCluster from '../byok-cluster/handle-byok-cluster';

type BaseType = ExtractNodeType<IClusters> & { type: 'normal' };
type ByokBaseType = ExtractNodeType<IByocClusters> & { type: 'byok' };
Expand Down Expand Up @@ -126,7 +120,7 @@ const ByokInstructionsPopup = ({
return api.getBYOKClusterInstructions({
name: item.metadata.name,
});
},
}
);

return (
Expand Down Expand Up @@ -523,27 +517,20 @@ const ListView = ({ items = [], onEdit, onDelete, onShowLogs }: IResource) => {
};

const ClusterResourcesV2 = ({
items,
byokItems,
}: {
items: Omit<BaseType, 'type'>[];
byokItems: Omit<ByokBaseType, 'type'>[];
}) => {
const { account } = useOutletContext<IAccountContext>();
const normalItems = useMapper(items, (i) => {
return { ...i, type: 'normal' as BaseType['type'] };
});

const bItems = useMapper(byokItems, (i) => {
return { ...i, type: 'byok' as ByokBaseType['type'] };
});

const finalItems = useAppend(normalItems, bItems);

useWatchReload(
finalItems.map((i) => {
bItems.map((i) => {
return `account:${parseName(account)}.cluster:${parseName(i)}`;
}),
})
);

const [showDeleteDialog, setShowDeleteDialog] =
Expand All @@ -557,7 +544,7 @@ const ClusterResourcesV2 = ({
const reloadPage = useReload();

const props: IResource = {
items: finalItems,
items: bItems,
onDelete: (item) => {
setShowDeleteDialog(item);
},
Expand Down
Loading

0 comments on commit 0e1e7bd

Please sign in to comment.