mirror of
https://github.com/certimate-go/certimate.git
synced 2026-09-24 23:10:13 +08:00
chore(deps): upgrade npm dependencies
This commit is contained in:
@@ -148,7 +148,7 @@ export default defineConfig(
|
||||
...tailwindcssPlugin.configs["recommended-error"].rules,
|
||||
|
||||
"better-tailwindcss/enforce-consistent-line-wrapping": "off",
|
||||
"better-tailwindcss/no-unregistered-classes": "off",
|
||||
"better-tailwindcss/no-unknown-classes": "off",
|
||||
},
|
||||
settings: {
|
||||
"better-tailwindcss": {
|
||||
|
||||
Generated
+551
-540
File diff suppressed because it is too large
Load Diff
+19
-19
@@ -13,42 +13,42 @@
|
||||
"@codemirror/lang-yaml": "^6.1.2",
|
||||
"@codemirror/language": "^6.12.1",
|
||||
"@codemirror/legacy-modes": "^6.5.2",
|
||||
"@flowgram.ai/document": "1.0.6",
|
||||
"@flowgram.ai/fixed-layout-editor": "1.0.6",
|
||||
"@flowgram.ai/minimap-plugin": "1.0.6",
|
||||
"@flowgram.ai/document": "1.0.7",
|
||||
"@flowgram.ai/fixed-layout-editor": "1.0.7",
|
||||
"@flowgram.ai/minimap-plugin": "1.0.7",
|
||||
"@peculiar/asn1-ecc": "^2.6.0",
|
||||
"@peculiar/asn1-pkcs8": "^2.6.0",
|
||||
"@peculiar/asn1-rsa": "^2.6.0",
|
||||
"@peculiar/asn1-schema": "^2.6.0",
|
||||
"@peculiar/x509": "^1.14.2",
|
||||
"@peculiar/x509": "^1.14.3",
|
||||
"@tabler/icons-react": "^3.36.1",
|
||||
"@uiw/codemirror-extensions-basic-setup": "^4.25.4",
|
||||
"@uiw/codemirror-theme-vscode": "^4.25.4",
|
||||
"@uiw/react-codemirror": "^4.25.4",
|
||||
"ahooks": "^3.9.6",
|
||||
"antd": "^6.1.4",
|
||||
"antd": "^6.2.3",
|
||||
"antd-zod": "^8.0.0",
|
||||
"clsx": "^2.1.1",
|
||||
"cron-parser": "^5.4.0",
|
||||
"cron-parser": "^5.5.0",
|
||||
"dayjs": "^1.11.19",
|
||||
"file-saver": "^2.0.5",
|
||||
"i18next": "^25.7.4",
|
||||
"i18next": "^25.8.4",
|
||||
"i18next-browser-languagedetector": "^8.2.0",
|
||||
"immer": "^11.1.3",
|
||||
"nanoid": "^5.1.6",
|
||||
"pocketbase": "^0.26.5",
|
||||
"pocketbase": "^0.26.8",
|
||||
"radash": "^12.1.1",
|
||||
"react": "^18.3.1",
|
||||
"react-copy-to-clipboard": "^5.1.0",
|
||||
"react-dom": "^18.3.1",
|
||||
"react-i18next": "^16.5.1",
|
||||
"react-router": "^7.12.0",
|
||||
"react-router-dom": "^7.12.0",
|
||||
"react-i18next": "^16.5.4",
|
||||
"react-router": "^7.13.0",
|
||||
"react-router-dom": "^7.13.0",
|
||||
"reflect-metadata": "^0.2.2",
|
||||
"tailwind-merge": "^3.4.0",
|
||||
"yaml": "^2.8.2",
|
||||
"zod": "^4.3.5",
|
||||
"zustand": "^5.0.9"
|
||||
"zod": "^4.3.6",
|
||||
"zustand": "^5.0.11"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^9.39.2",
|
||||
@@ -61,20 +61,20 @@
|
||||
"@types/react-copy-to-clipboard": "^5.0.7",
|
||||
"@types/react-dom": "^18.3.7",
|
||||
"@vitejs/plugin-legacy": "^7.2.1",
|
||||
"@vitejs/plugin-react": "^5.1.2",
|
||||
"@vitejs/plugin-react": "^5.1.3",
|
||||
"eslint": "^9.39.2",
|
||||
"eslint-config-prettier": "^10.1.8",
|
||||
"eslint-import-resolver-typescript": "^4.4.4",
|
||||
"eslint-plugin-better-tailwindcss": "^3.8.0",
|
||||
"eslint-plugin-better-tailwindcss": "^4.1.1",
|
||||
"eslint-plugin-import": "^2.32.0",
|
||||
"eslint-plugin-prettier": "^5.5.4",
|
||||
"eslint-plugin-prettier": "^5.5.5",
|
||||
"eslint-plugin-react-hooks": "^7.0.1",
|
||||
"eslint-plugin-react-refresh": "^0.4.26",
|
||||
"eslint-plugin-react-refresh": "^0.5.0",
|
||||
"fs-extra": "^11.3.3",
|
||||
"prettier": "^3.7.4",
|
||||
"prettier": "^3.8.1",
|
||||
"tailwindcss": "^4.1.18",
|
||||
"typescript": "^5.9.3",
|
||||
"typescript-eslint": "^8.52.0",
|
||||
"typescript-eslint": "^8.54.0",
|
||||
"vite": "^7.3.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,12 +17,7 @@ const AccessConfigFormFieldsProviderMohua = () => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Form.Item
|
||||
name={[parentNamePath, "username"]}
|
||||
initialValue={initialValues.username}
|
||||
label={t("access.form.mohua_username.label")}
|
||||
rules={[formRule]}
|
||||
>
|
||||
<Form.Item name={[parentNamePath, "username"]} initialValue={initialValues.username} label={t("access.form.mohua_username.label")} rules={[formRule]}>
|
||||
<Input autoComplete="new-password" placeholder={t("access.form.mohua_username.placeholder")} />
|
||||
</Form.Item>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<svg
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
|
||||
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
@@ -47,7 +47,7 @@ const DeploymentProviderPicker = forwardRef<DeploymentProviderPickerInstance, De
|
||||
return (
|
||||
<div key={provider.type}>
|
||||
<Card
|
||||
className="group/provider h-16 w-full overflow-hidden shadow"
|
||||
className="group/provider h-16 w-full overflow-hidden shadow-sm"
|
||||
styles={{ body: { height: "100%", padding: "0.5rem 1rem" } }}
|
||||
hoverable
|
||||
onClick={() => {
|
||||
|
||||
@@ -35,7 +35,7 @@ const NotificationProviderPicker = forwardRef<NotificationProviderPickerInstance
|
||||
return (
|
||||
<div key={provider.type}>
|
||||
<Card
|
||||
className="group/provider h-16 w-full overflow-hidden shadow"
|
||||
className="group/provider h-16 w-full overflow-hidden shadow-sm"
|
||||
styles={{ body: { height: "100%", padding: "0.5rem 1rem" } }}
|
||||
hoverable
|
||||
onClick={() => {
|
||||
|
||||
@@ -51,8 +51,8 @@ const serialize = (graph: WorkflowGraph | undefined, format: WorkflowGraphExport
|
||||
] as string[];
|
||||
const hasChildren = node.blocks.length > 0 || branchLikeNodeTypes.includes(nodeRegistries.find((r) => r.type === node.type)?.extend ?? "");
|
||||
if (hasChildren) {
|
||||
const childern = node.blocks.map((block) => deepConvert(block));
|
||||
map.set("blocks", childern);
|
||||
const children = node.blocks.map((block) => deepConvert(block));
|
||||
map.set("blocks", children);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -362,11 +362,11 @@ const WorkflowRunLogs = ({ runData }: { runData: WorkflowRunModel }) => {
|
||||
{listData.map((group, index) => {
|
||||
return (
|
||||
<div key={index} className="mb-3">
|
||||
<div className="truncate text-xs leading-loose">
|
||||
<div className="truncate text-xs/loose">
|
||||
<span className="font-mono text-stone-400">{`#${group.id}\u00A0`}</span>
|
||||
<span>{group.name}</span>
|
||||
</div>
|
||||
<div className="flex flex-col text-xs leading-relaxed">{group.records.map((record) => renderLogRecord(record))}</div>
|
||||
<div className="flex flex-col text-xs/relaxed">{group.records.map((record) => renderLogRecord(record))}</div>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
|
||||
@@ -3,7 +3,7 @@ import { IconGradienter } from "@tabler/icons-react";
|
||||
|
||||
const DragHighlightAdder = (_: FlowgramDragNodeProps) => {
|
||||
return (
|
||||
<div className="size-4 animate-ping rounded-full bg-primary text-white shadow">
|
||||
<div className="size-4 animate-ping rounded-full bg-primary text-white shadow-sm">
|
||||
<div className="flex size-full items-center justify-center">
|
||||
<IconGradienter size="1em" />
|
||||
</div>
|
||||
|
||||
@@ -13,7 +13,7 @@ const DragNode = ({ dragStart, dragNodes }: DragNodeProps) => {
|
||||
return (
|
||||
<Badge count={count > 1 ? count : 0} size="small">
|
||||
<div className="relative w-[160px]">
|
||||
<Card className="bg-transparent shadow" styles={{ body: { padding: 0 } }}>
|
||||
<Card className="bg-transparent shadow-sm" styles={{ body: { padding: 0 } }}>
|
||||
<div className="overflow-hidden px-4 py-2 text-primary">
|
||||
<div className="truncate">{dragStart ? dragStart.form?.getValueIn("name") || `#${dragStart?.id}` : "\u00A0"}</div>
|
||||
</div>
|
||||
|
||||
@@ -20,7 +20,7 @@ const DraggingAdder = ({ from }: DraggingAdderProps) => {
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="size-4 animate-bounce rounded-full bg-primary text-white shadow">
|
||||
<div className="size-4 animate-bounce rounded-full bg-primary text-white shadow-sm">
|
||||
<div className="flex size-full items-center justify-center">
|
||||
<IconChevronsDown size="1em" />
|
||||
</div>
|
||||
|
||||
@@ -9,10 +9,9 @@
|
||||
"workflow.search.placeholder": "Search by workflow name ...",
|
||||
|
||||
"workflow.action.create.button": "Create workflow",
|
||||
"workflow.action.create.modal.title": "Create workflow",
|
||||
"workflow.action.modify.menu": "Edit",
|
||||
"workflow.action.duplicate.menu": "Duplicate",
|
||||
"workflow.action.duplicate.modal.title": "Duplicate \"{{name}}\"",
|
||||
"workflow.action.duplicate.modal.content": "Are you sure to duplicate this workflow?",
|
||||
"workflow.action.delete.menu": "Delete",
|
||||
"workflow.action.delete.modal.title": "Delete \"{{name}}\"",
|
||||
"workflow.action.delete.modal.content": "Are you sure want to delete this workflow? <br>This action cannot be undone.",
|
||||
@@ -53,7 +52,9 @@
|
||||
"workflow.new.templates.default_name": "Untitled workflow",
|
||||
"workflow.new.templates.default_description": "",
|
||||
|
||||
"workflow.detail.baseinfo.name.label": "Workflow name",
|
||||
"workflow.detail.baseinfo.name.placeholder": "Please enter workflow name",
|
||||
"workflow.detail.baseinfo.description.label": "Workflow description",
|
||||
"workflow.detail.baseinfo.description.placeholder": "Please enter workflow description",
|
||||
"workflow.detail.design.tab": "Orchestration",
|
||||
"workflow.detail.design.editor.placeholder": "Please configure",
|
||||
|
||||
@@ -9,10 +9,9 @@
|
||||
"workflow.search.placeholder": "按工作流名称搜索……",
|
||||
|
||||
"workflow.action.create.button": "新建工作流",
|
||||
"workflow.action.create.modal.title": "新建工作流",
|
||||
"workflow.action.modify.menu": "编辑工作流",
|
||||
"workflow.action.duplicate.menu": "复制工作流",
|
||||
"workflow.action.duplicate.modal.title": "复制「{{name}}」",
|
||||
"workflow.action.duplicate.modal.content": "确定要复制该工作流吗?",
|
||||
"workflow.action.delete.menu": "删除工作流",
|
||||
"workflow.action.delete.modal.title": "删除「{{name}}」",
|
||||
"workflow.action.delete.modal.content": "确定要删除该工作流吗?<br>注意此操作不可撤销,请谨慎操作。",
|
||||
@@ -53,7 +52,9 @@
|
||||
"workflow.new.templates.default_name": "未命名工作流",
|
||||
"workflow.new.templates.default_description": "",
|
||||
|
||||
"workflow.detail.baseinfo.name.label": "工作流名称",
|
||||
"workflow.detail.baseinfo.name.placeholder": "请输入工作流名称",
|
||||
"workflow.detail.baseinfo.description.label": "工作流描述",
|
||||
"workflow.detail.baseinfo.description.placeholder": "请输入工作流描述",
|
||||
"workflow.detail.design.tab": "流程编排",
|
||||
"workflow.detail.design.editor.placeholder": "请完成配置",
|
||||
|
||||
@@ -104,7 +104,7 @@ const ConsoleLayout = () => {
|
||||
</div>
|
||||
<div className="absolute top-1/2 right-0 translate-x-1/2 -translate-y-1/2 opacity-0 transition-opacity group-hover/sider:opacity-100">
|
||||
<Button
|
||||
className="bg-background shadow"
|
||||
className="bg-background shadow-sm"
|
||||
icon={
|
||||
siderCollapsed ? (
|
||||
<IconLayoutSidebarRightCollapse size="1.5em" stroke="1.25" color="#999" />
|
||||
|
||||
@@ -227,7 +227,7 @@ const Shortcuts = ({ className, style }: { className?: string; style?: React.CSS
|
||||
<div className={className} style={style}>
|
||||
<div className="flex items-center gap-4 not-md:flex-wrap">
|
||||
<Button
|
||||
className="shadow"
|
||||
className="shadow-sm"
|
||||
icon={<IconCirclePlus color="var(--color-primary)" size="1.25em" />}
|
||||
shape="round"
|
||||
size="large"
|
||||
@@ -236,7 +236,7 @@ const Shortcuts = ({ className, style }: { className?: string; style?: React.CSS
|
||||
<span className="text-sm">{t("dashboard.shortcut.create_workflow")}</span>
|
||||
</Button>
|
||||
<Button
|
||||
className="shadow"
|
||||
className="shadow-sm"
|
||||
icon={<IconLock color="var(--color-warning)" size="1.25em" />}
|
||||
shape="round"
|
||||
size="large"
|
||||
@@ -245,7 +245,7 @@ const Shortcuts = ({ className, style }: { className?: string; style?: React.CSS
|
||||
<span className="text-sm">{t("dashboard.shortcut.change_account")}</span>
|
||||
</Button>
|
||||
<Button
|
||||
className="shadow"
|
||||
className="shadow-sm"
|
||||
icon={<IconPlugConnected color="var(--color-info)" size="1.25em" />}
|
||||
shape="round"
|
||||
size="large"
|
||||
@@ -255,7 +255,7 @@ const Shortcuts = ({ className, style }: { className?: string; style?: React.CSS
|
||||
</Button>
|
||||
{hasUpdate && (
|
||||
<Button
|
||||
className="shadow"
|
||||
className="shadow-sm"
|
||||
icon={<IconConfetti className="animate-bounce" color="var(--color-error)" size="1.25em" />}
|
||||
shape="round"
|
||||
size="large"
|
||||
|
||||
@@ -297,7 +297,7 @@ const InternalEditDrawer = ({
|
||||
case "create":
|
||||
case "modify":
|
||||
{
|
||||
onSubmit?.(values);
|
||||
await onSubmit?.(values);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -293,7 +293,7 @@ const InternalEditDrawer = ({
|
||||
case "create":
|
||||
case "modify":
|
||||
{
|
||||
onSubmit?.(values);
|
||||
await onSubmit?.(values);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -139,7 +139,7 @@ const SettingsDiagnosticsLogs = ({ className, style }: { className?: string; sty
|
||||
<Show.Case when={listData.length === 0}>
|
||||
<div className="px-4 py-2">
|
||||
<div className="w-full overflow-hidden">
|
||||
<div className="text-xs leading-relaxed text-stone-400">{loadError ? `> ${unwrapErrMsg(loadError)}` : "> no logs avaiable"}</div>
|
||||
<div className="text-xs/relaxed text-stone-400">{loadError ? `> ${unwrapErrMsg(loadError)}` : "> no logs avaiable"}</div>
|
||||
</div>
|
||||
<div className="flex w-full items-center">
|
||||
<a onClick={handleReloadClick}>
|
||||
@@ -154,7 +154,7 @@ const SettingsDiagnosticsLogs = ({ className, style }: { className?: string; sty
|
||||
<div className="flex w-full flex-col overflow-hidden">
|
||||
{listData.map((record) => {
|
||||
return (
|
||||
<div key={record.id} className="text-xs leading-relaxed">
|
||||
<div key={record.id} className="text-xs/relaxed">
|
||||
{renderLogRecord(record)}
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -109,14 +109,14 @@ const WorkflowDetail = () => {
|
||||
return (
|
||||
<div className="flex size-full flex-col">
|
||||
<div className="px-6 py-4" ref={divHeaderRef}>
|
||||
<div className="relative z-11 container flex justify-between gap-4 not-md:flex-wrap">
|
||||
<div className="container relative z-11 flex justify-between gap-4 not-md:flex-wrap">
|
||||
<div className="flex-1 not-md:w-full not-md:flex-none">
|
||||
<WorkflowDetailBaseName />
|
||||
<WorkflowDetailBaseDescription />
|
||||
|
||||
<div className="absolute -bottom-12 left-1/2 z-1 -translate-x-1/2">
|
||||
<Segmented
|
||||
className="shadow"
|
||||
className="shadow-sm"
|
||||
options={tabs.map(([key, label, icon]) => ({
|
||||
value: key,
|
||||
label: <span className="px-2 text-sm">{t(label)}</span>,
|
||||
|
||||
@@ -2,17 +2,20 @@ import { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useNavigate, useSearchParams } from "react-router-dom";
|
||||
import { IconCirclePlus, IconCopy, IconDots, IconEdit, IconHierarchy3, IconPlayerPlay, IconPlus, IconReload, IconTrash } from "@tabler/icons-react";
|
||||
import { useRequest } from "ahooks";
|
||||
import { App, Button, Dropdown, Input, Segmented, Skeleton, Switch, Table, type TableProps, Typography, theme } from "antd";
|
||||
import { useControllableValue, useRequest } from "ahooks";
|
||||
import { App, Button, Dropdown, Form, Input, Segmented, Skeleton, Switch, Table, type TableProps, Typography, theme } from "antd";
|
||||
import { createSchemaFieldRule } from "antd-zod";
|
||||
import dayjs from "dayjs";
|
||||
import { ClientResponseError } from "pocketbase";
|
||||
import { z } from "zod";
|
||||
|
||||
import { startRun as startWorkflowRun } from "@/api/workflows";
|
||||
import DrawerForm from "@/components/DrawerForm";
|
||||
import Empty from "@/components/Empty";
|
||||
import Show from "@/components/Show";
|
||||
import WorkflowStatus from "@/components/workflow/WorkflowStatus";
|
||||
import { WORKFLOW_TRIGGERS, type WorkflowModel, duplicateNodes } from "@/domain/workflow";
|
||||
import { useAppSettings } from "@/hooks";
|
||||
import { useAntdForm, useAppSettings } from "@/hooks";
|
||||
import { get as getWorkflow, list as listWorkflows, remove as removeWorkflow, save as saveWorkflow } from "@/repository/workflow";
|
||||
import { unwrapErrMsg } from "@/utils/error";
|
||||
|
||||
@@ -287,6 +290,9 @@ const WorkflowList = () => {
|
||||
}
|
||||
);
|
||||
|
||||
const [duplicateDrawerOpen, setDuplicateDrawerOpen] = useState(false);
|
||||
const [duplicateDrawerData, setDuplicateDrawerData] = useState<Nullish<WorkflowModel>>();
|
||||
|
||||
const handleSearch = (value: string) => {
|
||||
setFilters((prev) => ({ ...prev, keyword: value.trim() }));
|
||||
setPage(1);
|
||||
@@ -350,30 +356,16 @@ const WorkflowList = () => {
|
||||
}
|
||||
};
|
||||
|
||||
const handleRecordDuplicateClick = (workflow: WorkflowModel) => {
|
||||
modal.confirm({
|
||||
title: t("workflow.action.duplicate.modal.title", { name: workflow.name }),
|
||||
content: t("workflow.action.duplicate.modal.content"),
|
||||
onOk: async () => {
|
||||
try {
|
||||
workflow = await getWorkflow(workflow.id);
|
||||
const workflowCopy = {
|
||||
name: `${workflow.name}-copy`,
|
||||
description: workflow.description,
|
||||
trigger: workflow.trigger,
|
||||
triggerCron: workflow.triggerCron,
|
||||
graphDraft: { nodes: duplicateNodes(workflow.graphDraft?.nodes ?? [], { withCopySuffix: false }) },
|
||||
hasDraft: true,
|
||||
} as WorkflowModel;
|
||||
const resp = await saveWorkflow(workflowCopy);
|
||||
if (resp) {
|
||||
refreshData();
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
notification.error({ title: t("common.text.request_error"), description: unwrapErrMsg(err) });
|
||||
}
|
||||
},
|
||||
const handleRecordDuplicateClick = async (workflow: WorkflowModel) => {
|
||||
const data = await getWorkflow(workflow.id);
|
||||
setDuplicateDrawerOpen(true);
|
||||
setDuplicateDrawerData({
|
||||
name: `${data.name}-copy`,
|
||||
description: data.description,
|
||||
trigger: data.trigger,
|
||||
triggerCron: data.triggerCron,
|
||||
graphDraft: { nodes: duplicateNodes(data.graphDraft?.nodes ?? [], { withCopySuffix: false }) },
|
||||
hasDraft: true,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -435,6 +427,18 @@ const WorkflowList = () => {
|
||||
});
|
||||
};
|
||||
|
||||
const handleDuplicateDrawerSubmit = async (values: Nullish<WorkflowModel>) => {
|
||||
try {
|
||||
const resp = await saveWorkflow(values);
|
||||
if (resp) {
|
||||
refreshData();
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
notification.error({ title: t("common.text.request_error"), description: unwrapErrMsg(err) });
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="px-6 py-4">
|
||||
<div className="container">
|
||||
@@ -547,10 +551,86 @@ const WorkflowList = () => {
|
||||
</div>
|
||||
</div>
|
||||
</Show>
|
||||
|
||||
<InternalDuplicateDrawer
|
||||
data={duplicateDrawerData}
|
||||
open={duplicateDrawerOpen}
|
||||
afterClose={() => setDuplicateDrawerOpen(false)}
|
||||
onOpenChange={(open) => setDuplicateDrawerOpen(open)}
|
||||
onSubmit={handleDuplicateDrawerSubmit}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const InternalDuplicateDrawer = ({
|
||||
data,
|
||||
trigger,
|
||||
onSubmit,
|
||||
...props
|
||||
}: {
|
||||
afterClose?: () => void;
|
||||
data?: Nullish<WorkflowModel>;
|
||||
open: boolean;
|
||||
trigger?: React.ReactNode;
|
||||
onOpenChange?: (open: boolean) => void;
|
||||
onSubmit?: (record: Nullish<WorkflowModel>) => void;
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const [open, setOpen] = useControllableValue<boolean>(props, {
|
||||
valuePropName: "open",
|
||||
defaultValuePropName: "defaultOpen",
|
||||
trigger: "onOpenChange",
|
||||
});
|
||||
|
||||
const afterClose = () => {
|
||||
formInst.resetFields();
|
||||
props.afterClose?.();
|
||||
};
|
||||
|
||||
const formSchema = z.object({
|
||||
name: z.string().nonempty(t("workflow.detail.baseinfo.name.placeholder")),
|
||||
description: z.string().nullish(),
|
||||
});
|
||||
const formRule = createSchemaFieldRule(formSchema);
|
||||
const { form: formInst, formProps } = useAntdForm<z.infer<typeof formSchema>>({
|
||||
name: "viewWorkflowList_InternalDuplicateDrawer",
|
||||
initialValues: data,
|
||||
});
|
||||
|
||||
const handleFormFinish = async (values: z.infer<typeof formSchema>) => {
|
||||
await onSubmit?.(values);
|
||||
setOpen(false);
|
||||
};
|
||||
|
||||
return (
|
||||
<DrawerForm
|
||||
{...formProps}
|
||||
clearOnDestroy
|
||||
drawerProps={{ autoFocus: true, destroyOnHidden: true, size: "large", afterOpenChange: (open) => !open && afterClose?.() }}
|
||||
form={formInst}
|
||||
layout="vertical"
|
||||
okText={t("common.button.create")}
|
||||
open={open}
|
||||
preserve={false}
|
||||
title={t("workflow.action.create.modal.title")}
|
||||
trigger={trigger}
|
||||
validateTrigger="onSubmit"
|
||||
onFinish={handleFormFinish}
|
||||
onOpenChange={props.onOpenChange}
|
||||
>
|
||||
<Form.Item name="name" label={t("workflow.detail.baseinfo.name.label")} rules={[formRule]}>
|
||||
<Input maxLength={100} placeholder={t("workflow.detail.baseinfo.name.placeholder")} />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item name="description" label={t("workflow.detail.baseinfo.description.label")} rules={[formRule]}>
|
||||
<Input placeholder={t("workflow.detail.baseinfo.name.placeholder")} />
|
||||
</Form.Item>
|
||||
</DrawerForm>
|
||||
);
|
||||
};
|
||||
|
||||
export default WorkflowList;
|
||||
|
||||
Reference in New Issue
Block a user