feat(ui): improve i18n

This commit is contained in:
Fu Diwei
2025-01-01 14:04:41 +08:00
parent 9c645a1efa
commit 7bd0cbce10
24 changed files with 347 additions and 601 deletions

View File

@@ -4,8 +4,8 @@ const End = () => {
const { t } = useTranslation();
return (
<div className="flex flex-col items-center">
<div className="h-[18px] rounded-full w-[18px] bg-stone-400"></div>
<div className="text-sm text-stone-400 mt-2">{t("workflow.node.end.title")}</div>
<div className="size-[20px] rounded-full bg-stone-400"></div>
<div className="text-sm text-stone-400 mt-2">{t("workflow_node.end.title")}</div>
</div>
);
};

View File

@@ -57,7 +57,7 @@ const DeployNodeFormLocalFields = () => {
.nullish()
.refine((v) => fieldFormat !== FORMAT_JKS || !!v?.trim(), { message: t("workflow_node.deploy.form.local_jks_storepass.tooltip") }),
shellEnv: z.union([z.literal(SHELLENV_SH), z.literal(SHELLENV_CMD), z.literal(SHELLENV_POWERSHELL)], {
message: t("domain.deployment.form.shell.placeholder"),
message: t("workflow_node.deploy.form.local_shell_env.placeholder"),
}),
preCommand: z
.string()

View File

@@ -6,6 +6,7 @@ import dayjs from "dayjs";
import { produce } from "immer";
import { z } from "zod";
import Show from "@/components/Show";
import { usePanel } from "../PanelProvider";
import { useAntdForm, useZustandShallowSelector } from "@/hooks";
import { type WorkflowNode, type WorkflowNodeConfig } from "@/domain/workflow";
@@ -106,7 +107,7 @@ const StartNodeForm = ({ data }: StartNodeFormProps) => {
rules={[formRule]}
tooltip={<span dangerouslySetInnerHTML={{ __html: t("workflow_node.start.form.trigger_cron.tooltip") }}></span>}
extra={
triggerCronLastExecutions.length > 0 ? (
<Show when={triggerCronLastExecutions.length > 0}>
<div>
{t("workflow_node.start.form.trigger_cron.extra")}
<br />
@@ -117,9 +118,7 @@ const StartNodeForm = ({ data }: StartNodeFormProps) => {
</span>
))}
</div>
) : (
<></>
)
</Show>
}
>
<Input placeholder={t("workflow_node.start.form.trigger_cron.placeholder")} onChange={(e) => handleTriggerCronChange(e.target.value)} />

View File

@@ -1,5 +1,4 @@
import { useState } from "react";
import { useParams } from "react-router-dom";
import { useTranslation } from "react-i18next";
import { useRequest } from "ahooks";
import { Button, Empty, notification, Space, Table, theme, Tooltip, Typography, type TableProps } from "antd";
@@ -18,9 +17,10 @@ import { getErrMsg } from "@/utils/error";
export type WorkflowRunsProps = {
className?: string;
style?: React.CSSProperties;
workflowId: string;
};
const WorkflowRuns = ({ className, style }: WorkflowRunsProps) => {
const WorkflowRuns = ({ className, style, workflowId }: WorkflowRunsProps) => {
const { t } = useTranslation();
const { token: themeToken } = theme.useToken();
@@ -105,11 +105,10 @@ const WorkflowRuns = ({ className, style }: WorkflowRunsProps) => {
const [page, setPage] = useState<number>(1);
const [pageSize, setPageSize] = useState<number>(10);
const { id: workflowId } = useParams(); // TODO: 外部传参
const { loading } = useRequest(
() => {
return listWorkflowRuns({
workflowId: workflowId!,
workflowId: workflowId,
page: page,
perPage: pageSize,
});