diff --git a/frontend/desktop/src/pages/index.tsx b/frontend/desktop/src/pages/index.tsx index 6810e2077bc..6b23c4deaf3 100644 --- a/frontend/desktop/src/pages/index.tsx +++ b/frontend/desktop/src/pages/index.tsx @@ -47,7 +47,7 @@ export default function Home({ sealos_cloud_domain }: { sealos_cloud_domain: str useEffect(() => { const { query } = router; const is_login = isUserLogin(); - const whitelistApps = ['system-template']; + const whitelistApps = ['system-template', 'system-fastdeploy']; if (!is_login) { const { appkey, appQuery } = parseOpenappQuery((query?.openapp as string) || ''); // sealos_inside=true internal call @@ -71,6 +71,9 @@ export default function Home({ sealos_cloud_domain }: { sealos_cloud_domain: str appQuery = state.launchQuery.raw; } if (!appkey) return; + if (appkey === 'system-fastdeploy') { + appkey = 'system-template'; + } const app = state.installedApps.find((item) => item.key === appkey); if (!app) return; state.openApp(app, { raw: appQuery }).then(() => { diff --git a/frontend/providers/applaunchpad/src/hooks/useDriver.tsx b/frontend/providers/applaunchpad/src/hooks/useDriver.tsx index fa7622fbb16..af7117dabe8 100644 --- a/frontend/providers/applaunchpad/src/hooks/useDriver.tsx +++ b/frontend/providers/applaunchpad/src/hooks/useDriver.tsx @@ -1,11 +1,9 @@ import { getPlatformEnv, getUserAccount, updateDesktopGuide } from '@/api/platform'; import { GUIDE_LAUNCHPAD_CREATE_KEY } from '@/constants/account'; -import { AppEditType } from '@/types/app'; import { Flex, FlexProps, Icon, Text } from '@chakra-ui/react'; import { driver } from '@sealos/driver'; import { useTranslation } from 'next-i18next'; import { useEffect, useState } from 'react'; -import { UseFormReturn } from 'react-hook-form'; export function DriverStarIcon() { return ( @@ -40,11 +38,7 @@ export function DriverStarIcon() { ); } -export default function useDriver({ - formHook -}: { - formHook: UseFormReturn; -}) { +export default function useDriver() { const { t } = useTranslation(); const [isGuided, setIsGuided] = useState(true); @@ -57,7 +51,6 @@ export default function useDriver({ const isGuided = !!userAccount.metadata.annotations?.[GUIDE_LAUNCHPAD_CREATE_KEY]; if (!isGuided) { startGuide(); - formHook.setValue('appName', 'hello-world-guide'); } setIsGuided(isGuided); } diff --git a/frontend/providers/applaunchpad/src/pages/app/edit/index.tsx b/frontend/providers/applaunchpad/src/pages/app/edit/index.tsx index 3df46448e25..ee75498bf68 100644 --- a/frontend/providers/applaunchpad/src/pages/app/edit/index.tsx +++ b/frontend/providers/applaunchpad/src/pages/app/edit/index.tsx @@ -21,7 +21,7 @@ import { json2Service } from '@/utils/deployYaml2Json'; import { serviceSideProps } from '@/utils/i18n'; -import { getErrText, patchYamlListV1 } from '@/utils/tools'; +import { getErrText, patchYamlList, patchYamlListV1 } from '@/utils/tools'; import { Box, Flex } from '@chakra-ui/react'; import { useQuery } from '@tanstack/react-query'; import { useTranslation } from 'next-i18next'; @@ -89,6 +89,7 @@ export const formData2Yamls = ( const EditApp = ({ appName, tabType }: { appName?: string; tabType: string }) => { const { t } = useTranslation(); + const formOldYamls = useRef([]); const crOldYamls = useRef([]); const oldAppEditData = useRef(); const { toast } = useToast(); @@ -123,7 +124,7 @@ const EditApp = ({ appName, tabType }: { appName?: string; tabType: string }) => const formHook = useForm({ defaultValues: defaultEditVal }); - const { isGuided, closeGuide } = useDriver({ formHook }); + const { isGuided, closeGuide } = useDriver(); const realTimeForm = useRef(defaultEditVal); @@ -154,10 +155,10 @@ const EditApp = ({ appName, tabType }: { appName?: string; tabType: string }) => setIsLoading(true); try { const yamls = yamlList.map((item) => item.value); - if (appName) { - const patch = patchYamlListV1({ - oldYamlList: crOldYamls.current, + const patch = patchYamlList({ + formOldYamlList: formOldYamls.current.map((item) => item.value), + crYamlList: crOldYamls.current, newYamlList: yamls }); @@ -257,7 +258,11 @@ const EditApp = ({ appName, tabType }: { appName?: string; tabType: string }) => onSuccess(res) { if (!res) return; oldAppEditData.current = res; - + formOldYamls.current = formData2Yamls( + res, + appName !== '' ? 'edit' : 'create', + res.crYamlList + ); crOldYamls.current = res.crYamlList; setDefaultStorePathList(res.storeList.map((item) => item.path));