From b6dd2248c8a017158ffe4f1fd817df7f6e20f82e Mon Sep 17 00:00:00 2001 From: Fu Diwei Date: Thu, 2 Jan 2025 12:50:38 +0800 Subject: [PATCH] style(ui): eslint-sort-imports --- ui/.eslintrc.cjs | 6 ++ ui/src/App.tsx | 2 +- ui/src/components/access/AccessEditForm.tsx | 2 +- .../AccessEditFormACMEHttpReqConfig.tsx | 2 +- .../access/AccessEditFormAWSConfig.tsx | 2 +- .../access/AccessEditFormAliyunConfig.tsx | 2 +- .../access/AccessEditFormBaiduCloudConfig.tsx | 2 +- .../access/AccessEditFormBytePlusConfig.tsx | 2 +- .../access/AccessEditFormCloudflareConfig.tsx | 2 +- .../access/AccessEditFormDogeCloudConfig.tsx | 2 +- .../access/AccessEditFormGoDaddyConfig.tsx | 2 +- .../AccessEditFormHuaweiCloudConfig.tsx | 2 +- .../access/AccessEditFormKubernetesConfig.tsx | 2 +- .../access/AccessEditFormNameDotComConfig.tsx | 2 +- .../access/AccessEditFormNameSiloConfig.tsx | 2 +- .../access/AccessEditFormPowerDNSConfig.tsx | 2 +- .../access/AccessEditFormQiniuConfig.tsx | 2 +- .../access/AccessEditFormSSHConfig.tsx | 2 +- .../AccessEditFormTencentCloudConfig.tsx | 2 +- .../access/AccessEditFormVolcEngineConfig.tsx | 2 +- .../access/AccessEditFormWebhookConfig.tsx | 2 +- .../access/AccessProviderSelect.tsx | 2 +- ui/src/components/access/AccessSelect.tsx | 2 +- .../certificate/CertificateDetail.tsx | 2 +- ui/src/components/core/DrawerForm.tsx | 2 +- ui/src/components/core/ModalForm.tsx | 2 +- ui/src/components/core/MultipleInput.tsx | 4 +- .../notification/NotifyChannels.tsx | 2 +- .../notification/NotifyTemplate.tsx | 4 +- .../notification/NotifyTestButton.tsx | 2 +- ui/src/components/workflow/NodeTypesPanel.tsx | 68 ------------------- .../workflow/node/ApplyNodeForm.tsx | 6 +- .../workflow/node/DeployNodeForm.tsx | 6 +- .../workflow/node/NotifyNodeForm.tsx | 4 +- .../workflow/node/StartNodeForm.tsx | 6 +- .../components/workflow/run/WorkflowRuns.tsx | 2 +- ui/src/global.d.ts | 6 +- ui/src/hooks/useTriggerElement.ts | 2 +- ui/src/hooks/useZustandShallowSelector.ts | 2 +- ui/src/pages/ConsoleLayout.tsx | 2 +- ui/src/pages/accesses/AccessList.tsx | 2 +- ui/src/pages/certificates/CertificateList.tsx | 4 +- ui/src/pages/dashboard/Dashboard.tsx | 2 +- ui/src/pages/settings/SettingsSSLProvider.tsx | 4 +- ui/src/pages/workflows/WorkflowDetail.tsx | 4 +- ui/src/pages/workflows/WorkflowList.tsx | 20 +++--- ui/src/router.tsx | 5 ++ ui/src/stores/access/index.ts | 2 +- ui/src/stores/contact/index.ts | 2 +- ui/src/stores/notify/index.ts | 2 +- ui/vite.config.ts | 2 +- 51 files changed, 84 insertions(+), 137 deletions(-) delete mode 100644 ui/src/components/workflow/NodeTypesPanel.tsx diff --git a/ui/.eslintrc.cjs b/ui/.eslintrc.cjs index 9b4cfc79..cd314274 100644 --- a/ui/.eslintrc.cjs +++ b/ui/.eslintrc.cjs @@ -86,6 +86,12 @@ module.exports = { allowConstantExport: true, }, ], + "sort-imports": [ + "error", + { + ignoreDeclarationSort: true, + }, + ], }, settings: { "import/resolver": { diff --git a/ui/src/App.tsx b/ui/src/App.tsx index 982bfe11..1a355b3b 100644 --- a/ui/src/App.tsx +++ b/ui/src/App.tsx @@ -1,7 +1,7 @@ import { useEffect, useLayoutEffect, useMemo, useState } from "react"; import { useTranslation } from "react-i18next"; import { RouterProvider } from "react-router-dom"; -import { App, ConfigProvider, theme, type ThemeConfig } from "antd"; +import { App, ConfigProvider, type ThemeConfig, theme } from "antd"; import { type Locale } from "antd/es/locale"; import AntdLocaleEnUs from "antd/locale/en_US"; import AntdLocaleZhCN from "antd/locale/zh_CN"; diff --git a/ui/src/components/access/AccessEditForm.tsx b/ui/src/components/access/AccessEditForm.tsx index 396405d0..a4eb78ca 100644 --- a/ui/src/components/access/AccessEditForm.tsx +++ b/ui/src/components/access/AccessEditForm.tsx @@ -1,7 +1,7 @@ import { forwardRef, useEffect, useImperativeHandle, useMemo, useState } from "react"; import { useTranslation } from "react-i18next"; import { useCreation } from "ahooks"; -import { Form, Input, type FormInstance } from "antd"; +import { Form, type FormInstance, Input } from "antd"; import { createSchemaFieldRule } from "antd-zod"; import { z } from "zod"; diff --git a/ui/src/components/access/AccessEditFormACMEHttpReqConfig.tsx b/ui/src/components/access/AccessEditFormACMEHttpReqConfig.tsx index 1c148273..b81f7fee 100644 --- a/ui/src/components/access/AccessEditFormACMEHttpReqConfig.tsx +++ b/ui/src/components/access/AccessEditFormACMEHttpReqConfig.tsx @@ -1,5 +1,5 @@ import { useTranslation } from "react-i18next"; -import { Form, Input, Select, type FormInstance } from "antd"; +import { Form, type FormInstance, Input, Select } from "antd"; import { createSchemaFieldRule } from "antd-zod"; import { z } from "zod"; diff --git a/ui/src/components/access/AccessEditFormAWSConfig.tsx b/ui/src/components/access/AccessEditFormAWSConfig.tsx index f9446452..8a7b5b89 100644 --- a/ui/src/components/access/AccessEditFormAWSConfig.tsx +++ b/ui/src/components/access/AccessEditFormAWSConfig.tsx @@ -1,5 +1,5 @@ import { useTranslation } from "react-i18next"; -import { Form, Input, type FormInstance } from "antd"; +import { Form, type FormInstance, Input } from "antd"; import { createSchemaFieldRule } from "antd-zod"; import { z } from "zod"; diff --git a/ui/src/components/access/AccessEditFormAliyunConfig.tsx b/ui/src/components/access/AccessEditFormAliyunConfig.tsx index 61f3b82d..b77aa9d3 100644 --- a/ui/src/components/access/AccessEditFormAliyunConfig.tsx +++ b/ui/src/components/access/AccessEditFormAliyunConfig.tsx @@ -1,5 +1,5 @@ import { useTranslation } from "react-i18next"; -import { Form, Input, type FormInstance } from "antd"; +import { Form, type FormInstance, Input } from "antd"; import { createSchemaFieldRule } from "antd-zod"; import { z } from "zod"; diff --git a/ui/src/components/access/AccessEditFormBaiduCloudConfig.tsx b/ui/src/components/access/AccessEditFormBaiduCloudConfig.tsx index 13f642f4..26f6523f 100644 --- a/ui/src/components/access/AccessEditFormBaiduCloudConfig.tsx +++ b/ui/src/components/access/AccessEditFormBaiduCloudConfig.tsx @@ -1,5 +1,5 @@ import { useTranslation } from "react-i18next"; -import { Form, Input, type FormInstance } from "antd"; +import { Form, type FormInstance, Input } from "antd"; import { createSchemaFieldRule } from "antd-zod"; import { z } from "zod"; diff --git a/ui/src/components/access/AccessEditFormBytePlusConfig.tsx b/ui/src/components/access/AccessEditFormBytePlusConfig.tsx index f37260c1..fc3e3e11 100644 --- a/ui/src/components/access/AccessEditFormBytePlusConfig.tsx +++ b/ui/src/components/access/AccessEditFormBytePlusConfig.tsx @@ -1,5 +1,5 @@ import { useTranslation } from "react-i18next"; -import { Form, Input, type FormInstance } from "antd"; +import { Form, type FormInstance, Input } from "antd"; import { createSchemaFieldRule } from "antd-zod"; import { z } from "zod"; diff --git a/ui/src/components/access/AccessEditFormCloudflareConfig.tsx b/ui/src/components/access/AccessEditFormCloudflareConfig.tsx index 06b36605..7c7ad2f1 100644 --- a/ui/src/components/access/AccessEditFormCloudflareConfig.tsx +++ b/ui/src/components/access/AccessEditFormCloudflareConfig.tsx @@ -1,5 +1,5 @@ import { useTranslation } from "react-i18next"; -import { Form, Input, type FormInstance } from "antd"; +import { Form, type FormInstance, Input } from "antd"; import { createSchemaFieldRule } from "antd-zod"; import { z } from "zod"; diff --git a/ui/src/components/access/AccessEditFormDogeCloudConfig.tsx b/ui/src/components/access/AccessEditFormDogeCloudConfig.tsx index d4121d8d..ffeae8b1 100644 --- a/ui/src/components/access/AccessEditFormDogeCloudConfig.tsx +++ b/ui/src/components/access/AccessEditFormDogeCloudConfig.tsx @@ -1,5 +1,5 @@ import { useTranslation } from "react-i18next"; -import { Form, Input, type FormInstance } from "antd"; +import { Form, type FormInstance, Input } from "antd"; import { createSchemaFieldRule } from "antd-zod"; import { z } from "zod"; diff --git a/ui/src/components/access/AccessEditFormGoDaddyConfig.tsx b/ui/src/components/access/AccessEditFormGoDaddyConfig.tsx index 09a14a19..364369c7 100644 --- a/ui/src/components/access/AccessEditFormGoDaddyConfig.tsx +++ b/ui/src/components/access/AccessEditFormGoDaddyConfig.tsx @@ -1,5 +1,5 @@ import { useTranslation } from "react-i18next"; -import { Form, Input, type FormInstance } from "antd"; +import { Form, type FormInstance, Input } from "antd"; import { createSchemaFieldRule } from "antd-zod"; import { z } from "zod"; diff --git a/ui/src/components/access/AccessEditFormHuaweiCloudConfig.tsx b/ui/src/components/access/AccessEditFormHuaweiCloudConfig.tsx index 2496c0fc..a38e860e 100644 --- a/ui/src/components/access/AccessEditFormHuaweiCloudConfig.tsx +++ b/ui/src/components/access/AccessEditFormHuaweiCloudConfig.tsx @@ -1,5 +1,5 @@ import { useTranslation } from "react-i18next"; -import { Form, Input, type FormInstance } from "antd"; +import { Form, type FormInstance, Input } from "antd"; import { createSchemaFieldRule } from "antd-zod"; import { z } from "zod"; diff --git a/ui/src/components/access/AccessEditFormKubernetesConfig.tsx b/ui/src/components/access/AccessEditFormKubernetesConfig.tsx index 87a964c7..4859f03a 100644 --- a/ui/src/components/access/AccessEditFormKubernetesConfig.tsx +++ b/ui/src/components/access/AccessEditFormKubernetesConfig.tsx @@ -3,7 +3,7 @@ import { flushSync } from "react-dom"; import { useTranslation } from "react-i18next"; import { UploadOutlined as UploadOutlinedIcon } from "@ant-design/icons"; import { useDeepCompareEffect } from "ahooks"; -import { Button, Form, Input, Upload, type FormInstance, type UploadFile, type UploadProps } from "antd"; +import { Button, Form, type FormInstance, Input, Upload, type UploadFile, type UploadProps } from "antd"; import { createSchemaFieldRule } from "antd-zod"; import { z } from "zod"; diff --git a/ui/src/components/access/AccessEditFormNameDotComConfig.tsx b/ui/src/components/access/AccessEditFormNameDotComConfig.tsx index 078377ea..a73a4e18 100644 --- a/ui/src/components/access/AccessEditFormNameDotComConfig.tsx +++ b/ui/src/components/access/AccessEditFormNameDotComConfig.tsx @@ -1,5 +1,5 @@ import { useTranslation } from "react-i18next"; -import { Form, Input, type FormInstance } from "antd"; +import { Form, type FormInstance, Input } from "antd"; import { createSchemaFieldRule } from "antd-zod"; import { z } from "zod"; diff --git a/ui/src/components/access/AccessEditFormNameSiloConfig.tsx b/ui/src/components/access/AccessEditFormNameSiloConfig.tsx index 165a1e64..fc62a7ad 100644 --- a/ui/src/components/access/AccessEditFormNameSiloConfig.tsx +++ b/ui/src/components/access/AccessEditFormNameSiloConfig.tsx @@ -1,5 +1,5 @@ import { useTranslation } from "react-i18next"; -import { Form, Input, type FormInstance } from "antd"; +import { Form, type FormInstance, Input } from "antd"; import { createSchemaFieldRule } from "antd-zod"; import { z } from "zod"; diff --git a/ui/src/components/access/AccessEditFormPowerDNSConfig.tsx b/ui/src/components/access/AccessEditFormPowerDNSConfig.tsx index cbeee5cf..c0bdef90 100644 --- a/ui/src/components/access/AccessEditFormPowerDNSConfig.tsx +++ b/ui/src/components/access/AccessEditFormPowerDNSConfig.tsx @@ -1,5 +1,5 @@ import { useTranslation } from "react-i18next"; -import { Form, Input, type FormInstance } from "antd"; +import { Form, type FormInstance, Input } from "antd"; import { createSchemaFieldRule } from "antd-zod"; import { z } from "zod"; diff --git a/ui/src/components/access/AccessEditFormQiniuConfig.tsx b/ui/src/components/access/AccessEditFormQiniuConfig.tsx index 7d863eab..73d923ff 100644 --- a/ui/src/components/access/AccessEditFormQiniuConfig.tsx +++ b/ui/src/components/access/AccessEditFormQiniuConfig.tsx @@ -1,5 +1,5 @@ import { useTranslation } from "react-i18next"; -import { Form, Input, type FormInstance } from "antd"; +import { Form, type FormInstance, Input } from "antd"; import { createSchemaFieldRule } from "antd-zod"; import { z } from "zod"; diff --git a/ui/src/components/access/AccessEditFormSSHConfig.tsx b/ui/src/components/access/AccessEditFormSSHConfig.tsx index 414d96ea..c4f858ee 100644 --- a/ui/src/components/access/AccessEditFormSSHConfig.tsx +++ b/ui/src/components/access/AccessEditFormSSHConfig.tsx @@ -3,7 +3,7 @@ import { flushSync } from "react-dom"; import { useTranslation } from "react-i18next"; import { UploadOutlined as UploadOutlinedIcon } from "@ant-design/icons"; import { useDeepCompareEffect } from "ahooks"; -import { Button, Form, Input, InputNumber, Upload, type FormInstance, type UploadFile, type UploadProps } from "antd"; +import { Button, Form, type FormInstance, Input, InputNumber, Upload, type UploadFile, type UploadProps } from "antd"; import { createSchemaFieldRule } from "antd-zod"; import { z } from "zod"; diff --git a/ui/src/components/access/AccessEditFormTencentCloudConfig.tsx b/ui/src/components/access/AccessEditFormTencentCloudConfig.tsx index 5e6a6ac1..1e8a1e25 100644 --- a/ui/src/components/access/AccessEditFormTencentCloudConfig.tsx +++ b/ui/src/components/access/AccessEditFormTencentCloudConfig.tsx @@ -1,5 +1,5 @@ import { useTranslation } from "react-i18next"; -import { Form, Input, type FormInstance } from "antd"; +import { Form, type FormInstance, Input } from "antd"; import { createSchemaFieldRule } from "antd-zod"; import { z } from "zod"; diff --git a/ui/src/components/access/AccessEditFormVolcEngineConfig.tsx b/ui/src/components/access/AccessEditFormVolcEngineConfig.tsx index 032b6b3c..342d7b18 100644 --- a/ui/src/components/access/AccessEditFormVolcEngineConfig.tsx +++ b/ui/src/components/access/AccessEditFormVolcEngineConfig.tsx @@ -1,5 +1,5 @@ import { useTranslation } from "react-i18next"; -import { Form, Input, type FormInstance } from "antd"; +import { Form, type FormInstance, Input } from "antd"; import { createSchemaFieldRule } from "antd-zod"; import { z } from "zod"; diff --git a/ui/src/components/access/AccessEditFormWebhookConfig.tsx b/ui/src/components/access/AccessEditFormWebhookConfig.tsx index 0ed1456d..fc451ba0 100644 --- a/ui/src/components/access/AccessEditFormWebhookConfig.tsx +++ b/ui/src/components/access/AccessEditFormWebhookConfig.tsx @@ -1,5 +1,5 @@ import { useTranslation } from "react-i18next"; -import { Form, Input, type FormInstance } from "antd"; +import { Form, type FormInstance, Input } from "antd"; import { createSchemaFieldRule } from "antd-zod"; import { z } from "zod"; diff --git a/ui/src/components/access/AccessProviderSelect.tsx b/ui/src/components/access/AccessProviderSelect.tsx index 59d9c24f..34fc3a35 100644 --- a/ui/src/components/access/AccessProviderSelect.tsx +++ b/ui/src/components/access/AccessProviderSelect.tsx @@ -1,6 +1,6 @@ import { memo } from "react"; import { useTranslation } from "react-i18next"; -import { Avatar, Select, Space, Tag, Typography, type SelectProps } from "antd"; +import { Avatar, Select, type SelectProps, Space, Tag, Typography } from "antd"; import { ACCESS_USAGES, accessProvidersMap } from "@/domain/provider"; diff --git a/ui/src/components/access/AccessSelect.tsx b/ui/src/components/access/AccessSelect.tsx index 07191582..05d15b0d 100644 --- a/ui/src/components/access/AccessSelect.tsx +++ b/ui/src/components/access/AccessSelect.tsx @@ -1,5 +1,5 @@ import { useEffect, useState } from "react"; -import { Avatar, Select, Space, Typography, type SelectProps } from "antd"; +import { Avatar, Select, type SelectProps, Space, Typography } from "antd"; import { type AccessModel } from "@/domain/access"; import { accessProvidersMap } from "@/domain/provider"; diff --git a/ui/src/components/certificate/CertificateDetail.tsx b/ui/src/components/certificate/CertificateDetail.tsx index 180eb983..f729b8b9 100644 --- a/ui/src/components/certificate/CertificateDetail.tsx +++ b/ui/src/components/certificate/CertificateDetail.tsx @@ -1,7 +1,7 @@ import { CopyToClipboard } from "react-copy-to-clipboard"; import { useTranslation } from "react-i18next"; import { CopyOutlined as CopyOutlinedIcon, DownOutlined as DownOutlinedIcon, LikeOutlined as LikeOutlinedIcon } from "@ant-design/icons"; -import { Button, Dropdown, Form, Input, message, Space, Tooltip } from "antd"; +import { Button, Dropdown, Form, Input, Space, Tooltip, message } from "antd"; import dayjs from "dayjs"; import { type CertificateModel } from "@/domain/certificate"; diff --git a/ui/src/components/core/DrawerForm.tsx b/ui/src/components/core/DrawerForm.tsx index 9720f4d7..49529060 100644 --- a/ui/src/components/core/DrawerForm.tsx +++ b/ui/src/components/core/DrawerForm.tsx @@ -1,6 +1,6 @@ import { useTranslation } from "react-i18next"; import { useControllableValue } from "ahooks"; -import { Button, Drawer, Form, Space, type DrawerProps, type FormProps, type ModalProps } from "antd"; +import { Button, Drawer, type DrawerProps, Form, type FormProps, type ModalProps, Space } from "antd"; import { useAntdForm, useTriggerElement } from "@/hooks"; diff --git a/ui/src/components/core/ModalForm.tsx b/ui/src/components/core/ModalForm.tsx index f149c97b..4b8b3697 100644 --- a/ui/src/components/core/ModalForm.tsx +++ b/ui/src/components/core/ModalForm.tsx @@ -1,5 +1,5 @@ import { useControllableValue } from "ahooks"; -import { Form, Modal, type FormProps, type ModalProps } from "antd"; +import { Form, type FormProps, Modal, type ModalProps } from "antd"; import { useAntdForm, useTriggerElement } from "@/hooks"; diff --git a/ui/src/components/core/MultipleInput.tsx b/ui/src/components/core/MultipleInput.tsx index 019e3676..77d3fcee 100644 --- a/ui/src/components/core/MultipleInput.tsx +++ b/ui/src/components/core/MultipleInput.tsx @@ -1,4 +1,4 @@ -import { forwardRef, useImperativeHandle, useMemo, useRef, type ChangeEvent } from "react"; +import { type ChangeEvent, forwardRef, useImperativeHandle, useMemo, useRef } from "react"; import { useTranslation } from "react-i18next"; import { ArrowDownOutlined as ArrowDownOutlinedIcon, @@ -7,7 +7,7 @@ import { PlusOutlined as PlusOutlinedIcon, } from "@ant-design/icons"; import { useControllableValue } from "ahooks"; -import { Button, Input, Space, type InputRef, type InputProps } from "antd"; +import { Button, Input, type InputProps, type InputRef, Space } from "antd"; import { produce } from "immer"; export type MultipleInputProps = Omit & { diff --git a/ui/src/components/notification/NotifyChannels.tsx b/ui/src/components/notification/NotifyChannels.tsx index 7e73a394..8c869ea4 100644 --- a/ui/src/components/notification/NotifyChannels.tsx +++ b/ui/src/components/notification/NotifyChannels.tsx @@ -1,7 +1,7 @@ import { useEffect, useRef, useState } from "react"; import { useTranslation } from "react-i18next"; import { useDeepCompareMemo } from "@ant-design/pro-components"; -import { Button, Collapse, message, notification, Skeleton, Space, Switch, type CollapseProps } from "antd"; +import { Button, Collapse, type CollapseProps, Skeleton, Space, Switch, message, notification } from "antd"; import Show from "@/components/Show"; import { notifyChannelsMap } from "@/domain/settings"; diff --git a/ui/src/components/notification/NotifyTemplate.tsx b/ui/src/components/notification/NotifyTemplate.tsx index 453f5c9e..fa554583 100644 --- a/ui/src/components/notification/NotifyTemplate.tsx +++ b/ui/src/components/notification/NotifyTemplate.tsx @@ -1,13 +1,13 @@ import { useState } from "react"; import { useTranslation } from "react-i18next"; import { useRequest } from "ahooks"; -import { Button, Form, Input, message, notification, Skeleton } from "antd"; +import { Button, Form, Input, Skeleton, message, notification } from "antd"; import { createSchemaFieldRule } from "antd-zod"; import { ClientResponseError } from "pocketbase"; import { z } from "zod"; import Show from "@/components/Show"; -import { defaultNotifyTemplate, SETTINGS_NAMES, type NotifyTemplatesSettingsContent } from "@/domain/settings"; +import { type NotifyTemplatesSettingsContent, SETTINGS_NAMES, defaultNotifyTemplate } from "@/domain/settings"; import { useAntdForm } from "@/hooks"; import { get as getSettings, save as saveSettings } from "@/repository/settings"; import { getErrMsg } from "@/utils/error"; diff --git a/ui/src/components/notification/NotifyTestButton.tsx b/ui/src/components/notification/NotifyTestButton.tsx index 095c9b3a..7bc9352b 100644 --- a/ui/src/components/notification/NotifyTestButton.tsx +++ b/ui/src/components/notification/NotifyTestButton.tsx @@ -1,6 +1,6 @@ import { useTranslation } from "react-i18next"; import { useRequest } from "ahooks"; -import { Button, message, notification, type ButtonProps } from "antd"; +import { Button, type ButtonProps, message, notification } from "antd"; import { notifyTest } from "@/api/notify"; import { getErrMsg } from "@/utils/error"; diff --git a/ui/src/components/workflow/NodeTypesPanel.tsx b/ui/src/components/workflow/NodeTypesPanel.tsx deleted file mode 100644 index bc0474c7..00000000 --- a/ui/src/components/workflow/NodeTypesPanel.tsx +++ /dev/null @@ -1,68 +0,0 @@ -import { CloudUpload, GitFork, Megaphone, NotebookPen } from "lucide-react"; - -import { WorkflowNodeType } from "@/domain/workflow"; - -type NodeTypesPanelProps = { - onTypeSelected: (type: WorkflowNodeType) => void; -}; - -const NodeTypesPanel = ({ onTypeSelected }: NodeTypesPanelProps) => { - return ( - <> -
-
{ - onTypeSelected(WorkflowNodeType.Apply); - }} - > -
- -
- -
申请
-
-
{ - onTypeSelected(WorkflowNodeType.Deploy); - }} - > -
- -
- -
部署
-
-
-
-
{ - onTypeSelected(WorkflowNodeType.Branch); - }} - > -
- -
- -
分支
-
-
{ - onTypeSelected(WorkflowNodeType.Notify); - }} - > -
- -
- -
推送
-
-
- - ); -}; - -export default NodeTypesPanel; diff --git a/ui/src/components/workflow/node/ApplyNodeForm.tsx b/ui/src/components/workflow/node/ApplyNodeForm.tsx index 02bbd6c7..429eb613 100644 --- a/ui/src/components/workflow/node/ApplyNodeForm.tsx +++ b/ui/src/components/workflow/node/ApplyNodeForm.tsx @@ -2,7 +2,7 @@ import { memo, useCallback, useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { FormOutlined as FormOutlinedIcon, PlusOutlined as PlusOutlinedIcon, QuestionCircleOutlined as QuestionCircleOutlinedIcon } from "@ant-design/icons"; import { useControllableValue } from "ahooks"; -import { AutoComplete, Button, Divider, Form, Input, Select, Space, Switch, Tooltip, Typography, type AutoCompleteProps } from "antd"; +import { AutoComplete, type AutoCompleteProps, Button, Divider, Form, Input, Select, Space, Switch, Tooltip, Typography } from "antd"; import { createSchemaFieldRule } from "antd-zod"; import { produce } from "immer"; import { z } from "zod"; @@ -12,7 +12,7 @@ import AccessSelect from "@/components/access/AccessSelect"; import ModalForm from "@/components/core/ModalForm"; import MultipleInput from "@/components/core/MultipleInput"; import { ACCESS_USAGES, accessProvidersMap } from "@/domain/provider"; -import { type WorkflowNode, type WorkflowNodeConfig } from "@/domain/workflow"; +import { type WorkflowNode } from "@/domain/workflow"; import { useAntdForm, useZustandShallowSelector } from "@/hooks"; import { useContactEmailsStore } from "@/stores/contact"; import { useWorkflowStore } from "@/stores/workflow"; @@ -25,7 +25,7 @@ export type ApplyNodeFormProps = { const MULTIPLE_INPUT_DELIMITER = ";"; -const initFormModel = (): WorkflowNodeConfig => { +const initFormModel = () => { return { domain: "", keyAlgorithm: "RSA2048", diff --git a/ui/src/components/workflow/node/DeployNodeForm.tsx b/ui/src/components/workflow/node/DeployNodeForm.tsx index 33615b05..af807263 100644 --- a/ui/src/components/workflow/node/DeployNodeForm.tsx +++ b/ui/src/components/workflow/node/DeployNodeForm.tsx @@ -8,8 +8,8 @@ import { z } from "zod"; import AccessEditModal from "@/components/access/AccessEditModal"; import AccessSelect from "@/components/access/AccessSelect"; -import { ACCESS_USAGES, accessProvidersMap, DEPLOY_PROVIDERS, deployProvidersMap } from "@/domain/provider"; -import { type WorkflowNode, type WorkflowNodeConfig } from "@/domain/workflow"; +import { ACCESS_USAGES, DEPLOY_PROVIDERS, accessProvidersMap, deployProvidersMap } from "@/domain/provider"; +import { type WorkflowNode } from "@/domain/workflow"; import { useAntdForm, useZustandShallowSelector } from "@/hooks"; import { useWorkflowStore } from "@/stores/workflow"; import { usePanel } from "../PanelProvider"; @@ -42,7 +42,7 @@ export type DeployFormProps = { defaultProivderType?: string; }; -const initFormModel = (): WorkflowNodeConfig => { +const initFormModel = () => { return {}; }; diff --git a/ui/src/components/workflow/node/NotifyNodeForm.tsx b/ui/src/components/workflow/node/NotifyNodeForm.tsx index fc23277a..23a4fd59 100644 --- a/ui/src/components/workflow/node/NotifyNodeForm.tsx +++ b/ui/src/components/workflow/node/NotifyNodeForm.tsx @@ -8,7 +8,7 @@ import { produce } from "immer"; import { z } from "zod"; import { notifyChannelsMap } from "@/domain/settings"; -import { type WorkflowNode, type WorkflowNodeConfig } from "@/domain/workflow"; +import { type WorkflowNode } 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 = { data: WorkflowNode; }; -const initFormModel = (): WorkflowNodeConfig => { +const initFormModel = () => { return { subject: "Completed!", message: "Your workflow has been completed on Certimate.", diff --git a/ui/src/components/workflow/node/StartNodeForm.tsx b/ui/src/components/workflow/node/StartNodeForm.tsx index 54388432..bffe9e45 100644 --- a/ui/src/components/workflow/node/StartNodeForm.tsx +++ b/ui/src/components/workflow/node/StartNodeForm.tsx @@ -7,17 +7,17 @@ import { produce } from "immer"; import { z } from "zod"; import Show from "@/components/Show"; -import { type WorkflowNode, type WorkflowNodeConfig } from "@/domain/workflow"; +import { type WorkflowNode } from "@/domain/workflow"; import { useAntdForm, useZustandShallowSelector } from "@/hooks"; import { useWorkflowStore } from "@/stores/workflow"; -import { validCronExpression, getNextCronExecutions } from "@/utils/cron"; +import { getNextCronExecutions, validCronExpression } from "@/utils/cron"; import { usePanel } from "../PanelProvider"; export type StartNodeFormProps = { data: WorkflowNode; }; -const initFormModel = (): WorkflowNodeConfig => { +const initFormModel = () => { return { executionMethod: "auto", crontab: "0 0 * * *", diff --git a/ui/src/components/workflow/run/WorkflowRuns.tsx b/ui/src/components/workflow/run/WorkflowRuns.tsx index 8b3dd552..65357188 100644 --- a/ui/src/components/workflow/run/WorkflowRuns.tsx +++ b/ui/src/components/workflow/run/WorkflowRuns.tsx @@ -6,7 +6,7 @@ import { SelectOutlined as SelectOutlinedIcon, } from "@ant-design/icons"; import { useRequest } from "ahooks"; -import { Button, Empty, notification, Space, Table, theme, Typography, type TableProps } from "antd"; +import { Button, Empty, Space, Table, type TableProps, Typography, notification, theme } from "antd"; import { ClientResponseError } from "pocketbase"; import { type WorkflowRunModel } from "@/domain/workflowRun"; diff --git a/ui/src/global.d.ts b/ui/src/global.d.ts index a567ce00..07951477 100644 --- a/ui/src/global.d.ts +++ b/ui/src/global.d.ts @@ -2,12 +2,16 @@ declare global { declare interface BaseModel extends PbBaseModel { - deleted?: string; + created: ISO8601String; + updated: ISO8601String; + deleted?: ISO8601String; } declare type MaybeModelRecord = T | Omit; declare type MaybeModelRecordWithId = T | Pick; + + declare type ISO8601String = string; } export {}; diff --git a/ui/src/hooks/useTriggerElement.ts b/ui/src/hooks/useTriggerElement.ts index 9ac41a62..03ed62d0 100644 --- a/ui/src/hooks/useTriggerElement.ts +++ b/ui/src/hooks/useTriggerElement.ts @@ -1,4 +1,4 @@ -import { cloneElement, createElement, Fragment, isValidElement, useMemo } from "react"; +import { Fragment, cloneElement, createElement, isValidElement, useMemo } from "react"; export type UseTriggerElementOptions = { onClick?: (e: MouseEvent) => void; diff --git a/ui/src/hooks/useZustandShallowSelector.ts b/ui/src/hooks/useZustandShallowSelector.ts index a10889bd..724cdf2c 100644 --- a/ui/src/hooks/useZustandShallowSelector.ts +++ b/ui/src/hooks/useZustandShallowSelector.ts @@ -1,5 +1,5 @@ import { useRef } from "react"; -import { pick, isArray } from "radash"; +import { isArray, pick } from "radash"; import { shallow } from "zustand/shallow"; type MaybeMany = T | readonly T[]; diff --git a/ui/src/pages/ConsoleLayout.tsx b/ui/src/pages/ConsoleLayout.tsx index 47fdc431..d4dff7a2 100644 --- a/ui/src/pages/ConsoleLayout.tsx +++ b/ui/src/pages/ConsoleLayout.tsx @@ -13,7 +13,7 @@ import { SettingOutlined as SettingOutlinedIcon, SunOutlined as SunOutlinedIcon, } from "@ant-design/icons"; -import { Button, Drawer, Dropdown, Layout, Menu, Tooltip, theme, type ButtonProps, type MenuProps } from "antd"; +import { Button, type ButtonProps, Drawer, Dropdown, Layout, Menu, type MenuProps, Tooltip, theme } from "antd"; import Version from "@/components/core/Version"; import { useBrowserTheme } from "@/hooks"; diff --git a/ui/src/pages/accesses/AccessList.tsx b/ui/src/pages/accesses/AccessList.tsx index e55e78c1..24da6c17 100644 --- a/ui/src/pages/accesses/AccessList.tsx +++ b/ui/src/pages/accesses/AccessList.tsx @@ -8,7 +8,7 @@ import { } from "@ant-design/icons"; import { PageHeader } from "@ant-design/pro-components"; import { useRequest } from "ahooks"; -import { Avatar, Button, Empty, Modal, notification, Space, Table, Tooltip, Typography, type TableProps } from "antd"; +import { Avatar, Button, Empty, Modal, Space, Table, type TableProps, Tooltip, Typography, notification } from "antd"; import dayjs from "dayjs"; import { ClientResponseError } from "pocketbase"; diff --git a/ui/src/pages/certificates/CertificateList.tsx b/ui/src/pages/certificates/CertificateList.tsx index 04de9b32..798a1334 100644 --- a/ui/src/pages/certificates/CertificateList.tsx +++ b/ui/src/pages/certificates/CertificateList.tsx @@ -4,13 +4,13 @@ import { useNavigate, useSearchParams } from "react-router-dom"; import { DeleteOutlined as DeleteOutlinedIcon, SelectOutlined as SelectOutlinedIcon } from "@ant-design/icons"; import { PageHeader } from "@ant-design/pro-components"; import { useRequest } from "ahooks"; -import { Button, Divider, Empty, Menu, notification, Radio, Space, Table, theme, Tooltip, Typography, type MenuProps, type TableProps } from "antd"; +import { Button, Divider, Empty, Menu, type MenuProps, Radio, Space, Table, type TableProps, Tooltip, Typography, notification, theme } from "antd"; import dayjs from "dayjs"; import { ClientResponseError } from "pocketbase"; import CertificateDetailDrawer from "@/components/certificate/CertificateDetailDrawer"; import { type CertificateModel } from "@/domain/certificate"; -import { list as listCertificate, type ListCertificateRequest } from "@/repository/certificate"; +import { type ListCertificateRequest, list as listCertificate } from "@/repository/certificate"; import { getErrMsg } from "@/utils/error"; const CertificateList = () => { diff --git a/ui/src/pages/dashboard/Dashboard.tsx b/ui/src/pages/dashboard/Dashboard.tsx index 10cfaadd..d5a12e19 100644 --- a/ui/src/pages/dashboard/Dashboard.tsx +++ b/ui/src/pages/dashboard/Dashboard.tsx @@ -3,7 +3,7 @@ import { useTranslation } from "react-i18next"; import { useNavigate } from "react-router-dom"; import { PageHeader } from "@ant-design/pro-components"; import { useRequest } from "ahooks"; -import { Card, Col, Divider, notification, Row, Space, Statistic, theme, Typography } from "antd"; +import { Card, Col, Divider, Row, Space, Statistic, Typography, notification, theme } from "antd"; import { CalendarClock as CalendarClockIcon, CalendarX2 as CalendarX2Icon, diff --git a/ui/src/pages/settings/SettingsSSLProvider.tsx b/ui/src/pages/settings/SettingsSSLProvider.tsx index afe6be18..976b318b 100644 --- a/ui/src/pages/settings/SettingsSSLProvider.tsx +++ b/ui/src/pages/settings/SettingsSSLProvider.tsx @@ -2,13 +2,13 @@ import { createContext, useContext, useEffect, useMemo, useState } from "react"; import { useTranslation } from "react-i18next"; import { CheckCard } from "@ant-design/pro-components"; import { useDeepCompareEffect } from "ahooks"; -import { Button, Form, Input, message, notification, Skeleton } from "antd"; +import { Button, Form, Input, Skeleton, message, notification } from "antd"; import { createSchemaFieldRule } from "antd-zod"; import { produce } from "immer"; import { z } from "zod"; import Show from "@/components/Show"; -import { SETTINGS_NAMES, SSLPROVIDERS, type SettingsModel, type SSLProviderSettingsContent, type SSLProviders } from "@/domain/settings"; +import { SETTINGS_NAMES, SSLPROVIDERS, type SSLProviderSettingsContent, type SSLProviders, type SettingsModel } from "@/domain/settings"; import { useAntdForm } from "@/hooks"; import { get as getSettings, save as saveSettings } from "@/repository/settings"; import { getErrMsg } from "@/utils/error"; diff --git a/ui/src/pages/workflows/WorkflowDetail.tsx b/ui/src/pages/workflows/WorkflowDetail.tsx index 157e9e2a..677ed8cb 100644 --- a/ui/src/pages/workflows/WorkflowDetail.tsx +++ b/ui/src/pages/workflows/WorkflowDetail.tsx @@ -11,7 +11,7 @@ import { } from "@ant-design/icons"; import { PageHeader } from "@ant-design/pro-components"; import { useDeepCompareEffect } from "ahooks"; -import { Button, Card, Dropdown, Form, Input, message, Modal, notification, Space, Tabs, Typography } from "antd"; +import { Button, Card, Dropdown, Form, Input, Modal, Space, Tabs, Typography, message, notification } from "antd"; import { createSchemaFieldRule } from "antd-zod"; import { ClientResponseError } from "pocketbase"; import { isEqual } from "radash"; @@ -24,7 +24,7 @@ import End from "@/components/workflow/End"; import NodeRender from "@/components/workflow/NodeRender"; import WorkflowProvider from "@/components/workflow/WorkflowProvider"; import WorkflowRuns from "@/components/workflow/run/WorkflowRuns"; -import { isAllNodesValidated, type WorkflowModel, type WorkflowNode } from "@/domain/workflow"; +import { type WorkflowModel, type WorkflowNode, isAllNodesValidated } from "@/domain/workflow"; import { useAntdForm, useZustandShallowSelector } from "@/hooks"; import { remove as removeWorkflow } from "@/repository/workflow"; import { useWorkflowStore } from "@/stores/workflow"; diff --git a/ui/src/pages/workflows/WorkflowList.tsx b/ui/src/pages/workflows/WorkflowList.tsx index 3ce19ffa..8feb4fbb 100644 --- a/ui/src/pages/workflows/WorkflowList.tsx +++ b/ui/src/pages/workflows/WorkflowList.tsx @@ -9,23 +9,23 @@ import { Divider, Empty, Menu, - message, + type MenuProps, Modal, - notification, Radio, Space, Switch, Table, - theme, + type TableProps, Tooltip, Typography, - type MenuProps, - type TableProps, + message, + notification, + theme, } from "antd"; import dayjs from "dayjs"; import { ClientResponseError } from "pocketbase"; -import { isAllNodesValidated, type WorkflowModel } from "@/domain/workflow"; +import { type WorkflowModel, isAllNodesValidated } from "@/domain/workflow"; import { list as listWorkflow, remove as removeWorkflow, save as saveWorkflow } from "@/repository/workflow"; import { getErrMsg } from "@/utils/error"; @@ -239,6 +239,10 @@ const WorkflowList = () => { } ); + const handleCreateClick = () => { + navigate("/workflows/new"); + }; + const handleEnabledChange = async (workflow: WorkflowModel) => { try { if (!workflow.enabled && !isAllNodesValidated(workflow.content!)) { @@ -284,10 +288,6 @@ const WorkflowList = () => { }); }; - const handleCreateClick = () => { - alert("TODO"); - }; - return (
{MessageContextHolder} diff --git a/ui/src/router.tsx b/ui/src/router.tsx index 808a6b86..31265f6b 100644 --- a/ui/src/router.tsx +++ b/ui/src/router.tsx @@ -13,6 +13,7 @@ import SettingsPassword from "./pages/settings/SettingsPassword"; import SettingsSSLProvider from "./pages/settings/SettingsSSLProvider"; import WorkflowDetail from "./pages/workflows/WorkflowDetail"; import WorkflowList from "./pages/workflows/WorkflowList"; +import WorkflowNew from "./pages/workflows/WorkflowNew"; export const router = createHashRouter([ { @@ -35,6 +36,10 @@ export const router = createHashRouter([ path: "/workflows", element: , }, + { + path: "/workflows/new", + element: , + }, { path: "/workflows/:id", element: , diff --git a/ui/src/stores/access/index.ts b/ui/src/stores/access/index.ts index d37b1566..661dbedc 100644 --- a/ui/src/stores/access/index.ts +++ b/ui/src/stores/access/index.ts @@ -2,7 +2,7 @@ import { create } from "zustand"; import { type AccessModel } from "@/domain/access"; -import { list as listAccess, save as saveAccess, remove as removeAccess } from "@/repository/access"; +import { list as listAccess, remove as removeAccess, save as saveAccess } from "@/repository/access"; export interface AccessesState { accesses: AccessModel[]; diff --git a/ui/src/stores/contact/index.ts b/ui/src/stores/contact/index.ts index db4bb33f..1ea000b3 100644 --- a/ui/src/stores/contact/index.ts +++ b/ui/src/stores/contact/index.ts @@ -1,7 +1,7 @@ import { produce } from "immer"; import { create } from "zustand"; -import { SETTINGS_NAMES, type EmailsSettingsContent, type SettingsModel } from "@/domain/settings"; +import { type EmailsSettingsContent, SETTINGS_NAMES, type SettingsModel } from "@/domain/settings"; import { get as getSettings, save as saveSettings } from "@/repository/settings"; export interface ContactEmailsState { diff --git a/ui/src/stores/notify/index.ts b/ui/src/stores/notify/index.ts index 843c0cf0..c8f0356f 100644 --- a/ui/src/stores/notify/index.ts +++ b/ui/src/stores/notify/index.ts @@ -1,7 +1,7 @@ import { produce } from "immer"; import { create } from "zustand"; -import { SETTINGS_NAMES, type NotifyChannelsSettingsContent, type SettingsModel } from "@/domain/settings"; +import { type NotifyChannelsSettingsContent, SETTINGS_NAMES, type SettingsModel } from "@/domain/settings"; import { get as getSettings, save as saveSettings } from "@/repository/settings"; export interface NotifyChannelsState { diff --git a/ui/vite.config.ts b/ui/vite.config.ts index 01c426c6..ce8b37d8 100644 --- a/ui/vite.config.ts +++ b/ui/vite.config.ts @@ -3,7 +3,7 @@ import path from "node:path"; import legacyPlugin from "@vitejs/plugin-legacy"; import reactPlugin from "@vitejs/plugin-react"; import fs from "fs-extra"; -import { defineConfig, type Plugin } from "vite"; +import { type Plugin, defineConfig } from "vite"; const preserveFilesPlugin = (filesToPreserve: string[]): Plugin => { return {