From fe34e217d83ab1e8c45d1096c48357af6c8e7b86 Mon Sep 17 00:00:00 2001 From: Piyush Kumar Date: Tue, 8 Oct 2024 10:55:12 +0530 Subject: [PATCH 1/5] testing app settings --- lib/client/hooks/use-unsaved-changes.tsx | 7 +++- src/apps/console/hooks/use-is-owner.tsx | 35 +++++++++++++++++++ .../new-app/app-environment-variables.tsx | 34 ++++++++++++++++-- src/design-system/components/atoms/tabs.tsx | 12 +++---- 4 files changed, 78 insertions(+), 10 deletions(-) create mode 100644 src/apps/console/hooks/use-is-owner.tsx diff --git a/lib/client/hooks/use-unsaved-changes.tsx b/lib/client/hooks/use-unsaved-changes.tsx index 78723f7e7..bd60eb887 100644 --- a/lib/client/hooks/use-unsaved-changes.tsx +++ b/lib/client/hooks/use-unsaved-changes.tsx @@ -13,8 +13,8 @@ import { useMemo, useState, } from 'react'; -import { ChildrenProps } from '~/components/types'; import Popup from '~/components/molecule/popup'; +import { ChildrenProps } from '~/components/types'; import { useReload } from '../helpers/reloader'; const UnsavedChanges = createContext<{ @@ -28,6 +28,7 @@ const UnsavedChanges = createContext<{ performAction: string; setPerformAction: (action: string) => void; loading: boolean; + onProceed?: () => void; }>({ hasChanges: false, setHasChanges() {}, @@ -39,6 +40,7 @@ const UnsavedChanges = createContext<{ performAction: '', setPerformAction() {}, loading: false, + onProceed() {}, }); export const UnsavedChangesProvider = ({ children }: ChildrenProps) => { @@ -49,6 +51,7 @@ export const UnsavedChangesProvider = ({ children }: ChildrenProps) => { const location = useLocation(); const { state, proceed, reset } = unstable_useBlocker(({ nextLocation }) => { if (hasChanges && !ignorePaths.includes(nextLocation.pathname)) { + console.log('hasChanges', hasChanges); return true; } return false; @@ -146,6 +149,8 @@ export const UnsavedChangesProvider = ({ children }: ChildrenProps) => { ); }; + export const useUnsavedChanges = () => { + // const return useContext(UnsavedChanges); }; diff --git a/src/apps/console/hooks/use-is-owner.tsx b/src/apps/console/hooks/use-is-owner.tsx new file mode 100644 index 000000000..936cd2c9d --- /dev/null +++ b/src/apps/console/hooks/use-is-owner.tsx @@ -0,0 +1,35 @@ +import { useCallback } from 'react'; +import useCustomSwr from '~/root/lib/client/hooks/use-custom-swr'; +import { useConsoleApi } from '../server/gql/api-provider'; + +export const useIsOwner = ({ accountName }: { accountName: string }) => { + const api = useConsoleApi(); + const { data: teamMembers, isLoading: teamMembersLoading } = useCustomSwr( + `${accountName}-owners`, + async () => { + return api.listMembershipsForAccount({ + accountName, + }); + } + ); + + const { data: currentUser, isLoading: currentUserLoading } = useCustomSwr( + 'current-user', + async () => { + return api.whoAmI(); + } + ); + + const isOwner = useCallback(() => { + if (!teamMembers || !currentUser) return false; + + const owner = teamMembers.find((member) => member.role === 'account_owner'); + + return owner?.user?.email === currentUser?.email; + }, [teamMembers, currentUser]); + + return { + isOwner: isOwner(), + isLoading: teamMembersLoading || currentUserLoading, + }; +}; diff --git a/src/apps/console/routes/_main+/$account+/env+/$environment+/new-app/app-environment-variables.tsx b/src/apps/console/routes/_main+/$account+/env+/$environment+/new-app/app-environment-variables.tsx index f1dcbd587..47aa179d3 100644 --- a/src/apps/console/routes/_main+/$account+/env+/$environment+/new-app/app-environment-variables.tsx +++ b/src/apps/console/routes/_main+/$account+/env+/$environment+/new-app/app-environment-variables.tsx @@ -21,6 +21,7 @@ import NoResultsFound from '~/console/components/no-results-found'; import { IShowDialog } from '~/console/components/types.d'; import { useAppState } from '~/console/page-components/app-states'; import useForm from '~/root/lib/client/hooks/use-form'; +import { useUnsavedChanges } from '~/root/lib/client/hooks/use-unsaved-changes'; import Yup from '~/root/lib/server/helpers/yup'; import { NonNullableString } from '~/root/lib/types/common'; import AppDialog from './app-dialogs'; @@ -205,9 +206,11 @@ const EnvironmentVariablesList = ({ }; export const EnvironmentVariables = () => { - const { setContainer, getContainer } = useAppState(); + const { setContainer, getContainer, getReadOnlyContainer, readOnlyApp } = + useAppState(); const [showCSDialog, setShowCSDialog] = useState(null); + const { performAction } = useUnsavedChanges(); const entry = Yup.object({ type: Yup.string().oneOf(['config', 'secret']).notRequired(), @@ -231,8 +234,13 @@ export const EnvironmentVariables = () => { .notRequired(), }); - const { values, setValues, submit } = useForm({ - initialValues: getContainer().env, + const { + values, + setValues, + submit, + resetValues: reset, + } = useForm({ + initialValues: getReadOnlyContainer().env || [], validationSchema: Yup.array(entry), onSubmit: (val) => { setContainer((c) => ({ @@ -334,6 +342,26 @@ export const EnvironmentVariables = () => { }, }); + useEffect(() => { + if (performAction === 'discard-changes') { + console.log('discard-changes'); + // if (app.ciBuildId) { + // setIsEdited(false); + // } + reset(); + // @ts-ignore + // setBuildData(readOnlyApp?.build); + } + + // else if (performAction === 'init') { + // setIsEdited(false); + // } + }, [performAction]); + + useEffect(() => { + reset(); + }, [readOnlyApp]); + return ( <>
{variant === 'plain' &&
} @@ -139,7 +139,7 @@ const TabBase = ({ )} @@ -183,7 +183,7 @@ const Root = forwardRef>( children, toLabel, }, - ref, + ref ) => { const id = useId(); // id = useMemo(() => id, [children, value, basePath, size, variant]); @@ -198,7 +198,7 @@ const Root = forwardRef>( 'md:gap-4xl': size === 'md' && variant !== 'filled', 'gap-lg': size === 'sm' || variant === 'filled', }, - className, + className )} ref={ref} asChild @@ -239,7 +239,7 @@ const Root = forwardRef>( ); - }, + } ); const Tabs = { From 89f98a34333c7d89480518788b11a0fb3d6621b0 Mon Sep 17 00:00:00 2001 From: Bikash Date: Tue, 8 Oct 2024 11:44:22 +0545 Subject: [PATCH 2/5] updated discard-changes function --- lib/client/hooks/use-unsaved-changes.tsx | 30 +++++++++++++------ .../console/page-components/app/compute.tsx | 11 ++++--- .../console/page-components/app/general.tsx | 15 ++++++---- .../app+/$app+/settings+/_layout.tsx | 23 ++++++++------ .../new-app/app-environment-variables.tsx | 8 +++-- .../app+/$app+/settings+/_layout.tsx | 9 +++--- 6 files changed, 61 insertions(+), 35 deletions(-) diff --git a/lib/client/hooks/use-unsaved-changes.tsx b/lib/client/hooks/use-unsaved-changes.tsx index bd60eb887..a5019f19d 100644 --- a/lib/client/hooks/use-unsaved-changes.tsx +++ b/lib/client/hooks/use-unsaved-changes.tsx @@ -6,6 +6,7 @@ import { useRevalidator, } from '@remix-run/react'; import { + ReactNode, createContext, useCallback, useContext, @@ -14,7 +15,6 @@ import { useState, } from 'react'; import Popup from '~/components/molecule/popup'; -import { ChildrenProps } from '~/components/types'; import { useReload } from '../helpers/reloader'; const UnsavedChanges = createContext<{ @@ -28,7 +28,6 @@ const UnsavedChanges = createContext<{ performAction: string; setPerformAction: (action: string) => void; loading: boolean; - onProceed?: () => void; }>({ hasChanges: false, setHasChanges() {}, @@ -40,10 +39,15 @@ const UnsavedChanges = createContext<{ performAction: '', setPerformAction() {}, loading: false, - onProceed() {}, }); -export const UnsavedChangesProvider = ({ children }: ChildrenProps) => { +export const UnsavedChangesProvider = ({ + children, + onProceed, +}: { + children?: ReactNode; + onProceed?: (props: { setPerformAction?: (action: string) => void }) => void; +}) => { const [hasChanges, setHasChanges] = useState(false); const [reload, setReload] = useState(false); const [ignorePaths, setIgnorePaths] = useState([]); @@ -51,7 +55,6 @@ export const UnsavedChangesProvider = ({ children }: ChildrenProps) => { const location = useLocation(); const { state, proceed, reset } = unstable_useBlocker(({ nextLocation }) => { if (hasChanges && !ignorePaths.includes(nextLocation.pathname)) { - console.log('hasChanges', hasChanges); return true; } return false; @@ -65,8 +68,8 @@ export const UnsavedChangesProvider = ({ children }: ChildrenProps) => { } return hasChanges; }, - [hasChanges] - ) + [hasChanges], + ), ); useEffect(() => { @@ -119,7 +122,7 @@ export const UnsavedChangesProvider = ({ children }: ChildrenProps) => { performAction, setPerformAction, s, - ] + ], )} > {children} @@ -142,7 +145,10 @@ export const UnsavedChangesProvider = ({ children }: ChildrenProps) => { proceed?.()} + onClick={() => { + proceed?.(); + onProceed?.({ setPerformAction }); + }} /> @@ -150,6 +156,12 @@ export const UnsavedChangesProvider = ({ children }: ChildrenProps) => { ); }; +export const DISCARD_ACTIONS = { + DISCARD_CHANGES: 'discard-changes', + VIEW_CHANGES: 'view-changes', + INIT: 'init', +}; + export const useUnsavedChanges = () => { // const return useContext(UnsavedChanges); diff --git a/src/apps/console/page-components/app/compute.tsx b/src/apps/console/page-components/app/compute.tsx index 0682a7365..5df9b3a23 100644 --- a/src/apps/console/page-components/app/compute.tsx +++ b/src/apps/console/page-components/app/compute.tsx @@ -7,7 +7,10 @@ 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 useForm, { dummyEvent } from '~/root/lib/client/hooks/use-form'; -import { useUnsavedChanges } from '~/root/lib/client/hooks/use-unsaved-changes'; +import { + DISCARD_ACTIONS, + useUnsavedChanges, +} from '~/root/lib/client/hooks/use-unsaved-changes'; import Yup from '~/root/lib/server/helpers/yup'; import appInitialFormValues, { mapFormValuesToApp } from './app-utils'; import { plans } from './datas'; @@ -79,7 +82,7 @@ const AppCompute = ({ mode = 'new' }: { mode: 'edit' | 'new' }) => { mapFormValuesToApp({ appIn: val, oldAppIn: s, - }) + }), ); }, }); @@ -97,7 +100,7 @@ const AppCompute = ({ mode = 'new' }: { mode: 'edit' | 'new' }) => { }, [values, mode]); useEffect(() => { - if (performAction === 'discard-changes') { + if (performAction === DISCARD_ACTIONS.DISCARD_CHANGES) { resetValues(); } }, [performAction]); @@ -167,7 +170,7 @@ const AppCompute = ({ mode = 'new' }: { mode: 'edit' | 'new' }) => { handleChange('selectedPlan')(dummyEvent(v.value)); handleChange('memPerCpu')(dummyEvent(v.memoryPerCpu)); handleChange('cpuMode')( - dummyEvent(v.isShared ? 'shared' : 'dedicated') + dummyEvent(v.isShared ? 'shared' : 'dedicated'), ); }} /> diff --git a/src/apps/console/page-components/app/general.tsx b/src/apps/console/page-components/app/general.tsx index e01f491ac..6a18aaf23 100644 --- a/src/apps/console/page-components/app/general.tsx +++ b/src/apps/console/page-components/app/general.tsx @@ -16,7 +16,10 @@ import { ensureAccountClientSide } from '~/console/server/utils/auth-utils'; import { constants } from '~/console/server/utils/constants'; import useDebounce from '~/root/lib/client/hooks/use-debounce'; import useForm, { dummyEvent } from '~/root/lib/client/hooks/use-form'; -import { useUnsavedChanges } from '~/root/lib/client/hooks/use-unsaved-changes'; +import { + DISCARD_ACTIONS, + useUnsavedChanges, +} from '~/root/lib/client/hooks/use-unsaved-changes'; import Yup from '~/root/lib/server/helpers/yup'; import { handleError } from '~/root/lib/utils/common'; @@ -119,7 +122,7 @@ const AppGeneral = ({ mode = 'new' }: { mode: 'edit' | 'new' }) => { setImageLoaded(false); } }, - [] + [], ); useEffect(() => { @@ -133,7 +136,7 @@ const AppGeneral = ({ mode = 'new' }: { mode: 'edit' | 'new' }) => { } }, 300, - [imageSearchText] + [imageSearchText], ); const { @@ -176,7 +179,7 @@ const AppGeneral = ({ mode = 'new' }: { mode: 'edit' | 'new' }) => { displayName: Yup.string().required(), imageUrl: Yup.string().matches( constants.dockerImageFormatRegex, - 'Invalid image format' + 'Invalid image format', ), manualRepo: Yup.string().when( ['imageUrl', 'imageMode'], @@ -189,7 +192,7 @@ const AppGeneral = ({ mode = 'new' }: { mode: 'edit' | 'new' }) => { return schema.required().matches(regex, 'Invalid image format'); } return schema; - } + }, ), imageMode: Yup.string().required(), source: Yup.object() @@ -242,7 +245,7 @@ const AppGeneral = ({ mode = 'new' }: { mode: 'edit' | 'new' }) => { }, [values, mode]); useEffect(() => { - if (performAction === 'discard-changes') { + if (performAction === DISCARD_ACTIONS.DISCARD_CHANGES) { // if (app.ciBuildId) { // setIsEdited(false); // } diff --git a/src/apps/console/routes/_main+/$account+/env+/$environment+/app+/$app+/settings+/_layout.tsx b/src/apps/console/routes/_main+/$account+/env+/$environment+/app+/$app+/settings+/_layout.tsx index 3abb38b30..2408520a2 100644 --- a/src/apps/console/routes/_main+/$account+/env+/$environment+/app+/$app+/settings+/_layout.tsx +++ b/src/apps/console/routes/_main+/$account+/env+/$environment+/app+/$app+/settings+/_layout.tsx @@ -18,6 +18,7 @@ import { constants } from '~/console/server/utils/constants'; import { useReload } from '~/lib/client/helpers/reloader'; import useForm from '~/lib/client/hooks/use-form'; import { + DISCARD_ACTIONS, UnsavedChangesProvider, useUnsavedChanges, } from '~/lib/client/hooks/use-unsaved-changes'; @@ -69,8 +70,8 @@ const Layout = () => { setIgnorePaths( navItems.map( (ni) => - `/${account}/env/${environment}/app/${appName}/settings/${ni.value}` - ) + `/${account}/env/${environment}/app/${appName}/settings/${ni.value}`, + ), ); }, []); @@ -143,11 +144,11 @@ const Layout = () => { if (app.ciBuildId) { if ( readOnlyApp.spec.containers?.[0].image.includes( - constants.defaultAppRepoNameOnly + constants.defaultAppRepoNameOnly, ) ) { return `${constants.defaultAppRepoName( - accountName + accountName, )}:${tagName}`; } return `${registryHost}/${accountName}/${ @@ -158,7 +159,7 @@ const Layout = () => { }`; } return `${constants.defaultAppRepoName( - accountName + accountName, )}:${tagName}`; })(), name: 'container-0', @@ -177,7 +178,7 @@ const Layout = () => { } toast.success('App updated successfully'); // @ts-ignore - setPerformAction('init'); + setPerformAction(DISCARD_ACTIONS.INIT); if (!gitMode) { // @ts-ignore setBuildData(null); @@ -221,7 +222,7 @@ const Layout = () => { }, [rootContext.app]); useEffect(() => { - if (performAction === 'discard-changes') { + if (performAction === DISCARD_ACTIONS.DISCARD_CHANGES) { setApp(rootContext.app); setReadOnlyApp(rootContext.app); // @ts-ignore @@ -237,7 +238,7 @@ const Layout = () => { 'min-w-[1000px]': showDiff, 'min-w-[500px]': !showDiff, })} - show={performAction === 'view-changes'} + show={performAction === DISCARD_ACTIONS.VIEW_CHANGES} onOpenChange={(v) => setPerformAction(v)} > Commit Changes @@ -302,7 +303,11 @@ const Settings = () => { const rootContext = useOutletContext(); return ( - + { + setPerformAction?.(DISCARD_ACTIONS.DISCARD_CHANGES); + }} + > diff --git a/src/apps/console/routes/_main+/$account+/env+/$environment+/new-app/app-environment-variables.tsx b/src/apps/console/routes/_main+/$account+/env+/$environment+/new-app/app-environment-variables.tsx index 47aa179d3..26e57aa05 100644 --- a/src/apps/console/routes/_main+/$account+/env+/$environment+/new-app/app-environment-variables.tsx +++ b/src/apps/console/routes/_main+/$account+/env+/$environment+/new-app/app-environment-variables.tsx @@ -21,7 +21,10 @@ import NoResultsFound from '~/console/components/no-results-found'; import { IShowDialog } from '~/console/components/types.d'; import { useAppState } from '~/console/page-components/app-states'; import useForm from '~/root/lib/client/hooks/use-form'; -import { useUnsavedChanges } from '~/root/lib/client/hooks/use-unsaved-changes'; +import { + DISCARD_ACTIONS, + useUnsavedChanges, +} from '~/root/lib/client/hooks/use-unsaved-changes'; import Yup from '~/root/lib/server/helpers/yup'; import { NonNullableString } from '~/root/lib/types/common'; import AppDialog from './app-dialogs'; @@ -343,8 +346,7 @@ export const EnvironmentVariables = () => { }); useEffect(() => { - if (performAction === 'discard-changes') { - console.log('discard-changes'); + if (performAction === DISCARD_ACTIONS.DISCARD_CHANGES) { // if (app.ciBuildId) { // setIsEdited(false); // } diff --git a/src/apps/iot-console/routes/_main+/$account+/$project+/deviceblueprint+/$deviceblueprint+/app+/$app+/settings+/_layout.tsx b/src/apps/iot-console/routes/_main+/$account+/$project+/deviceblueprint+/$deviceblueprint+/app+/$app+/settings+/_layout.tsx index 476262729..343ed5df5 100644 --- a/src/apps/iot-console/routes/_main+/$account+/$project+/deviceblueprint+/$deviceblueprint+/app+/$app+/settings+/_layout.tsx +++ b/src/apps/iot-console/routes/_main+/$account+/$project+/deviceblueprint+/$deviceblueprint+/app+/$app+/settings+/_layout.tsx @@ -1,6 +1,7 @@ import { Outlet, useOutletContext } from '@remix-run/react'; import SidebarLayout from '~/iotconsole/components/sidebar-layout'; import { + DISCARD_ACTIONS, UnsavedChangesProvider, useUnsavedChanges, } from '~/lib/client/hooks/use-unsaved-changes'; @@ -52,8 +53,8 @@ const Layout = () => { setIgnorePaths( navItems.map( (ni) => - `/${account}/deviceblueprint/${deviceBlueprintName}/app/${appName}/settings/${ni.value}` - ) + `/${account}/deviceblueprint/${deviceBlueprintName}/app/${appName}/settings/${ni.value}`, + ), ); }, []); @@ -110,7 +111,7 @@ const Layout = () => { }, [rootContext.app]); useEffect(() => { - if (performAction === 'discard-changes') { + if (performAction === DISCARD_ACTIONS.DISCARD_CHANGES) { setApp(rootContext.app); setPerformAction(''); } @@ -120,7 +121,7 @@ const Layout = () => { setPerformAction(v)} > Review Changes From 4198421a7f9369ce6c105c1403e323fa98ced5f3 Mon Sep 17 00:00:00 2001 From: Bikash Date: Tue, 8 Oct 2024 11:55:32 +0545 Subject: [PATCH 3/5] fixed default diff in env from backend and frontend by setting default to null --- .../env+/$environment+/new-app/app-environment-variables.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/apps/console/routes/_main+/$account+/env+/$environment+/new-app/app-environment-variables.tsx b/src/apps/console/routes/_main+/$account+/env+/$environment+/new-app/app-environment-variables.tsx index 26e57aa05..7f29ac812 100644 --- a/src/apps/console/routes/_main+/$account+/env+/$environment+/new-app/app-environment-variables.tsx +++ b/src/apps/console/routes/_main+/$account+/env+/$environment+/new-app/app-environment-variables.tsx @@ -243,9 +243,10 @@ export const EnvironmentVariables = () => { submit, resetValues: reset, } = useForm({ - initialValues: getReadOnlyContainer().env || [], + initialValues: getReadOnlyContainer().env || null, validationSchema: Yup.array(entry), onSubmit: (val) => { + //@ts-ignore setContainer((c) => ({ ...c, env: val, From f744cacb7beb6a7e4acf57b8cb82383e03b6578c Mon Sep 17 00:00:00 2001 From: Piyush Kumar Date: Tue, 8 Oct 2024 12:17:56 +0530 Subject: [PATCH 4/5] environment discard changes on tab switching works fine --- lib/client/hooks/use-unsaved-changes.tsx | 7 +++---- .../$environment+/app+/$app+/settings+/_layout.tsx | 10 +++++----- .../new-app/app-environment-variables.tsx | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/lib/client/hooks/use-unsaved-changes.tsx b/lib/client/hooks/use-unsaved-changes.tsx index a5019f19d..33a16c359 100644 --- a/lib/client/hooks/use-unsaved-changes.tsx +++ b/lib/client/hooks/use-unsaved-changes.tsx @@ -68,8 +68,8 @@ export const UnsavedChangesProvider = ({ } return hasChanges; }, - [hasChanges], - ), + [hasChanges] + ) ); useEffect(() => { @@ -122,7 +122,7 @@ export const UnsavedChangesProvider = ({ performAction, setPerformAction, s, - ], + ] )} > {children} @@ -163,6 +163,5 @@ export const DISCARD_ACTIONS = { }; export const useUnsavedChanges = () => { - // const return useContext(UnsavedChanges); }; diff --git a/src/apps/console/routes/_main+/$account+/env+/$environment+/app+/$app+/settings+/_layout.tsx b/src/apps/console/routes/_main+/$account+/env+/$environment+/app+/$app+/settings+/_layout.tsx index 2408520a2..579cfcf8e 100644 --- a/src/apps/console/routes/_main+/$account+/env+/$environment+/app+/$app+/settings+/_layout.tsx +++ b/src/apps/console/routes/_main+/$account+/env+/$environment+/app+/$app+/settings+/_layout.tsx @@ -70,8 +70,8 @@ const Layout = () => { setIgnorePaths( navItems.map( (ni) => - `/${account}/env/${environment}/app/${appName}/settings/${ni.value}`, - ), + `/${account}/env/${environment}/app/${appName}/settings/${ni.value}` + ) ); }, []); @@ -144,11 +144,11 @@ const Layout = () => { if (app.ciBuildId) { if ( readOnlyApp.spec.containers?.[0].image.includes( - constants.defaultAppRepoNameOnly, + constants.defaultAppRepoNameOnly ) ) { return `${constants.defaultAppRepoName( - accountName, + accountName )}:${tagName}`; } return `${registryHost}/${accountName}/${ @@ -159,7 +159,7 @@ const Layout = () => { }`; } return `${constants.defaultAppRepoName( - accountName, + accountName )}:${tagName}`; })(), name: 'container-0', diff --git a/src/apps/console/routes/_main+/$account+/env+/$environment+/new-app/app-environment-variables.tsx b/src/apps/console/routes/_main+/$account+/env+/$environment+/new-app/app-environment-variables.tsx index 7f29ac812..fd1ade897 100644 --- a/src/apps/console/routes/_main+/$account+/env+/$environment+/new-app/app-environment-variables.tsx +++ b/src/apps/console/routes/_main+/$account+/env+/$environment+/new-app/app-environment-variables.tsx @@ -246,7 +246,7 @@ export const EnvironmentVariables = () => { initialValues: getReadOnlyContainer().env || null, validationSchema: Yup.array(entry), onSubmit: (val) => { - //@ts-ignore + // @ts-ignore setContainer((c) => ({ ...c, env: val, From e286e880c34f5cd28f96291c260977d05d8dd853 Mon Sep 17 00:00:00 2001 From: Piyush Kumar Date: Tue, 8 Oct 2024 12:37:42 +0530 Subject: [PATCH 5/5] minor refactoring --- .../env+/$environment+/new-app/app-environment-variables.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/apps/console/routes/_main+/$account+/env+/$environment+/new-app/app-environment-variables.tsx b/src/apps/console/routes/_main+/$account+/env+/$environment+/new-app/app-environment-variables.tsx index fd1ade897..05ae53218 100644 --- a/src/apps/console/routes/_main+/$account+/env+/$environment+/new-app/app-environment-variables.tsx +++ b/src/apps/console/routes/_main+/$account+/env+/$environment+/new-app/app-environment-variables.tsx @@ -273,6 +273,7 @@ export const EnvironmentVariables = () => { }; const removeEntry = (val: IEnvVariable) => { + // @ts-ignore setValues((v) => { const nv = v?.filter((v) => v.key !== val.key); return nv;