diff --git a/Dockerfile.webinar b/Dockerfile.webinar new file mode 100644 index 000000000..8a6028d55 --- /dev/null +++ b/Dockerfile.webinar @@ -0,0 +1,34 @@ +FROM node:20.8.1-alpine as base +RUN apk add g++ make py3-pip +RUN npm i -g pnpm +WORKDIR /app +COPY ./package.json ./package.json +COPY ./pnpm-lock.yaml ./pnpm-lock.yaml + +COPY ./src/generated/package.json ./src/generated/package.json +COPY ./src/generated/plugin/package.json ./src/generated/plugin/package.json + +RUN pnpm i + + +# design system +COPY ./src/design-system/ ./src/design-system/ +WORKDIR /app/src/design-system +RUN pnpm i -p +RUN pnpm local:release + +# webinar +WORKDIR /app +COPY ./src/apps/webinar ./src/apps/webinar +WORKDIR /app/src/apps/webinar +RUN pnpm i -p +RUN pnpm build + +FROM node:20.8.1-alpine +WORKDIR /app +COPY --from=base /app/src/apps/webinar/.next ./.next +COPY --from=base /app/src/apps/webinar/public ./public +COPY --from=base /app/src/apps/webinar/package.json ./package.json +COPY --from=base /app/src/apps/webinar/node_modules ./node_modules + +ENTRYPOINT npm run start diff --git a/Taskfile.yaml b/Taskfile.yaml index 560131781..53c5529f5 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -199,3 +199,23 @@ tasks: cmds: # - cd ./src/design-system && mkdir -p out && pnpm local:release - docker buildx build . -t {{.tag}} -f Dockerfile.website + + container-build-webinar: + preconditions: + - sh: '[[ -n "{{.tag}}" ]]' + msg: "var tag must have a value" + vars: + Image: ghcr.io/kloudlite/web/events:{{.tag}} + cmds: + # - docker buildx build . -t {{.Image}} -f Dockerfile.webinar + - docker build -t {{.Image}} -f Dockerfile.webinar . + + container-push-webinar: + preconditions: + - sh: '[[ -n "{{.tag}}" ]]' + msg: "var tag must have a value" + vars: + Image: ghcr.io/kloudlite/web/events:{{.tag}} + cmds: + # - docker buildx build -t {{.Image}} --platform linux/amd64 -f Dockerfile.webinar --push . + - docker buildx build . -t {{.Image}} --platform linux/amd64 -f Dockerfile.webinar --output=type=image,compression=zstd,force-compression=true,compression-level=12,push=true diff --git a/fake-data-generator/gen.ts b/fake-data-generator/gen.ts index 1dedbf824..26d271464 100644 --- a/fake-data-generator/gen.ts +++ b/fake-data-generator/gen.ts @@ -34,6 +34,8 @@ const types: string[] = [ 'ConsoleListGlobalVpnDevicesQuery', 'ConsoleListByokClustersQuery', 'ConsoleListAllClustersQuery', + 'ConsoleListRegistryImagesQuery', + 'ConsoleListImagePullSecretsQuery', ]; async function fake(files: string[], types: string[] = []) { diff --git a/gql-queries-generator/doc/queries.graphql b/gql-queries-generator/doc/queries.graphql index 3e53ff5b0..3a6e3e594 100644 --- a/gql-queries-generator/doc/queries.graphql +++ b/gql-queries-generator/doc/queries.graphql @@ -4464,6 +4464,57 @@ query consoleListImportedManagedResources($envName: String!, $search: SearchImpo } } +mutation consoleDeleteRegistryImage($image: String!) { + core_deleteRegistryImage(image: $image) +} + +query consoleGetRegistryImage($image: String!) { + core_getRegistryImage(image: $image) { + accountName + creationTime + id + imageName + imageTag + markedForDeletion + meta + recordVersion + updateTime + } +} + +query consoleGetRegistryImageUrl($image: String!, $meta: Map!) { + core_getRegistryImageURL(image: $image, meta: $meta) { + scriptUrl + url + } +} + +query consoleListRegistryImages($pq: CursorPaginationIn) { + core_listRegistryImages(pq: $pq) { + edges { + cursor + node { + accountName + creationTime + id + imageName + imageTag + markedForDeletion + meta + recordVersion + updateTime + } + } + pageInfo { + endCursor + hasNextPage + hasPrevPage + startCursor + } + totalCount + } +} + query iotconsoleAccountCheckNameAvailability($name: String!) { accounts_checkNameAvailability(name: $name) { result diff --git a/lib/types/common.ts b/lib/types/common.ts index 626caf76f..ca63a8046 100644 --- a/lib/types/common.ts +++ b/lib/types/common.ts @@ -2,7 +2,7 @@ import { ReactNode } from 'react'; export type NonNullableString = string & NonNullable; -export type MapType = { +export type MapType = { [key: string]: T | MapType; }; diff --git a/src/apps/auth/routes/_main+/oauth2.callback.$provider.tsx b/src/apps/auth/routes/_main+/oauth2.callback.$provider.tsx index 731a929cd..10baae536 100644 --- a/src/apps/auth/routes/_main+/oauth2.callback.$provider.tsx +++ b/src/apps/auth/routes/_main+/oauth2.callback.$provider.tsx @@ -1,7 +1,8 @@ -import { useLoaderData, useNavigate, useSearchParams } from '@remix-run/react'; +import { useLoaderData, useNavigate } from '@remix-run/react'; import { useAuthApi } from '~/auth/server/gql/api-provider'; import { BrandLogo } from '~/components/branding/brand-logo'; import { toast } from '~/components/molecule/toast'; +import { getCookie } from '~/root/lib/app-setup/cookies'; import useDebounce from '~/root/lib/client/hooks/use-debounce'; import getQueries from '~/root/lib/server/helpers/get-queries'; import { IRemixCtx } from '~/root/lib/types/common'; @@ -11,10 +12,9 @@ export const decodeState = (str: string) => Buffer.from(str, 'base64url').toString('utf8'); const CallBack = () => { - const { query, state, provider, setupAction } = useLoaderData(); + const { query, state, provider, setupAction, callbackUrl } = useLoaderData(); const api = useAuthApi(); const navigate = useNavigate(); - const [searchParams, _setSearchParams] = useSearchParams(); useDebounce( () => { @@ -70,14 +70,10 @@ const CallBack = () => { toast.error(errors[0].message); navigate('/'); } else { - toast.success('Login Successful'); - const callback = searchParams.get('callback'); - if (callback) { - const { - data: { email, name }, - } = await api.whoAmI({}); - const encodedData = btoa(`email=${email}&name=${name}`); - window.location.href = `${callback}?${encodedData}`; + toast.success('Login Successfull'); + if (callbackUrl) { + getCookie().remove('callback_url'); + window.location.href = callbackUrl; return; } navigate('/'); @@ -102,6 +98,8 @@ const CallBack = () => { export const loader = async (ctx: IRemixCtx) => { const { provider } = ctx.params; + const callbackUrl = getCookie(ctx).get('callback_url'); + const queries = getQueries(ctx); const { state, @@ -119,6 +117,7 @@ export const loader = async (ctx: IRemixCtx) => { query: queries, state: queryData?.state || state, provider, + callbackUrl, }; }; diff --git a/src/apps/auth/routes/_providers+/login.tsx b/src/apps/auth/routes/_providers+/login.tsx index aed8c8a23..957771c1e 100644 --- a/src/apps/auth/routes/_providers+/login.tsx +++ b/src/apps/auth/routes/_providers+/login.tsx @@ -6,12 +6,14 @@ import { GoogleLogo, } from '@jengaicons/react'; import { Link, useOutletContext, useSearchParams } from '@remix-run/react'; +import { useEffect } from 'react'; import { useAuthApi } from '~/auth/server/gql/api-provider'; import { Button } from '~/components/atoms/button'; import { PasswordInput, TextInput } from '~/components/atoms/input'; import { ArrowLeft, ArrowRight } from '~/components/icons'; import { toast } from '~/components/molecule/toast'; import { cn } from '~/components/utils'; +import { getCookie } from '~/root/lib/app-setup/cookies'; import { useReload } from '~/root/lib/client/helpers/reloader'; import useForm from '~/root/lib/client/hooks/use-form'; import Yup from '~/root/lib/server/helpers/yup'; @@ -50,11 +52,7 @@ const LoginWithEmail = () => { const callback = searchParams.get('callback'); if (callback) { - const { - data: { email, name }, - } = await api.whoAmI({}); - const encodedData = btoa(`email=${email}&name=${name}`); - window.location.href = `${callback}?userData=${encodedData}`; + window.location.href = callback; return; } reloadPage(); @@ -115,6 +113,19 @@ const Login = () => { const { githubLoginUrl, gitlabLoginUrl, googleLoginUrl } = useOutletContext(); const [searchParams, _setSearchParams] = useSearchParams(); + const callback = searchParams.get('callback'); + + const loginUrl = callback + ? `/login?mode=email&callback=${callback}` + : `/login?mode=email`; + + useEffect(() => { + if (callback) { + getCookie().set('callback_url', callback, { + expires: new Date(Date.now() + 1000 * 60), + }); + } + }, [callback]); return ( { variant="outline" content={Continue with email} prefix={} - to="/login/?mode=email" + // to="/login/?mode=email" + to={loginUrl} block linkComponent={Link} /> diff --git a/src/apps/console/components/icons.tsx b/src/apps/console/components/icons.tsx index 9cec1d0a5..ebabba279 100644 --- a/src/apps/console/components/icons.tsx +++ b/src/apps/console/components/icons.tsx @@ -137,4 +137,5 @@ export { StackSimple, Play, Pause, + Dockerlogo, } from '@jengaicons/react'; diff --git a/src/apps/console/page-components/app/compute.tsx b/src/apps/console/page-components/app/compute.tsx index 28d17aae4..b415a4256 100644 --- a/src/apps/console/page-components/app/compute.tsx +++ b/src/apps/console/page-components/app/compute.tsx @@ -1,23 +1,17 @@ +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'; +import { BottomNavigation } from '~/console/components/commons'; +import ExtendedFilledTab from '~/console/components/extended-filled-tab'; import { useAppState } from '~/console/page-components/app-states'; -import useForm, { dummyEvent } from '~/root/lib/client/hooks/use-form'; -import Yup from '~/root/lib/server/helpers/yup'; import { FadeIn, parseValue } from '~/console/page-components/util'; -import Select from '~/components/atoms/select'; -import ExtendedFilledTab from '~/console/components/extended-filled-tab'; -import { parseName, parseNodes } from '~/console/server/r-utils/common'; -import useCustomSwr from '~/lib/client/hooks/use-custom-swr'; -import { useConsoleApi } from '~/console/server/gql/api-provider'; -import { useMapper } from '~/components/utils'; -import { BottomNavigation } from '~/console/components/commons'; -import { useOutletContext } from '@remix-run/react'; -import { useEffect, useState } from 'react'; -import { Button } from '~/components/atoms/button'; -import { IEnvironmentContext } from '~/console/routes/_main+/$account+/env+/$environment+/_layout'; +import useForm, { dummyEvent } from '~/root/lib/client/hooks/use-form'; import { useUnsavedChanges } from '~/root/lib/client/hooks/use-unsaved-changes'; -import { plans } from './datas'; +import Yup from '~/root/lib/server/helpers/yup'; import appInitialFormValues, { mapFormValuesToApp } from './app-utils'; +import { plans } from './datas'; const valueRender = ({ label, @@ -50,25 +44,25 @@ const AppCompute = ({ mode = 'new' }: { mode: 'edit' | 'new' }) => { getReadOnlyContainer, getContainer, } = useAppState(); - const api = useConsoleApi(); - const { cluster } = useOutletContext(); + // const api = useConsoleApi(); + // const { cluster } = useOutletContext(); const [advancedOptions, setAdvancedOptions] = useState(false); const { performAction } = useUnsavedChanges(); - const { - data: nodepoolData, - isLoading: nodepoolLoading, - error: nodepoolLoadingError, - } = useCustomSwr('/nodepools', async () => { - return api.listNodePools({ - clusterName: parseName(cluster), - pagination: { - first: 100, - orderBy: 'updateTime', - sortDirection: 'DESC', - }, - }); - }); + // const { + // data: nodepoolData, + // isLoading: nodepoolLoading, + // error: nodepoolLoadingError, + // } = useCustomSwr('/nodepools', async () => { + // return api.listNodePools({ + // clusterName: parseName(cluster), + // pagination: { + // first: 100, + // orderBy: 'updateTime', + // sortDirection: 'DESC', + // }, + // }); + // }); const { values, errors, handleChange, isLoading, submit, resetValues } = useForm({ @@ -91,10 +85,10 @@ const AppCompute = ({ mode = 'new' }: { mode: 'edit' | 'new' }) => { }, }); - const nodepools = useMapper(parseNodes(nodepoolData), (val) => ({ - label: val.metadata?.name || '', - value: val.metadata?.name || '', - })); + // const nodepools = useMapper(parseNodes(nodepoolData), (val) => ({ + // label: val.metadata?.name || '', + // value: val.metadata?.name || '', + // })); /** ---- Only for edit mode in settings ----* */ useEffect(() => { @@ -275,7 +269,7 @@ const AppCompute = ({ mode = 'new' }: { mode: 'edit' | 'new' }) => { }} /> - {advancedOptions && ( + {/* {advancedOptions && ( imageList} + onChange={({ value }) => { + handleChange('imageUrl')(dummyEvent(value)); + }} + showclear + noOptionMessage={ +
+ Search for image or enter image name +
+ } + error={!!errors.imageUrl} + message={errors.imageUrl} + loading={imageLoaded} /> diff --git a/src/apps/console/routes/_main+/$account+/env+/$environment+/_layout.tsx b/src/apps/console/routes/_main+/$account+/env+/$environment+/_layout.tsx index f1f694714..d4261ebc0 100644 --- a/src/apps/console/routes/_main+/$account+/env+/$environment+/_layout.tsx +++ b/src/apps/console/routes/_main+/$account+/env+/$environment+/_layout.tsx @@ -15,7 +15,6 @@ import { GearSix, } from '~/console/components/icons'; import HandleScope from '~/console/page-components/handle-environment'; -import { ICluster } from '~/console/server/gql/queries/cluster-queries'; import { IEnvironment } from '~/console/server/gql/queries/environment-queries'; import { ILoginUrls, ILogins } from '~/console/server/gql/queries/git-queries'; import { GQLServerHandler } from '~/console/server/gql/saved-queries'; @@ -30,8 +29,13 @@ import { IAccountContext } from '../../_layout'; const Environment = () => { const rootContext = useOutletContext(); - const { environment, managedTemplates, loginUrls, logins, cluster } = - useLoaderData(); + const { + environment, + managedTemplates, + loginUrls, + logins, + // cluster + } = useLoaderData(); return ( @@ -42,7 +46,7 @@ const Environment = () => { managedTemplates, loginUrls, logins, - cluster, + // cluster, }} /> @@ -308,15 +312,15 @@ export const loader = async (ctx: IRemixCtx) => { throw errors[0]; } - const { data: cData, errors: cErrors } = await GQLServerHandler( - ctx.request - ).getCluster({ - name: data.clusterName, - }); + // const { data: cData, errors: cErrors } = await GQLServerHandler( + // ctx.request + // ).getCluster({ + // name: data.clusterName, + // }); - if (cErrors) { - throw cErrors[0]; - } + // if (cErrors) { + // throw cErrors[0]; + // } const { data: logins, errors: loginErrors } = await GQLServerHandler( ctx.request @@ -339,7 +343,7 @@ export const loader = async (ctx: IRemixCtx) => { loginUrls, logins, environment: envData, - cluster: cData, + // cluster: cData, }; } catch (err) { logger.error(err); @@ -347,7 +351,7 @@ export const loader = async (ctx: IRemixCtx) => { logins: ILogins; loginUrls: ILoginUrls; environment: IEnvironment; - cluster: ICluster; + // cluster: ICluster; }; } }; @@ -356,7 +360,7 @@ export interface IEnvironmentContext extends IAccountContext { logins: LoaderResult['logins']; loginUrls: LoaderResult['loginUrls']; environment: LoaderResult['environment']; - cluster: LoaderResult['cluster']; + // cluster: LoaderResult['cluster']; } export default Environment; diff --git a/src/apps/console/routes/_main+/$account+/env+/$environment+/apps/apps-resources-v2.tsx b/src/apps/console/routes/_main+/$account+/env+/$environment+/apps/apps-resources-v2.tsx index e75a9c675..2c9181662 100644 --- a/src/apps/console/routes/_main+/$account+/env+/$environment+/apps/apps-resources-v2.tsx +++ b/src/apps/console/routes/_main+/$account+/env+/$environment+/apps/apps-resources-v2.tsx @@ -1,5 +1,5 @@ import { Link, useOutletContext, useParams } from '@remix-run/react'; -import { useEffect, useState } from 'react'; +import { useState } from 'react'; import { Badge } from '~/components/atoms/badge'; import TooltipV2 from '~/components/atoms/tooltipV2'; import { toast } from '~/components/molecule/toast'; @@ -25,7 +25,6 @@ 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'; @@ -239,20 +238,19 @@ const GridView = ({ items = [], onAction: _ }: IResource) => { }; const ListView = ({ items = [], onAction }: IResource) => { - const { environment, account, cluster } = - useOutletContext(); + const { environment, account } = useOutletContext(); const { clusters } = useClusterStatusV2(); - const [clusterOnlineStatus, setClusterOnlineStatus] = useState< - Record - >({}); - useEffect(() => { - const states: Record = {}; - Object.entries(clusters).forEach(([key, value]) => { - states[key] = findClusterStatus(value); - }); - setClusterOnlineStatus(states); - }, [clusters]); + // const [clusterOnlineStatus, setClusterOnlineStatus] = useState< + // Record + // >({}); + // useEffect(() => { + // const states: Record = {}; + // Object.entries(clusters).forEach(([key, value]) => { + // states[key] = findClusterStatus(value); + // }); + // setClusterOnlineStatus(states); + // }, [clusters]); return ( { }, ], rows: items.map((i) => { - const isClusterOnline = clusterOnlineStatus[parseName(cluster)]; + // const isClusterOnline = clusterOnlineStatus[parseName(cluster)]; const { name, id, updateInfo } = parseItem(i); return { @@ -334,9 +332,9 @@ const ListView = ({ items = [], onAction }: IResource) => { return null; } - if (!isClusterOnline) { - return Cluster Offline; - } + // if (!isClusterOnline) { + // return Cluster Offline; + // } return ; }, @@ -399,10 +397,9 @@ const AppsResourcesV2 = ({ items = [] }: Omit) => { } // toast.success('app intercepted successfully'); toast.success( - `${ - intercept - ? 'App Intercepted successfully' - : 'App Intercept removed successfully' + `${intercept + ? 'App Intercepted successfully' + : 'App Intercept removed successfully' }` ); reload(); diff --git a/src/apps/console/routes/_main+/$account+/env+/$environment+/external-apps/external-app-resource.tsx b/src/apps/console/routes/_main+/$account+/env+/$environment+/external-apps/external-app-resource.tsx index 63e0b1e4b..6dd3f58ca 100644 --- a/src/apps/console/routes/_main+/$account+/env+/$environment+/external-apps/external-app-resource.tsx +++ b/src/apps/console/routes/_main+/$account+/env+/$environment+/external-apps/external-app-resource.tsx @@ -1,33 +1,33 @@ -import { GearSix, LinkBreak, Repeat } from '~/console/components/icons'; import { Link, useOutletContext, useParams } from '@remix-run/react'; +import { useState } from 'react'; +import { Badge } from '~/components/atoms/badge'; +import Tooltip from '~/components/atoms/tooltip'; +import { toast } from '~/components/molecule/toast'; import { generateKey, titleCase } from '~/components/utils'; +import { CopyContentToClipboard } from '~/console/components/common-console-components'; import { ListItem, ListTitle, } from '~/console/components/console-list-components'; import Grid from '~/console/components/grid'; +import { GearSix, LinkBreak, Repeat } from '~/console/components/icons'; import ListGridView from '~/console/components/list-grid-view'; +import ListV2 from '~/console/components/listV2'; import ResourceExtraAction, { IResourceExtraItem, } from '~/console/components/resource-extra-action'; +import { SyncStatusV2 } from '~/console/components/sync-status'; import { useConsoleApi } from '~/console/server/gql/api-provider'; import { ExtractNodeType, parseName, - parseName as pn, parseUpdateOrCreatedBy, parseUpdateOrCreatedOn, + parseName as pn, } from '~/console/server/r-utils/common'; -import { handleError } from '~/lib/utils/common'; -import { toast } from '~/components/molecule/toast'; import { useReload } from '~/lib/client/helpers/reloader'; -import { SyncStatusV2 } from '~/console/components/sync-status'; import { useWatchReload } from '~/lib/client/helpers/socket/useWatch'; -import ListV2 from '~/console/components/listV2'; -import { useState } from 'react'; -import { Badge } from '~/components/atoms/badge'; -import { CopyContentToClipboard } from '~/console/components/common-console-components'; -import Tooltip from '~/components/atoms/tooltip'; +import { handleError } from '~/lib/utils/common'; import { NN } from '~/root/lib/types/common'; // import HandleIntercept from './handle-intercept'; import { IExternalApps } from '~/console/server/gql/queries/external-app-queries'; @@ -236,8 +236,11 @@ const GridView = ({ items = [], onAction: _ }: IResource) => { }; const ListView = ({ items = [], onAction }: IResource) => { - const { environment, cluster, account } = - useOutletContext(); + const { + environment, + // cluster, + account, + } = useOutletContext(); return ( { ) : null, }, - service: { - render: () => ( - - ), - }, + // service: { + // render: () => ( + // + // ), + // }, status: { render: () => (
diff --git a/src/apps/console/routes/_main+/$account+/env+/$environment+/managed-resources/managed-resources-resource-v2.tsx b/src/apps/console/routes/_main+/$account+/env+/$environment+/managed-resources/managed-resources-resource-v2.tsx index 4c2bc2ed9..81bc56dac 100644 --- a/src/apps/console/routes/_main+/$account+/env+/$environment+/managed-resources/managed-resources-resource-v2.tsx +++ b/src/apps/console/routes/_main+/$account+/env+/$environment+/managed-resources/managed-resources-resource-v2.tsx @@ -1,5 +1,5 @@ -import { useOutletContext, useParams } from '@remix-run/react'; -import { useEffect, useState } from 'react'; +import { useParams } from '@remix-run/react'; +import { useState } from 'react'; import { Badge } from '~/components/atoms/badge'; import { toast } from '~/components/molecule/toast'; import { generateKey, titleCase } from '~/components/utils'; @@ -16,14 +16,12 @@ 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'; import { IMSvTemplates } from '~/console/server/gql/queries/managed-templates-queries'; import { ExtractNodeType, - parseName, parseUpdateOrCreatedBy, parseUpdateOrCreatedOn, } from '~/console/server/r-utils/common'; @@ -31,7 +29,6 @@ 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'; @@ -134,19 +131,19 @@ const GridView = ({ items = [], onAction, templates }: IResource) => { }; const ListView = ({ items = [], onAction, templates }: IResource) => { - const { cluster } = useOutletContext(); + // const { cluster } = useOutletContext(); const { clusters } = useClusterStatusV2(); - const [clusterOnlineStatus, setClusterOnlineStatus] = useState< - Record - >({}); - useEffect(() => { - const states: Record = {}; - Object.entries(clusters).forEach(([key, value]) => { - states[key] = findClusterStatus(value); - }); - setClusterOnlineStatus(states); - }, [clusters]); + // const [clusterOnlineStatus, setClusterOnlineStatus] = useState< + // Record + // >({}); + // useEffect(() => { + // const states: Record = {}; + // Object.entries(clusters).forEach(([key, value]) => { + // states[key] = findClusterStatus(value); + // }); + // setClusterOnlineStatus(states); + // }, [clusters]); return ( { ], rows: items.map((i) => { const { name, id, logo, updateInfo } = parseItem(i, templates); - const isClusterOnline = clusterOnlineStatus[parseName(cluster)]; + // const isClusterOnline = clusterOnlineStatus[parseName(cluster)]; return { columns: { @@ -230,9 +227,9 @@ const ListView = ({ items = [], onAction, templates }: IResource) => { }, status: { render: () => { - if (!isClusterOnline) { - return Cluster Offline; - } + // if (!isClusterOnline) { + // return Cluster Offline; + // } if (i.syncStatus?.state === 'UPDATED_AT_AGENT') { return Ready; diff --git a/src/apps/console/routes/_main+/$account+/env+/$environment+/new-app/app-compute.tsx b/src/apps/console/routes/_main+/$account+/env+/$environment+/new-app/app-compute.tsx index 271c04c96..a740c78dd 100644 --- a/src/apps/console/routes/_main+/$account+/env+/$environment+/new-app/app-compute.tsx +++ b/src/apps/console/routes/_main+/$account+/env+/$environment+/new-app/app-compute.tsx @@ -1,22 +1,17 @@ -import { useOutletContext } from '@remix-run/react'; import { useState } from 'react'; import { Button } from '~/components/atoms/button'; import { Checkbox } from '~/components/atoms/checkbox'; import { NumberInput } from '~/components/atoms/input'; import Select from '~/components/atoms/select'; import Slider from '~/components/atoms/slider'; -import { useMapper } from '~/components/utils'; import { BottomNavigation } from '~/console/components/commons'; import ExtendedFilledTab from '~/console/components/extended-filled-tab'; import { useAppState } from '~/console/page-components/app-states'; import { FadeIn, parseValue } from '~/console/page-components/util'; import { useConsoleApi } from '~/console/server/gql/api-provider'; -import { parseName, parseNodes } from '~/console/server/r-utils/common'; -import useCustomSwr from '~/lib/client/hooks/use-custom-swr'; import { useLog } from '~/lib/client/hooks/use-log'; import useForm, { dummyEvent } from '~/root/lib/client/hooks/use-form'; import Yup from '~/root/lib/server/helpers/yup'; -import { IEnvironmentContext } from '../_layout'; import appInitialFormValues, { mapFormValuesToApp } from './app-utils'; import { plans } from './datas'; @@ -45,23 +40,23 @@ const AppCompute = () => { const { app, setApp, setPage, markPageAsCompleted, getContainer } = useAppState(); const api = useConsoleApi(); - const { cluster } = useOutletContext(); + // const { cluster } = useOutletContext(); const [advancedOptions, setAdvancedOptions] = useState(false); - const { - data: nodepoolData, - isLoading: nodepoolLoading, - error: nodepoolLoadingError, - } = useCustomSwr('/nodepools', async () => { - return api.listNodePools({ - clusterName: parseName(cluster), - pagination: { - first: 100, - orderBy: 'updateTime', - sortDirection: 'DESC', - }, - }); - }); + // const { + // data: nodepoolData, + // isLoading: nodepoolLoading, + // error: nodepoolLoadingError, + // } = useCustomSwr('/nodepools', async () => { + // return api.listNodePools({ + // clusterName: parseName(cluster), + // pagination: { + // first: 100, + // orderBy: 'updateTime', + // sortDirection: 'DESC', + // }, + // }); + // }); const { values, errors, handleChange, isLoading, submit } = useForm({ initialValues: appInitialFormValues({ @@ -83,10 +78,10 @@ const AppCompute = () => { }, }); - const nodepools = useMapper(parseNodes(nodepoolData), (val) => ({ - label: val.metadata?.name || '', - value: val.metadata?.name || '', - })); + // const nodepools = useMapper(parseNodes(nodepoolData), (val) => ({ + // label: val.metadata?.name || '', + // value: val.metadata?.name || '', + // })); useLog(values.selectionMode); @@ -253,7 +248,7 @@ const AppCompute = () => { }} /> - {advancedOptions && ( + {/* {advancedOptions && ( imageList} + onChange={({ value }) => { + handleChange('imageUrl')(dummyEvent(value)); + }} + showclear + noOptionMessage={ +
+ Search for image or enter image name +
+ } + error={!!errors.imageUrl} + message={errors.imageUrl} + loading={imageLoaded} + createLabel="Select" /> {/* {values.imageMode === 'default' && ( diff --git a/src/apps/console/routes/_main+/$account+/env+/$environment+/routers/handle-router.tsx b/src/apps/console/routes/_main+/$account+/env+/$environment+/routers/handle-router.tsx index 67383f81e..49a5004ee 100644 --- a/src/apps/console/routes/_main+/$account+/env+/$environment+/routers/handle-router.tsx +++ b/src/apps/console/routes/_main+/$account+/env+/$environment+/routers/handle-router.tsx @@ -1,28 +1,27 @@ /* eslint-disable react/destructuring-assignment */ -import { useOutletContext, useParams } from '@remix-run/react'; +import { useParams } from '@remix-run/react'; import { useEffect, useRef } from 'react'; +import { Checkbox } from '~/components/atoms/checkbox'; +import Select from '~/components/atoms/select'; +import Banner from '~/components/molecule/banner'; import Popup from '~/components/molecule/popup'; import { toast } from '~/components/molecule/toast'; +import { useAppend, useMapper } from '~/components/utils'; +import CommonPopupHandle from '~/console/components/common-popup-handle'; +import { NameIdView } from '~/console/components/name-id-view'; +import { IDialogBase } from '~/console/components/types.d'; +import { useConsoleApi } from '~/console/server/gql/api-provider'; +import { IRouters } from '~/console/server/gql/queries/router-queries'; import { ExtractNodeType, parseName, parseNodes, } from '~/console/server/r-utils/common'; import { useReload } from '~/lib/client/helpers/reloader'; +import useCustomSwr from '~/lib/client/hooks/use-custom-swr'; import useForm, { dummyEvent } from '~/lib/client/hooks/use-form'; import Yup from '~/lib/server/helpers/yup'; import { handleError } from '~/lib/utils/common'; -import CommonPopupHandle from '~/console/components/common-popup-handle'; -import { IDialogBase } from '~/console/components/types.d'; -import { IRouters } from '~/console/server/gql/queries/router-queries'; -import { useConsoleApi } from '~/console/server/gql/api-provider'; -import { NameIdView } from '~/console/components/name-id-view'; -import Select from '~/components/atoms/select'; -import useCustomSwr from '~/lib/client/hooks/use-custom-swr'; -import { useAppend, useMapper } from '~/components/utils'; -import { Checkbox } from '~/components/atoms/checkbox'; -import Banner from '~/components/molecule/banner'; -import { IAppContext } from '../app+/$app+/_layout'; type IDialog = IDialogBase>; @@ -33,7 +32,7 @@ const Root = (props: IDialog) => { const { environment: envName } = useParams(); - const { cluster } = useOutletContext(); + // const { cluster } = useOutletContext(); const { data, @@ -44,7 +43,8 @@ const Root = (props: IDialog) => { search: { clusterName: { matchType: 'exact', - exact: parseName(cluster), + // exact: parseName(cluster), + exact: 'localhost', }, }, }); @@ -54,19 +54,19 @@ const Root = (props: IDialog) => { useForm({ initialValues: isUpdate ? { - name: parseName(props.data), - displayName: props.data.displayName, - domains: [], - isNameError: false, - isTlsEnabled: props.data.spec.https?.enabled || false, - } + name: parseName(props.data), + displayName: props.data.displayName, + domains: [], + isNameError: false, + isTlsEnabled: props.data.spec.https?.enabled || false, + } : { - name: '', - displayName: '', - domains: [], - isNameError: false, - isTlsEnabled: false, - }, + name: '', + displayName: '', + domains: [], + isNameError: false, + isTlsEnabled: false, + }, validationSchema: Yup.object({ displayName: Yup.string().required(), name: Yup.string().required(), @@ -83,7 +83,7 @@ const Root = (props: IDialog) => { if (!isUpdate) { const { errors: e } = await api.createRouter({ envName, - + router: { displayName: val.displayName, metadata: { @@ -104,7 +104,7 @@ const Root = (props: IDialog) => { } else { const { errors: e } = await api.updateRouter({ envName, - + router: { displayName: val.displayName, metadata: { @@ -142,8 +142,8 @@ const Root = (props: IDialog) => { domains, isUpdate ? props.data.spec.domains - .filter((d) => !domains.find((f) => f.value === d)) - .map((d) => ({ label: d, value: d })) + .filter((d) => !domains.find((f) => f.value === d)) + .map((d) => ({ label: d, value: d })) : [] ); @@ -216,7 +216,8 @@ const Root = (props: IDialog) => { All the domain CNames should be pointed to following Cluster DNS Name{' '} - `{cluster.spec.publicDNSHost}` + {/* `{cluster.spec.publicDNSHost}` */} + "localhost" } diff --git a/src/apps/console/routes/_main+/$account+/new-managed-service/_index.tsx b/src/apps/console/routes/_main+/$account+/new-managed-service/_index.tsx index 951ff1f3d..332822ff1 100644 --- a/src/apps/console/routes/_main+/$account+/new-managed-service/_index.tsx +++ b/src/apps/console/routes/_main+/$account+/new-managed-service/_index.tsx @@ -75,8 +75,7 @@ const RenderField = ({ onChange={({ target }) => { onChange(`res.${field.name}`)( dummyEvent( - `${parseFloat(target.value) * (field.multiplier || 1)}${ - field.unit + `${parseFloat(target.value) * (field.multiplier || 1)}${field.unit }` ) ); @@ -102,9 +101,8 @@ const RenderField = ({ if (field.inputType === 'Resource') { return (
-
{`${field.label}${ - field.required ? ' *' : '' - }`}
+
{`${field.label}${field.required ? ' *' : '' + }`}
@@ -117,16 +115,14 @@ const RenderField = ({ onChange={({ target }) => { onChange(`res.${field.name}.min`)( dummyEvent( - `${parseFloat(target.value) * (field.multiplier || 1)}${ - field.unit + `${parseFloat(target.value) * (field.multiplier || 1)}${field.unit }` ) ); if (qos) { onChange(`res.${field.name}.max`)( dummyEvent( - `${parseFloat(target.value) * (field.multiplier || 1)}${ - field.unit + `${parseFloat(target.value) * (field.multiplier || 1)}${field.unit }` ) ); @@ -146,8 +142,7 @@ const RenderField = ({ onChange={({ target }) => { onChange(`res.${field.name}.max`)( dummyEvent( - `${parseFloat(target.value) * (field.multiplier || 1)}${ - field.unit + `${parseFloat(target.value) * (field.multiplier || 1)}${field.unit }` ) ); @@ -321,7 +316,7 @@ const FieldView = ({ showclear error={!!errors.clusterName} message={errors.clusterName} - // loading={cIsLoading || byokCIsLoading} + // loading={cIsLoading || byokCIsLoading} /> {/*