diff --git a/frontend/providers/applaunchpad/public/locales/en/common.json b/frontend/providers/applaunchpad/public/locales/en/common.json index 0b7147775e8..0062715f00c 100644 --- a/frontend/providers/applaunchpad/public/locales/en/common.json +++ b/frontend/providers/applaunchpad/public/locales/en/common.json @@ -276,5 +276,6 @@ "add_configmap": "Add Configmaps", "storage_path_placeholder": "For Example: /data" }, - "guide_deploy_button": "Complete creation" -} \ No newline at end of file + "guide_deploy_button": "Complete creation", + "shared": "Shared" +} diff --git a/frontend/providers/applaunchpad/public/locales/zh/common.json b/frontend/providers/applaunchpad/public/locales/zh/common.json index da5b88f3929..95df44ea1ac 100644 --- a/frontend/providers/applaunchpad/public/locales/zh/common.json +++ b/frontend/providers/applaunchpad/public/locales/zh/common.json @@ -277,5 +277,6 @@ "add_configmap": "新增配置文件", "storage_path_placeholder": "如:/data" }, - "guide_deploy_button": "完成创建" -} \ No newline at end of file + "guide_deploy_button": "完成创建", + "shared": "共享" +} diff --git a/frontend/providers/applaunchpad/src/pages/app/detail/components/AppBaseInfo.tsx b/frontend/providers/applaunchpad/src/pages/app/detail/components/AppBaseInfo.tsx index 5c6ec64d031..3407d0fc99d 100644 --- a/frontend/providers/applaunchpad/src/pages/app/detail/components/AppBaseInfo.tsx +++ b/frontend/providers/applaunchpad/src/pages/app/detail/components/AppBaseInfo.tsx @@ -100,6 +100,30 @@ const AppBaseInfo = ({ app = MOCK_APP_DETAIL }: { app: AppDetailType }) => { [app] ); + const persistentVolumes = useMemo(() => { + return app.volumes + .filter((item) => 'persistentVolumeClaim' in item) + .reduce( + ( + acc: { + path: string; + name: string; + }[], + volume + ) => { + const mount = app.volumeMounts.find((m) => m.name === volume.name); + if (mount) { + acc.push({ + path: mount.mountPath, + name: volume.name + }); + } + return acc; + }, + [] + ); + }, [app.volumes, app.volumeMounts]); + return ( {app?.source?.hasSource && ( @@ -415,6 +439,27 @@ const AppBaseInfo = ({ app = MOCK_APP_DETAIL }: { app: AppDetailType }) => { ))} + {persistentVolumes.map((item) => ( + + + + + {item.path} + + + + {t('shared')} + + + ))} diff --git a/frontend/providers/applaunchpad/src/pages/app/edit/components/Form.tsx b/frontend/providers/applaunchpad/src/pages/app/edit/components/Form.tsx index 4a73a901a89..8aec2ab98d2 100644 --- a/frontend/providers/applaunchpad/src/pages/app/edit/components/Form.tsx +++ b/frontend/providers/applaunchpad/src/pages/app/edit/components/Form.tsx @@ -84,6 +84,7 @@ const Form = ({ control, setValue, getValues, + watch, formState: { errors } } = formHook; @@ -310,6 +311,30 @@ const Form = ({ // eslint-disable-next-line react-hooks/exhaustive-deps const SliderList = useMemo(() => countSliderList(), [already, refresh]); + const persistentVolumes = useMemo(() => { + return getValues('volumes') + .filter((item) => 'persistentVolumeClaim' in item) + .reduce( + ( + acc: { + path: string; + name: string; + }[], + volume + ) => { + const mount = getValues('volumeMounts').find((m) => m.name === volume.name); + if (mount) { + acc.push({ + path: mount.mountPath, + name: volume.name + }); + } + return acc; + }, + [] + ); + }, [getValues, refresh]); + return ( <> ))} + {persistentVolumes.map((item) => ( + + + + + + {item.path} + + + + {t('shared')} + + + + ))} diff --git a/frontend/providers/applaunchpad/src/utils/deployYaml2Json.ts b/frontend/providers/applaunchpad/src/utils/deployYaml2Json.ts index 497ac2bc578..bc790bf3817 100644 --- a/frontend/providers/applaunchpad/src/utils/deployYaml2Json.ts +++ b/frontend/providers/applaunchpad/src/utils/deployYaml2Json.ts @@ -14,8 +14,6 @@ import dayjs from 'dayjs'; import yaml from 'js-yaml'; export const json2DeployCr = (data: AppEditType, type: 'deployment' | 'statefulset') => { - console.log(data, 'data'); - const totalStorage = data.storeList.reduce((acc, item) => acc + item.value, 0); const metadata = {