From 86a891dc28ef2a32631652be808cd6927c2e1062 Mon Sep 17 00:00:00 2001 From: lunaragon Date: Sun, 19 Feb 2023 00:18:57 +0800 Subject: [PATCH] feat(web): add confirm update env modal --- web/public/locales/en/translation.json | 5 +++-- web/public/locales/zh-CN/translation.json | 5 +++-- web/public/locales/zh/translation.json | 5 +++-- web/src/components/ConfirmButton/index.tsx | 14 +++++++++++--- web/src/pages/app/setting/AppEnvList/index.tsx | 15 ++++++++------- 5 files changed, 28 insertions(+), 16 deletions(-) diff --git a/web/public/locales/en/translation.json b/web/public/locales/en/translation.json index a49acc3224..c33581cbda 100644 --- a/web/public/locales/en/translation.json +++ b/web/public/locales/en/translation.json @@ -137,7 +137,8 @@ "Expire": "Expiration", "Setting": "Setting", "SystemSetting": "Application Settings", - "UserSetting": "User Settings" + "UserSetting": "User Settings", + "UpdateConfirm": "Update env will restart application, are you sure?" }, "StoragePanel": { "All": "Total Capacity", @@ -230,4 +231,4 @@ "Bucket": { "StatusTip": "External access needs to set the bucket permission to readonly" } -} \ No newline at end of file +} diff --git a/web/public/locales/zh-CN/translation.json b/web/public/locales/zh-CN/translation.json index 7fb7394e51..4e3d7fa68b 100644 --- a/web/public/locales/zh-CN/translation.json +++ b/web/public/locales/zh-CN/translation.json @@ -125,7 +125,8 @@ "AppEnv": "环境变量", "AddAppEnv": "新增环境变量", "Expire": "过期时间", - "UserSetting": "用户设置" + "UserSetting": "用户设置", + "UpdateConfirm": "更新环境变量将重新启动应用,是否继续?" }, "StoragePanel": { "CreateBucket": "创建 Bucket", @@ -231,4 +232,4 @@ "Bucket": { "StatusTip": "外部访问需要将 bucket 权限设置为 readonly" } -} \ No newline at end of file +} diff --git a/web/public/locales/zh/translation.json b/web/public/locales/zh/translation.json index a3ad7b9531..f2bfe842f9 100644 --- a/web/public/locales/zh/translation.json +++ b/web/public/locales/zh/translation.json @@ -137,7 +137,8 @@ "Expire": "过期时间", "Setting": "设置", "SystemSetting": "应用设置", - "UserSetting": "用户设置" + "UserSetting": "用户设置", + "UpdateConfirm": "更新环境变量将重新启动应用,是否继续?" }, "StoragePanel": { "All": "总容量", @@ -230,4 +231,4 @@ "Bucket": { "StatusTip": "外部访问需要将 bucket 权限设置为 readonly" } -} \ No newline at end of file +} diff --git a/web/src/components/ConfirmButton/index.tsx b/web/src/components/ConfirmButton/index.tsx index 0575e0409c..a8efaf968b 100644 --- a/web/src/components/ConfirmButton/index.tsx +++ b/web/src/components/ConfirmButton/index.tsx @@ -17,11 +17,17 @@ interface ConfirmButtonProps { onSuccessAction: () => void; headerText: string; bodyText: string; - + confirmButtonText?: string; children: React.ReactElement; } -const ConfirmButton = ({ onSuccessAction, headerText, bodyText, children }: ConfirmButtonProps) => { +const ConfirmButton = ({ + onSuccessAction, + headerText, + bodyText, + confirmButtonText, + children, +}: ConfirmButtonProps) => { const { isOpen, onOpen, onClose } = useDisclosure(); const cancelRef = React.useRef(); @@ -52,7 +58,9 @@ const ConfirmButton = ({ onSuccessAction, headerText, bodyText, children }: Conf diff --git a/web/src/pages/app/setting/AppEnvList/index.tsx b/web/src/pages/app/setting/AppEnvList/index.tsx index c19ab0b62c..ce91fec863 100644 --- a/web/src/pages/app/setting/AppEnvList/index.tsx +++ b/web/src/pages/app/setting/AppEnvList/index.tsx @@ -1,6 +1,7 @@ import { Button } from "@chakra-ui/react"; import { t } from "i18next"; +import ConfirmButton from "@/components/ConfirmButton"; import EditableTable from "@/components/EditableTable"; import { isExitInList } from "@/utils/format"; @@ -74,17 +75,17 @@ const AppEnvList = (props: { onClose?: () => {} }) => { onDelete={(data) => delEnvironmentMutation.mutateAsync({ name: data })} onCreate={(data) => addEnvironmentMutation.mutateAsync(data)} /> - + + );