refactor: clean code
This commit is contained in:
@@ -3,10 +3,10 @@ import { Form, type FormInstance, Input, Select } from "antd";
|
||||
import { createSchemaFieldRule } from "antd-zod";
|
||||
import { z } from "zod";
|
||||
|
||||
import { type ACMEHttpReqAccessConfig } from "@/domain/access";
|
||||
import { type AccessConfigForACMEHttpReq } from "@/domain/access";
|
||||
import { useAntdForm } from "@/hooks";
|
||||
|
||||
type AccessEditFormACMEHttpReqConfigFieldValues = Partial<ACMEHttpReqAccessConfig>;
|
||||
type AccessEditFormACMEHttpReqConfigFieldValues = Partial<AccessConfigForACMEHttpReq>;
|
||||
|
||||
export type AccessEditFormACMEHttpReqConfigProps = {
|
||||
form: FormInstance;
|
||||
|
||||
@@ -3,10 +3,10 @@ import { Form, type FormInstance, Input } from "antd";
|
||||
import { createSchemaFieldRule } from "antd-zod";
|
||||
import { z } from "zod";
|
||||
|
||||
import { type AWSAccessConfig } from "@/domain/access";
|
||||
import { type AccessConfigForAWS } from "@/domain/access";
|
||||
import { useAntdForm } from "@/hooks";
|
||||
|
||||
type AccessEditFormAWSConfigFieldValues = Partial<AWSAccessConfig>;
|
||||
type AccessEditFormAWSConfigFieldValues = Partial<AccessConfigForAWS>;
|
||||
|
||||
export type AccessEditFormAWSConfigProps = {
|
||||
form: FormInstance;
|
||||
|
||||
@@ -3,10 +3,10 @@ import { Form, type FormInstance, Input } from "antd";
|
||||
import { createSchemaFieldRule } from "antd-zod";
|
||||
import { z } from "zod";
|
||||
|
||||
import { type AliyunAccessConfig } from "@/domain/access";
|
||||
import { type AccessConfigForAliyun } from "@/domain/access";
|
||||
import { useAntdForm } from "@/hooks";
|
||||
|
||||
type AccessEditFormAliyunConfigFieldValues = Partial<AliyunAccessConfig>;
|
||||
type AccessEditFormAliyunConfigFieldValues = Partial<AccessConfigForAliyun>;
|
||||
|
||||
export type AccessEditFormAliyunConfigProps = {
|
||||
form: FormInstance;
|
||||
|
||||
@@ -3,10 +3,10 @@ import { Form, type FormInstance, Input } from "antd";
|
||||
import { createSchemaFieldRule } from "antd-zod";
|
||||
import { z } from "zod";
|
||||
|
||||
import { type BaiduCloudAccessConfig } from "@/domain/access";
|
||||
import { type AccessConfigForBaiduCloud } from "@/domain/access";
|
||||
import { useAntdForm } from "@/hooks";
|
||||
|
||||
type AccessEditFormBaiduCloudConfigFieldValues = Partial<BaiduCloudAccessConfig>;
|
||||
type AccessEditFormBaiduCloudConfigFieldValues = Partial<AccessConfigForBaiduCloud>;
|
||||
|
||||
export type AccessEditFormBaiduCloudConfigProps = {
|
||||
form: FormInstance;
|
||||
|
||||
@@ -3,10 +3,10 @@ import { Form, type FormInstance, Input } from "antd";
|
||||
import { createSchemaFieldRule } from "antd-zod";
|
||||
import { z } from "zod";
|
||||
|
||||
import { type BytePlusAccessConfig } from "@/domain/access";
|
||||
import { type AccessConfigForBytePlus } from "@/domain/access";
|
||||
import { useAntdForm } from "@/hooks";
|
||||
|
||||
type AccessEditFormBytePlusConfigFieldValues = Partial<BytePlusAccessConfig>;
|
||||
type AccessEditFormBytePlusConfigFieldValues = Partial<AccessConfigForBytePlus>;
|
||||
|
||||
export type AccessEditFormBytePlusConfigProps = {
|
||||
form: FormInstance;
|
||||
|
||||
@@ -3,10 +3,10 @@ import { Form, type FormInstance, Input } from "antd";
|
||||
import { createSchemaFieldRule } from "antd-zod";
|
||||
import { z } from "zod";
|
||||
|
||||
import { type CloudflareAccessConfig } from "@/domain/access";
|
||||
import { type AccessConfigForCloudflare } from "@/domain/access";
|
||||
import { useAntdForm } from "@/hooks";
|
||||
|
||||
type AccessEditFormCloudflareConfigFieldValues = Partial<CloudflareAccessConfig>;
|
||||
type AccessEditFormCloudflareConfigFieldValues = Partial<AccessConfigForCloudflare>;
|
||||
|
||||
export type AccessEditFormCloudflareConfigProps = {
|
||||
form: FormInstance;
|
||||
|
||||
@@ -3,10 +3,10 @@ import { Form, type FormInstance, Input } from "antd";
|
||||
import { createSchemaFieldRule } from "antd-zod";
|
||||
import { z } from "zod";
|
||||
|
||||
import { type DogeCloudAccessConfig } from "@/domain/access";
|
||||
import { type AccessConfigForDogeCloud } from "@/domain/access";
|
||||
import { useAntdForm } from "@/hooks";
|
||||
|
||||
type AccessEditFormDogeCloudConfigFieldValues = Partial<DogeCloudAccessConfig>;
|
||||
type AccessEditFormDogeCloudConfigFieldValues = Partial<AccessConfigForDogeCloud>;
|
||||
|
||||
export type AccessEditFormDogeCloudConfigProps = {
|
||||
form: FormInstance;
|
||||
|
||||
@@ -3,10 +3,10 @@ import { Form, type FormInstance, Input } from "antd";
|
||||
import { createSchemaFieldRule } from "antd-zod";
|
||||
import { z } from "zod";
|
||||
|
||||
import { type GoDaddyAccessConfig } from "@/domain/access";
|
||||
import { type AccessConfigForGoDaddy } from "@/domain/access";
|
||||
import { useAntdForm } from "@/hooks";
|
||||
|
||||
type AccessEditFormGoDaddyConfigFieldValues = Partial<GoDaddyAccessConfig>;
|
||||
type AccessEditFormGoDaddyConfigFieldValues = Partial<AccessConfigForGoDaddy>;
|
||||
|
||||
export type AccessEditFormGoDaddyConfigProps = {
|
||||
form: FormInstance;
|
||||
|
||||
@@ -3,10 +3,10 @@ import { Form, type FormInstance, Input } from "antd";
|
||||
import { createSchemaFieldRule } from "antd-zod";
|
||||
import { z } from "zod";
|
||||
|
||||
import { type HuaweiCloudAccessConfig } from "@/domain/access";
|
||||
import { type AccessConfigForHuaweiCloud } from "@/domain/access";
|
||||
import { useAntdForm } from "@/hooks";
|
||||
|
||||
type AccessEditFormHuaweiCloudConfigFieldValues = Partial<HuaweiCloudAccessConfig>;
|
||||
type AccessEditFormHuaweiCloudConfigFieldValues = Partial<AccessConfigForHuaweiCloud>;
|
||||
|
||||
export type AccessEditFormHuaweiCloudConfigProps = {
|
||||
form: FormInstance;
|
||||
|
||||
@@ -7,11 +7,11 @@ import { Button, Form, type FormInstance, Input, Upload, type UploadFile, type U
|
||||
import { createSchemaFieldRule } from "antd-zod";
|
||||
import { z } from "zod";
|
||||
|
||||
import { type KubernetesAccessConfig } from "@/domain/access";
|
||||
import { type AccessConfigForKubernetes } from "@/domain/access";
|
||||
import { useAntdForm } from "@/hooks";
|
||||
import { readFileContent } from "@/utils/file";
|
||||
|
||||
type AccessEditFormKubernetesConfigFieldValues = Partial<KubernetesAccessConfig>;
|
||||
type AccessEditFormKubernetesConfigFieldValues = Partial<AccessConfigForKubernetes>;
|
||||
|
||||
export type AccessEditFormKubernetesConfigProps = {
|
||||
form: FormInstance;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Form, type FormInstance } from "antd";
|
||||
|
||||
import { type LocalAccessConfig } from "@/domain/access";
|
||||
import { type AccessConfigForLocal } from "@/domain/access";
|
||||
import { useAntdForm } from "@/hooks";
|
||||
|
||||
type AccessEditFormLocalConfigFieldValues = Partial<LocalAccessConfig>;
|
||||
type AccessEditFormLocalConfigFieldValues = Partial<AccessConfigForLocal>;
|
||||
|
||||
export type AccessEditFormLocalConfigProps = {
|
||||
form: FormInstance;
|
||||
|
||||
@@ -3,10 +3,10 @@ import { Form, type FormInstance, Input } from "antd";
|
||||
import { createSchemaFieldRule } from "antd-zod";
|
||||
import { z } from "zod";
|
||||
|
||||
import { type NameDotComAccessConfig } from "@/domain/access";
|
||||
import { type AccessConfigForNameDotCom } from "@/domain/access";
|
||||
import { useAntdForm } from "@/hooks";
|
||||
|
||||
type AccessEditFormNameDotComConfigFieldValues = Partial<NameDotComAccessConfig>;
|
||||
type AccessEditFormNameDotComConfigFieldValues = Partial<AccessConfigForNameDotCom>;
|
||||
|
||||
export type AccessEditFormNameDotComConfigProps = {
|
||||
form: FormInstance;
|
||||
|
||||
@@ -3,10 +3,10 @@ import { Form, type FormInstance, Input } from "antd";
|
||||
import { createSchemaFieldRule } from "antd-zod";
|
||||
import { z } from "zod";
|
||||
|
||||
import { type NameSiloAccessConfig } from "@/domain/access";
|
||||
import { type AccessConfigForNameSilo } from "@/domain/access";
|
||||
import { useAntdForm } from "@/hooks";
|
||||
|
||||
type AccessEditFormNameSiloConfigFieldValues = Partial<NameSiloAccessConfig>;
|
||||
type AccessEditFormNameSiloConfigFieldValues = Partial<AccessConfigForNameSilo>;
|
||||
|
||||
export type AccessEditFormNameSiloConfigProps = {
|
||||
form: FormInstance;
|
||||
|
||||
@@ -3,10 +3,10 @@ import { Form, type FormInstance, Input } from "antd";
|
||||
import { createSchemaFieldRule } from "antd-zod";
|
||||
import { z } from "zod";
|
||||
|
||||
import { type PowerDNSAccessConfig } from "@/domain/access";
|
||||
import { type AccessConfigForPowerDNS } from "@/domain/access";
|
||||
import { useAntdForm } from "@/hooks";
|
||||
|
||||
type AccessEditFormPowerDNSConfigFieldValues = Partial<PowerDNSAccessConfig>;
|
||||
type AccessEditFormPowerDNSConfigFieldValues = Partial<AccessConfigForPowerDNS>;
|
||||
|
||||
export type AccessEditFormPowerDNSConfigProps = {
|
||||
form: FormInstance;
|
||||
|
||||
@@ -3,10 +3,10 @@ import { Form, type FormInstance, Input } from "antd";
|
||||
import { createSchemaFieldRule } from "antd-zod";
|
||||
import { z } from "zod";
|
||||
|
||||
import { type QiniuAccessConfig } from "@/domain/access";
|
||||
import { type AccessConfigForQiniu } from "@/domain/access";
|
||||
import { useAntdForm } from "@/hooks";
|
||||
|
||||
type AccessEditFormQiniuConfigFieldValues = Partial<QiniuAccessConfig>;
|
||||
type AccessEditFormQiniuConfigFieldValues = Partial<AccessConfigForQiniu>;
|
||||
|
||||
export type AccessEditFormQiniuConfigProps = {
|
||||
form: FormInstance;
|
||||
|
||||
@@ -7,12 +7,12 @@ import { Button, Form, type FormInstance, Input, InputNumber, Upload, type Uploa
|
||||
import { createSchemaFieldRule } from "antd-zod";
|
||||
import { z } from "zod";
|
||||
|
||||
import { type SSHAccessConfig } from "@/domain/access";
|
||||
import { type AccessConfigForSSH } from "@/domain/access";
|
||||
import { useAntdForm } from "@/hooks";
|
||||
import { readFileContent } from "@/utils/file";
|
||||
import { validDomainName, validIPv4Address, validIPv6Address } from "@/utils/validators";
|
||||
|
||||
type AccessEditFormSSHConfigFieldValues = Partial<SSHAccessConfig>;
|
||||
type AccessEditFormSSHConfigFieldValues = Partial<AccessConfigForSSH>;
|
||||
|
||||
export type AccessEditFormSSHConfigProps = {
|
||||
form: FormInstance;
|
||||
|
||||
@@ -3,10 +3,10 @@ import { Form, type FormInstance, Input } from "antd";
|
||||
import { createSchemaFieldRule } from "antd-zod";
|
||||
import { z } from "zod";
|
||||
|
||||
import { type TencentCloudAccessConfig } from "@/domain/access";
|
||||
import { type AccessConfigForTencentCloud } from "@/domain/access";
|
||||
import { useAntdForm } from "@/hooks";
|
||||
|
||||
type AccessEditFormTencentCloudConfigFieldValues = Partial<TencentCloudAccessConfig>;
|
||||
type AccessEditFormTencentCloudConfigFieldValues = Partial<AccessConfigForTencentCloud>;
|
||||
|
||||
export type AccessEditFormTencentCloudConfigProps = {
|
||||
form: FormInstance;
|
||||
|
||||
@@ -3,10 +3,10 @@ import { Form, type FormInstance, Input } from "antd";
|
||||
import { createSchemaFieldRule } from "antd-zod";
|
||||
import { z } from "zod";
|
||||
|
||||
import { type VolcEngineAccessConfig } from "@/domain/access";
|
||||
import { type AccessConfigForVolcEngine } from "@/domain/access";
|
||||
import { useAntdForm } from "@/hooks";
|
||||
|
||||
type AccessEditFormVolcEngineConfigFieldValues = Partial<VolcEngineAccessConfig>;
|
||||
type AccessEditFormVolcEngineConfigFieldValues = Partial<AccessConfigForVolcEngine>;
|
||||
|
||||
export type AccessEditFormVolcEngineConfigProps = {
|
||||
form: FormInstance;
|
||||
|
||||
@@ -3,10 +3,10 @@ import { Form, type FormInstance, Input } from "antd";
|
||||
import { createSchemaFieldRule } from "antd-zod";
|
||||
import { z } from "zod";
|
||||
|
||||
import { type WebhookAccessConfig } from "@/domain/access";
|
||||
import { type AccessConfigForWebhook } from "@/domain/access";
|
||||
import { useAntdForm } from "@/hooks";
|
||||
|
||||
type AccessEditFormWebhookConfigFieldValues = Partial<WebhookAccessConfig>;
|
||||
type AccessEditFormWebhookConfigFieldValues = Partial<AccessConfigForWebhook>;
|
||||
|
||||
export type AccessEditFormWebhookConfigProps = {
|
||||
form: FormInstance;
|
||||
|
||||
@@ -96,16 +96,14 @@ const CertificateDetail = ({ data, ...props }: CertificateDetailProps) => {
|
||||
key: "PFX",
|
||||
label: "PFX",
|
||||
onClick: () => {
|
||||
// TODO: 下载 PFX 格式证书
|
||||
alert("TODO");
|
||||
alert("TODO: 暂时不支持下载 PFX 证书");
|
||||
},
|
||||
},
|
||||
{
|
||||
key: "JKS",
|
||||
label: "JKS",
|
||||
onClick: () => {
|
||||
// TODO: 下载 JKS 格式证书
|
||||
alert("TODO");
|
||||
alert("TODO: 暂时不支持下载 JKS 证书");
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
@@ -9,10 +9,10 @@ import { notifyChannelsMap } from "@/domain/settings";
|
||||
import {
|
||||
WORKFLOW_TRIGGERS,
|
||||
type WorkflowNode,
|
||||
type WorkflowNodeConfigAsApply,
|
||||
type WorkflowNodeConfigAsDeploy,
|
||||
type WorkflowNodeConfigAsNotify,
|
||||
type WorkflowNodeConfigAsStart,
|
||||
type WorkflowNodeConfigForApply,
|
||||
type WorkflowNodeConfigForDeploy,
|
||||
type WorkflowNodeConfigForNotify,
|
||||
type WorkflowNodeConfigForStart,
|
||||
WorkflowNodeType,
|
||||
} from "@/domain/workflow";
|
||||
import { useZustandShallowSelector } from "@/hooks";
|
||||
@@ -40,7 +40,7 @@ const WorkflowElement = ({ node, disabled }: NodeProps) => {
|
||||
|
||||
switch (node.type) {
|
||||
case WorkflowNodeType.Start: {
|
||||
const config = (node.config as WorkflowNodeConfigAsStart) ?? {};
|
||||
const config = (node.config as WorkflowNodeConfigForStart) ?? {};
|
||||
return (
|
||||
<div className="flex items-center justify-between space-x-2">
|
||||
<Typography.Text className="truncate">
|
||||
@@ -58,12 +58,12 @@ const WorkflowElement = ({ node, disabled }: NodeProps) => {
|
||||
}
|
||||
|
||||
case WorkflowNodeType.Apply: {
|
||||
const config = (node.config as WorkflowNodeConfigAsApply) ?? {};
|
||||
const config = (node.config as WorkflowNodeConfigForApply) ?? {};
|
||||
return <Typography.Text className="truncate">{config.domains || " "}</Typography.Text>;
|
||||
}
|
||||
|
||||
case WorkflowNodeType.Deploy: {
|
||||
const config = (node.config as WorkflowNodeConfigAsDeploy) ?? {};
|
||||
const config = (node.config as WorkflowNodeConfigForDeploy) ?? {};
|
||||
const provider = deployProvidersMap.get(config.provider);
|
||||
return (
|
||||
<Space>
|
||||
@@ -74,7 +74,7 @@ const WorkflowElement = ({ node, disabled }: NodeProps) => {
|
||||
}
|
||||
|
||||
case WorkflowNodeType.Notify: {
|
||||
const config = (node.config as WorkflowNodeConfigAsNotify) ?? {};
|
||||
const config = (node.config as WorkflowNodeConfigForNotify) ?? {};
|
||||
const channel = notifyChannelsMap.get(config.channel as string);
|
||||
return (
|
||||
<div className="flex items-center justify-between space-x-2">
|
||||
|
||||
@@ -12,7 +12,7 @@ import MultipleInput from "@/components/MultipleInput";
|
||||
import AccessEditModal from "@/components/access/AccessEditModal";
|
||||
import AccessSelect from "@/components/access/AccessSelect";
|
||||
import { ACCESS_USAGES, accessProvidersMap } from "@/domain/provider";
|
||||
import { type WorkflowNode, type WorkflowNodeConfigAsApply } from "@/domain/workflow";
|
||||
import { type WorkflowNode, type WorkflowNodeConfigForApply } from "@/domain/workflow";
|
||||
import { useAntdForm, useZustandShallowSelector } from "@/hooks";
|
||||
import { useAccessesStore } from "@/stores/access";
|
||||
import { useContactEmailsStore } from "@/stores/contact";
|
||||
@@ -26,7 +26,7 @@ export type ApplyNodeFormProps = {
|
||||
|
||||
const MULTIPLE_INPUT_DELIMITER = ";";
|
||||
|
||||
const initFormModel = (): Partial<WorkflowNodeConfigAsApply> => {
|
||||
const initFormModel = (): Partial<WorkflowNodeConfigForApply> => {
|
||||
return {
|
||||
keyAlgorithm: "RSA2048",
|
||||
propagationTimeout: 60,
|
||||
@@ -76,7 +76,7 @@ const ApplyNodeForm = ({ node }: ApplyNodeFormProps) => {
|
||||
formPending,
|
||||
formProps,
|
||||
} = useAntdForm<z.infer<typeof formSchema>>({
|
||||
initialValues: (node?.config as WorkflowNodeConfigAsApply) ?? initFormModel(),
|
||||
initialValues: (node?.config as WorkflowNodeConfigForApply) ?? initFormModel(),
|
||||
onSubmit: async (values) => {
|
||||
await formInst.validateFields();
|
||||
await addEmail(values.contactEmail);
|
||||
@@ -85,7 +85,7 @@ const ApplyNodeForm = ({ node }: ApplyNodeFormProps) => {
|
||||
draft.config = {
|
||||
provider: accesses.find((e) => e.id === values.providerAccessId)?.provider,
|
||||
...values,
|
||||
} as WorkflowNodeConfigAsApply;
|
||||
} as WorkflowNodeConfigForApply;
|
||||
draft.validated = true;
|
||||
})
|
||||
);
|
||||
|
||||
@@ -12,7 +12,7 @@ import AccessSelect from "@/components/access/AccessSelect";
|
||||
import DeployProviderPicker from "@/components/provider/DeployProviderPicker";
|
||||
import DeployProviderSelect from "@/components/provider/DeployProviderSelect";
|
||||
import { ACCESS_USAGES, DEPLOY_PROVIDERS, accessProvidersMap, deployProvidersMap } from "@/domain/provider";
|
||||
import { type WorkflowNode, type WorkflowNodeConfigAsDeploy } from "@/domain/workflow";
|
||||
import { type WorkflowNode, type WorkflowNodeConfigForDeploy } from "@/domain/workflow";
|
||||
import { useAntdForm, useZustandShallowSelector } from "@/hooks";
|
||||
import { useWorkflowStore } from "@/stores/workflow";
|
||||
import { usePanel } from "../PanelProvider";
|
||||
@@ -44,7 +44,7 @@ export type DeployFormProps = {
|
||||
node: WorkflowNode;
|
||||
};
|
||||
|
||||
const initFormModel = (): Partial<WorkflowNodeConfigAsDeploy> => {
|
||||
const initFormModel = (): Partial<WorkflowNodeConfigForDeploy> => {
|
||||
return {};
|
||||
};
|
||||
|
||||
@@ -67,7 +67,7 @@ const DeployNodeForm = ({ node }: DeployFormProps) => {
|
||||
formPending,
|
||||
formProps,
|
||||
} = useAntdForm<z.infer<typeof formSchema>>({
|
||||
initialValues: (node?.config as WorkflowNodeConfigAsDeploy) ?? initFormModel(),
|
||||
initialValues: (node?.config as WorkflowNodeConfigForDeploy) ?? initFormModel(),
|
||||
onSubmit: async (values) => {
|
||||
await formInst.validateFields();
|
||||
await updateNode(
|
||||
|
||||
@@ -8,7 +8,7 @@ import { produce } from "immer";
|
||||
import { z } from "zod";
|
||||
|
||||
import { notifyChannelsMap } from "@/domain/settings";
|
||||
import { type WorkflowNode, type WorkflowNodeConfigAsNotify } from "@/domain/workflow";
|
||||
import { type WorkflowNode, type WorkflowNodeConfigForNotify } from "@/domain/workflow";
|
||||
import { useAntdForm, useZustandShallowSelector } from "@/hooks";
|
||||
import { useNotifyChannelsStore } from "@/stores/notify";
|
||||
import { useWorkflowStore } from "@/stores/workflow";
|
||||
@@ -18,7 +18,7 @@ export type NotifyNodeFormProps = {
|
||||
node: WorkflowNode;
|
||||
};
|
||||
|
||||
const initFormModel = (): Partial<WorkflowNodeConfigAsNotify> => {
|
||||
const initFormModel = (): Partial<WorkflowNodeConfigForNotify> => {
|
||||
return {
|
||||
subject: "Completed!",
|
||||
message: "Your workflow has been completed on Certimate.",
|
||||
@@ -57,7 +57,7 @@ const NotifyNodeForm = ({ node }: NotifyNodeFormProps) => {
|
||||
formPending,
|
||||
formProps,
|
||||
} = useAntdForm<z.infer<typeof formSchema>>({
|
||||
initialValues: (node?.config as WorkflowNodeConfigAsNotify) ?? initFormModel(),
|
||||
initialValues: (node?.config as WorkflowNodeConfigForNotify) ?? initFormModel(),
|
||||
onSubmit: async (values) => {
|
||||
await formInst.validateFields();
|
||||
await updateNode(
|
||||
|
||||
@@ -7,7 +7,7 @@ import { produce } from "immer";
|
||||
import { z } from "zod";
|
||||
|
||||
import Show from "@/components/Show";
|
||||
import { WORKFLOW_TRIGGERS, type WorkflowNode, type WorkflowNodeConfigAsStart } from "@/domain/workflow";
|
||||
import { WORKFLOW_TRIGGERS, type WorkflowNode, type WorkflowNodeConfigForStart } from "@/domain/workflow";
|
||||
import { useAntdForm, useZustandShallowSelector } from "@/hooks";
|
||||
import { useWorkflowStore } from "@/stores/workflow";
|
||||
import { getNextCronExecutions, validCronExpression } from "@/utils/cron";
|
||||
@@ -17,7 +17,7 @@ export type StartNodeFormProps = {
|
||||
node: WorkflowNode;
|
||||
};
|
||||
|
||||
const initFormModel = (): WorkflowNodeConfigAsStart => {
|
||||
const initFormModel = (): WorkflowNodeConfigForStart => {
|
||||
return {
|
||||
trigger: WORKFLOW_TRIGGERS.AUTO,
|
||||
triggerCron: "0 0 * * *",
|
||||
@@ -54,7 +54,7 @@ const StartNodeForm = ({ node }: StartNodeFormProps) => {
|
||||
formPending,
|
||||
formProps,
|
||||
} = useAntdForm<z.infer<typeof formSchema>>({
|
||||
initialValues: (node?.config as WorkflowNodeConfigAsStart) ?? initFormModel(),
|
||||
initialValues: (node?.config as WorkflowNodeConfigForStart) ?? initFormModel(),
|
||||
onSubmit: async (values) => {
|
||||
await formInst.validateFields();
|
||||
await updateNode(
|
||||
|
||||
Reference in New Issue
Block a user