From 42b6524954165d3c24e6feac362c6fdcc6cdec92 Mon Sep 17 00:00:00 2001 From: Joel Date: Wed, 18 Jun 2025 15:04:40 +0800 Subject: [PATCH] feat: type config --- .../components/plugins/plugin-page/index.tsx | 6 +++--- .../auto-update-setting/config.ts | 9 +++++++++ .../auto-update-setting/index.tsx | 19 +++++++++++++++++++ .../auto-update-setting/types.ts | 19 +++++++++++++++++++ .../modal.tsx | 3 ++- .../style.module.css | 0 6 files changed, 52 insertions(+), 4 deletions(-) create mode 100644 web/app/components/plugins/reference-setting-modal/auto-update-setting/config.ts create mode 100644 web/app/components/plugins/reference-setting-modal/auto-update-setting/index.tsx create mode 100644 web/app/components/plugins/reference-setting-modal/auto-update-setting/types.ts rename web/app/components/plugins/{permission-setting-modal => reference-setting-modal}/modal.tsx (96%) rename web/app/components/plugins/{permission-setting-modal => reference-setting-modal}/style.module.css (100%) diff --git a/web/app/components/plugins/plugin-page/index.tsx b/web/app/components/plugins/plugin-page/index.tsx index 7e17459b33..4c7de28f17 100644 --- a/web/app/components/plugins/plugin-page/index.tsx +++ b/web/app/components/plugins/plugin-page/index.tsx @@ -24,7 +24,7 @@ import Button from '@/app/components/base/button' import TabSlider from '@/app/components/base/tab-slider' import Tooltip from '@/app/components/base/tooltip' import cn from '@/utils/classnames' -import PermissionSetModal from '@/app/components/plugins/permission-setting-modal/modal' +import ReferenceSettingModal from '@/app/components/plugins/reference-setting-modal/modal' import InstallFromMarketplace from '../install-plugin/install-from-marketplace' import { useRouter, @@ -130,7 +130,7 @@ const PluginPage = ({ const [showPluginSettingModal, { setTrue: setShowPluginSettingModal, setFalse: setHidePluginSettingModal, - }] = useBoolean() + }] = useBoolean(true) const [currentFile, setCurrentFile] = useState(null) const containerRef = usePluginPageContext(v => v.containerRef) const options = usePluginPageContext(v => v.options) @@ -276,7 +276,7 @@ const PluginPage = ({ } {showPluginSettingModal && ( - = ({ + payload, +}) => { + console.log(payload) + return ( +
+
+ ) +} +export default React.memo(AutoUpdateSetting) diff --git a/web/app/components/plugins/reference-setting-modal/auto-update-setting/types.ts b/web/app/components/plugins/reference-setting-modal/auto-update-setting/types.ts new file mode 100644 index 0000000000..c48a67140a --- /dev/null +++ b/web/app/components/plugins/reference-setting-modal/auto-update-setting/types.ts @@ -0,0 +1,19 @@ +export enum AUTO_UPDATE_STRATEGY { + fixOnly = 'fix_only', + disabled = 'disabled', + latest = 'latest', +} + +export enum AUTO_UPDATE_MODE { + partial = 'partial', + exclude = 'exclude', + update_all = 'update_all', +} + +export type AutoUpdateConfig = { + strategy_setting: AUTO_UPDATE_STRATEGY + upgrade_time_of_day: number + upgrade_mode: AUTO_UPDATE_MODE + exclude_plugins: string[] + include_plugins: string[] +} diff --git a/web/app/components/plugins/permission-setting-modal/modal.tsx b/web/app/components/plugins/reference-setting-modal/modal.tsx similarity index 96% rename from web/app/components/plugins/permission-setting-modal/modal.tsx rename to web/app/components/plugins/reference-setting-modal/modal.tsx index 6fd4d8c2dc..1c45820e8e 100644 --- a/web/app/components/plugins/permission-setting-modal/modal.tsx +++ b/web/app/components/plugins/reference-setting-modal/modal.tsx @@ -7,10 +7,11 @@ import OptionCard from '@/app/components/workflow/nodes/_base/components/option- import Button from '@/app/components/base/button' import type { Permissions } from '@/app/components/plugins/types' import { PermissionType } from '@/app/components/plugins/types' +import type { AutoUpdateConfig } from './auto-update-setting/types' const i18nPrefix = 'plugin.privilege' type Props = { - payload: Permissions + payload: Permissions & { autoUpdate: AutoUpdateConfig } onHide: () => void onSave: (payload: Permissions) => void } diff --git a/web/app/components/plugins/permission-setting-modal/style.module.css b/web/app/components/plugins/reference-setting-modal/style.module.css similarity index 100% rename from web/app/components/plugins/permission-setting-modal/style.module.css rename to web/app/components/plugins/reference-setting-modal/style.module.css