From 034bb71b10ca2620c5f267c12f99ceb87f3ccd8c Mon Sep 17 00:00:00 2001 From: Fu Diwei <fudiwei@sina.com> Date: Thu, 24 Apr 2025 09:13:49 +0800 Subject: [PATCH] feat(ui): show ca provider global settings button only when not specified ca provider --- .../components/provider/ApplyCAProviderSelect.tsx | 2 +- .../workflow/node/ApplyNodeConfigForm.tsx | 15 +++++++++------ ui/src/i18n/locales/zh/nls.workflow.nodes.json | 6 +++--- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/ui/src/components/provider/ApplyCAProviderSelect.tsx b/ui/src/components/provider/ApplyCAProviderSelect.tsx index fdedac9b..6c805bae 100644 --- a/ui/src/components/provider/ApplyCAProviderSelect.tsx +++ b/ui/src/components/provider/ApplyCAProviderSelect.tsx @@ -22,7 +22,7 @@ const ApplyCAProviderSelect = ({ filter, ...props }: ApplyCAProviderSelectProps) { key: "", value: "", - label: "provider.default_ca_provider.label", + label: t("provider.default_ca_provider.label"), data: {} as ApplyCAProvider, }, ...filteredItems.map((item) => ({ diff --git a/ui/src/components/workflow/node/ApplyNodeConfigForm.tsx b/ui/src/components/workflow/node/ApplyNodeConfigForm.tsx index 6ea95979..98bfcef2 100644 --- a/ui/src/components/workflow/node/ApplyNodeConfigForm.tsx +++ b/ui/src/components/workflow/node/ApplyNodeConfigForm.tsx @@ -33,6 +33,7 @@ import ModalForm from "@/components/ModalForm"; import MultipleInput from "@/components/MultipleInput"; import ApplyCAProviderSelect from "@/components/provider/ApplyCAProviderSelect"; import ApplyDNSProviderSelect from "@/components/provider/ApplyDNSProviderSelect"; +import Show from "@/components/Show"; import { ACCESS_USAGES, APPLY_DNS_PROVIDERS, accessProvidersMap, applyCAProvidersMap, applyDNSProvidersMap } from "@/domain/provider"; import { type WorkflowNodeConfigForApply } from "@/domain/workflow"; import { useAntdForm, useAntdFormName, useZustandShallowSelector } from "@/hooks"; @@ -400,12 +401,14 @@ const ApplyNodeConfigForm = forwardRef<ApplyNodeConfigFormInstance, ApplyNodeCon <div className="flex w-full items-center justify-between gap-4"> <div className="max-w-full grow truncate">{t("workflow_node.apply.form.ca_provider.label")}</div> <div className="text-right"> - <Link className="ant-typography" to="/settings/ssl-provider" target="_blank"> - <Button size="small" type="link"> - {t("workflow_node.apply.form.ca_provider.button")} - <RightOutlinedIcon className="text-xs" /> - </Button> - </Link> + <Show when={!fieldCAProvider}> + <Link className="ant-typography" to="/settings/ssl-provider" target="_blank"> + <Button size="small" type="link"> + {t("workflow_node.apply.form.ca_provider.button")} + <RightOutlinedIcon className="text-xs" /> + </Button> + </Link> + </Show> </div> </div> </label> diff --git a/ui/src/i18n/locales/zh/nls.workflow.nodes.json b/ui/src/i18n/locales/zh/nls.workflow.nodes.json index 1e1387f8..1db3a1d5 100644 --- a/ui/src/i18n/locales/zh/nls.workflow.nodes.json +++ b/ui/src/i18n/locales/zh/nls.workflow.nodes.json @@ -57,12 +57,12 @@ "workflow_node.apply.form.advanced_config.label": "高级设置", "workflow_node.apply.form.ca_provider.label": "证书颁发机构(可选)", "workflow_node.apply.form.ca_provider.placeholder": "请选择证书颁发机构", - "workflow_node.apply.form.ca_provider.button": "去配置", + "workflow_node.apply.form.ca_provider.button": "设置", "workflow_node.apply.form.ca_provider_access.label": "证书颁发机构授权", "workflow_node.apply.form.ca_provider_access.placeholder": "请选择证书颁发机构授权", "workflow_node.apply.form.ca_provider_access.button": "新建", - "workflow_node.apply.form.key_algorithm.label": "数字证书算法", - "workflow_node.apply.form.key_algorithm.placeholder": "请选择数字证书算法", + "workflow_node.apply.form.key_algorithm.label": "证书算法", + "workflow_node.apply.form.key_algorithm.placeholder": "请选择证书算法", "workflow_node.apply.form.nameservers.label": "DNS 递归服务器(可选)", "workflow_node.apply.form.nameservers.placeholder": "请输入 DNS 递归服务器(多个值请用半角分号隔开)", "workflow_node.apply.form.nameservers.tooltip": "在 ACME DNS-01 质询时使用自定义的 DNS 递归服务器。如果你不了解该选项的用途,保持默认即可。<a href=\"https://go-acme.github.io/lego/usage/cli/options/index.html#dns-resolvers-and-challenge-verification\" target=\"_blank\">点此了解更多</a>。",