Skip to content

Commit

Permalink
Merge pull request #307 from kloudlite/console/changes
Browse files Browse the repository at this point in the history
WEB: Add templated while account creation and fixes minor ui changes
  • Loading branch information
nxtCoder19 authored Oct 2, 2024
2 parents 39f3637 + 064a121 commit b9d4260
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 14 deletions.
10 changes: 6 additions & 4 deletions web/src/apps/console/routes/_a+/new-team.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import MultiStepProgress, {
import MultiStepProgressWrapper from '~/console/components/multi-step-progress-wrapper';
import { NameIdView } from '~/console/components/name-id-view';
import { useConsoleApi } from '~/console/server/gql/api-provider';
import { ensureAccountClientSide } from '~/console/server/utils/auth-utils';
import { useExternalRedirect } from '~/root/lib/client/helpers/use-redirect';
import { useDataFromMatches } from '~/root/lib/client/hooks/use-custom-matches';
import useCustomSwr from '~/root/lib/client/hooks/use-custom-swr';
Expand Down Expand Up @@ -74,10 +75,11 @@ const NewAccount = () => {
if (_errors) {
throw _errors[0];
}
// const { errors: e } = await api.setupDefaultEnvironment({});
// if (e) {
// throw e[0];
// }
ensureAccountClientSide({ account: v.name });
const { errors: e } = await api.setupDefaultEnvironment({});
if (e) {
throw e[0];
}
toast.success('account created');
// navigate(`/onboarding/${v.name}/attach-new-cluster`);
navigate(`/${v.name}/environments`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import ResourceExtraAction, {
IResourceExtraItem,
} from '~/console/components/resource-extra-action';
import { SyncStatusV2 } from '~/console/components/sync-status';
import { findClusterStatus } from '~/console/hooks/use-cluster-status';
import { useClusterStatusV2 } from '~/console/hooks/use-cluster-status-v2';
import { useConsoleApi } from '~/console/server/gql/api-provider';
import { IApps } from '~/console/server/gql/queries/app-queries';
Expand Down Expand Up @@ -304,7 +305,9 @@ const ListView = ({ items = [], onAction }: IResource) => {
},
],
rows: items.map((i) => {
// const isClusterOnline = clusterOnlineStatus[parseName(cluster)];
const isClusterOnline = findClusterStatus(
clusters[environment.clusterName]
);

const { name, id, updateInfo } = parseItem(i);
return {
Expand Down Expand Up @@ -332,9 +335,13 @@ const ListView = ({ items = [], onAction }: IResource) => {
return null;
}

// if (!isClusterOnline) {
// return <Badge type="warning">Cluster Offline</Badge>;
// }
if (environment.clusterName === '') {
return <ListItemV2 className="px-4xl" data="-" />;
}

if (!isClusterOnline) {
return <Badge type="warning">Cluster Offline</Badge>;
}

return <SyncStatusV2 item={i} />;
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useParams } from '@remix-run/react';
import { useOutletContext, useParams } from '@remix-run/react';
import { useState } from 'react';
import { Badge } from '~/components/atoms/badge';
import { toast } from '~/components/molecule/toast';
Expand All @@ -16,6 +16,7 @@ import { LockSimple, Trash } from '~/console/components/icons';
import ListGridView from '~/console/components/list-grid-view';
import ListV2 from '~/console/components/listV2';
import ResourceExtraAction from '~/console/components/resource-extra-action';
import { findClusterStatus } from '~/console/hooks/use-cluster-status';
import { useClusterStatusV2 } from '~/console/hooks/use-cluster-status-v2';
import { useConsoleApi } from '~/console/server/gql/api-provider';
import { IImportedManagedResources } from '~/console/server/gql/queries/imported-managed-resource-queries';
Expand All @@ -29,6 +30,7 @@ import { getManagedTemplateLogo } from '~/console/utils/commons';
import { useReload } from '~/lib/client/helpers/reloader';
import { useWatchReload } from '~/lib/client/helpers/socket/useWatch';
import { handleError } from '~/lib/utils/common';
import { IEnvironmentContext } from '../_layout';
import { ViewSecret } from './handle-managed-resource-v2';

const RESOURCE_NAME = 'managed resource';
Expand Down Expand Up @@ -131,7 +133,7 @@ const GridView = ({ items = [], onAction, templates }: IResource) => {
};

const ListView = ({ items = [], onAction, templates }: IResource) => {
// const { cluster } = useOutletContext<IEnvironmentContext>();
const { environment } = useOutletContext<IEnvironmentContext>();
const { clusters } = useClusterStatusV2();

// const [clusterOnlineStatus, setClusterOnlineStatus] = useState<
Expand Down Expand Up @@ -193,6 +195,9 @@ const ListView = ({ items = [], onAction, templates }: IResource) => {
rows: items.map((i) => {
const { name, id, logo, updateInfo } = parseItem(i, templates);
// const isClusterOnline = clusterOnlineStatus[parseName(cluster)];
const isClusterOnline = findClusterStatus(
clusters[environment.clusterName]
);

return {
columns: {
Expand Down Expand Up @@ -227,9 +232,13 @@ const ListView = ({ items = [], onAction, templates }: IResource) => {
},
status: {
render: () => {
// if (!isClusterOnline) {
// return <Badge type="warning">Cluster Offline</Badge>;
// }
if (environment.clusterName === '') {
return <ListItemV2 className="px-4xl" data="-" />;
}

if (!isClusterOnline) {
return <Badge type="warning">Cluster Offline</Badge>;
}

if (i.syncStatus?.state === 'UPDATED_AT_AGENT') {
return <Badge type="info">Ready</Badge>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ const ListView = ({ items, onAction }: IResource) => {
avatar={
i.clusterName === '' ? (
// <TemplateAvatar />
<TemplateAvatar name="{.}" color="text-white" />
<TemplateAvatar name="{ }" color="white" />
) : (
<ConsoleAvatar name={id} />
)
Expand Down

0 comments on commit b9d4260

Please sign in to comment.