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

WEB: Add sm variant for chip #309

Merged
merged 3 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM node:20.8.1-alpine as remix
FROM node:20.8.1-alpine AS remix
WORKDIR /app
COPY ./package-production.json ./package.json
RUN npm i --frozen-lockfile

FROM node:20.8.1-alpine as install
FROM node:20.8.1-alpine AS install
RUN npm i -g pnpm
WORKDIR /app
COPY ./package.json ./package.json
Expand All @@ -19,7 +19,7 @@ COPY ./src/generated/plugin/package.json ./src/generated/plugin/pnpm-lock.yaml

RUN pnpm i -p --frozen-lockfile

FROM node:20.8.1-alpine as build
FROM node:20.8.1-alpine AS build
RUN npm i -g pnpm
WORKDIR /app
ARG APP
Expand Down
20 changes: 12 additions & 8 deletions src/apps/console/components/alert-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export interface IAlertModal {
title: ReactNode;
okText?: string;
okDisabled?: boolean;
showOkButton?: boolean;
cancelText?: string;
variant?: ButtonVariants;
footer?: boolean;
Expand All @@ -28,6 +29,7 @@ const AlertModal = ({
title,
okDisabled = false,
okText = 'Delete',
showOkButton = true,
cancelText = 'Cancel',
variant = 'critical',
}: IAlertModal) => {
Expand Down Expand Up @@ -55,14 +57,16 @@ const AlertModal = ({
{footer && (
<AlertDialog.Footer>
<AlertDialog.Button variant="basic" content={cancelText} closable />
<AlertDialog.Button
type="submit"
disabled={okDisabled}
variant={variant}
content={okText}
closable={false}
loading={isLoading}
/>
{showOkButton && (
<AlertDialog.Button
type="submit"
disabled={okDisabled}
variant={variant}
content={okText}
closable={false}
loading={isLoading}
/>
)}
</AlertDialog.Footer>
)}
</form>
Expand Down
109 changes: 0 additions & 109 deletions src/apps/console/hooks/use-cluster-status-depricated.tsx

This file was deleted.

31 changes: 11 additions & 20 deletions src/apps/console/hooks/use-cluster-status-v3.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useOutletContext, useParams } from '@remix-run/react';
import {
createContext,
useCallback,
Expand All @@ -7,12 +8,10 @@ import {
useState,
} from 'react';
import { ChildrenProps } from '~/components/types';
import useDebounce from '~/root/lib/client/hooks/use-debounce';
import { useSocketWatch } from '~/root/lib/client/helpers/socket/useWatch';
import { useOutletContext, useParams } from '@remix-run/react';
import { useConsoleApi } from '../server/gql/api-provider';
import { parseName, parseNodes } from '../server/r-utils/common';
import useDebounce from '~/root/lib/client/hooks/use-debounce';
import { IAccountContext } from '../routes/_main+/$account+/_layout';
import { useConsoleApi } from '../server/gql/api-provider';

const ctx = createContext<{
// clusters: {
Expand Down Expand Up @@ -43,7 +42,6 @@ const ClusterStatusProvider = ({
}>({});

const addToWatchList = (clusterNames: string[]) => {
console.log('nayak', clusterNames);
setWatchList((s) => {
const resp = clusterNames.reduce((acc, curr) => {
if (!curr) {
Expand All @@ -69,7 +67,7 @@ const ClusterStatusProvider = ({

(async () => {
try {
const { data: clusters } = await api.listClusterStatus({
const { data: clustersStatus } = await api.listClusterStatus({
pagination: {
first: 100,
},
Expand All @@ -85,17 +83,10 @@ const ClusterStatusProvider = ({
},
});

const parsedNodes = parseNodes(clusters);

const lastOnlineAt = parsedNodes.reduce((acc, curr) => {
acc[parseName(curr)] = curr.lastOnlineAt;
return acc;
}, {} as { [key: string]: string });

setClustersMap((s) => {
return {
...s,
...lastOnlineAt,
...clustersStatus,
};
});
} catch (e) {
Expand Down Expand Up @@ -172,7 +163,7 @@ export const useClusterStatusV3 = ({
clusterNames?: string[];
}) => {
const { clustersMap } = useOutletContext<IAccountContext>();
const { addToWatchList, removeFromWatchList } = useContext(ctx);
const { addToWatchList, removeFromWatchList: _ } = useContext(ctx);
useDebounce(
() => {
if (!clusterName && !clusterNames) {
Expand All @@ -186,11 +177,11 @@ export const useClusterStatusV3 = ({
}

return () => {
if (clusterName) {
removeFromWatchList([clusterName]);
} else if (clusterNames) {
removeFromWatchList(clusterNames);
}
// if (clusterName) {
// removeFromWatchList([clusterName]);
// } else if (clusterNames) {
// removeFromWatchList(clusterNames);
// }
};
},
100,
Expand Down
5 changes: 2 additions & 3 deletions src/apps/console/page-components/app/compute.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useEffect, useState } from 'react';
import { Button } from '~/components/atoms/button';
import { NumberInput } from '~/components/atoms/input';
import Select from '~/components/atoms/select';
import Slider from '~/components/atoms/slider';
Expand Down Expand Up @@ -257,7 +256,7 @@ const AppCompute = ({ mode = 'new' }: { mode: 'edit' | 'new' }) => {
)}

<div className="flex flex-col gap-3xl pt-3xl">
<Button
{/* <Button
size="sm"
content={
<span className="truncate text-left">Advanced options</span>
Expand All @@ -267,7 +266,7 @@ const AppCompute = ({ mode = 'new' }: { mode: 'edit' | 'new' }) => {
onClick={() => {
setAdvancedOptions(!advancedOptions);
}}
/>
/> */}

{/* {advancedOptions && (
<Select
Expand Down
23 changes: 12 additions & 11 deletions src/apps/console/page-components/app/general.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -261,17 +261,18 @@ const AppGeneral = ({ mode = 'new' }: { mode: 'edit' | 'new' }) => {
}, [readOnlyApp]);

useEffect(() => {
if (
values.imagePullPolicy !==
readOnlyApp.spec.containers[activeContIndex].imagePullPolicy
) {
setContainer((s) => {
return {
...s,
imagePullPolicy: values.imagePullPolicy,
};
});
}
console.log('values', values.imagePullPolicy);
// if (
// values.imagePullPolicy !==
// readOnlyApp.spec.containers[activeContIndex].imagePullPolicy
// ) {
setContainer((s) => {
return {
...s,
imagePullPolicy: values.imagePullPolicy,
};
});
// }
}, [values.imagePullPolicy]);

return (
Expand Down
12 changes: 6 additions & 6 deletions src/apps/console/page-components/secret-resource-v2.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { Trash } from '~/console/components/icons';
import { useParams } from '@remix-run/react';
import { useState } from 'react';
import { toast } from '~/components/molecule/toast';
import { generateKey, titleCase } from '~/components/utils';
import { Trash } from '~/console/components/icons';
import {
ExtractNodeType,
parseName,
parseUpdateOrCreatedBy,
parseUpdateOrCreatedOn,
} from '~/console/server/r-utils/common';
import { useWatchReload } from '~/lib/client/helpers/socket/useWatch';
import { useReload } from '~/root/lib/client/helpers/reloader';
import { handleError } from '~/root/lib/utils/common';
import { useWatchReload } from '~/lib/client/helpers/socket/useWatch';
import {
ListBody,
ListItem,
Expand All @@ -23,10 +23,10 @@ import {
import DeleteDialog from '../components/delete-dialog';
import Grid from '../components/grid';
import ListGridView from '../components/list-grid-view';
import ListV2 from '../components/listV2';
import ResourceExtraAction from '../components/resource-extra-action';
import { useConsoleApi } from '../server/gql/api-provider';
import { ISecrets } from '../server/gql/queries/secret-queries';
import ListV2 from '../components/listV2';

const RESOURCE_NAME = 'secret';
type BaseType = ExtractNodeType<ISecrets>;
Expand Down Expand Up @@ -233,7 +233,7 @@ const SecretResourcesV2 = ({
linkComponent = null,
}: Omit<IResource, 'onDelete'>) => {
const [showDeleteDialog, setShowDeleteDialog] = useState<BaseType | null>(
null,
null
);

const api = useConsoleApi();
Expand All @@ -245,9 +245,9 @@ const SecretResourcesV2 = ({
useWatchReload(
items.map((i) => {
return `account:${account}.environment:${environment}.secret:${parseName(
i,
i
)}`;
}),
})
);

const props: IResource = {
Expand Down
12 changes: 6 additions & 6 deletions src/apps/console/routes/_a+/new-team.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const NewAccount = () => {
<form onSubmit={handleSubmit}>
<MultiStepProgressWrapper
fillerImage={<FillerCreateTeam />}
title="Setup your account!"
title="Setup your team!"
action={
accountsData?.length === 0 && (
<Button
Expand All @@ -118,11 +118,11 @@ const NewAccount = () => {
{...(accountsData?.length === 0
? {}
: {
backButton: {
content: 'Back to teams',
to: `/teams`,
},
})}
backButton: {
content: 'Back to teams',
to: `/teams`,
},
})}
>
<MultiStepProgress.Root
hasPages={false}
Expand Down
Loading
Loading