feat: type config

This commit is contained in:
Joel 2025-06-18 15:04:40 +08:00
parent 37f26c412f
commit 42b6524954
6 changed files with 52 additions and 4 deletions

View File

@ -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<File | null>(null)
const containerRef = usePluginPageContext(v => v.containerRef)
const options = usePluginPageContext(v => v.options)
@ -276,7 +276,7 @@ const PluginPage = ({
}
{showPluginSettingModal && (
<PermissionSetModal
<ReferenceSettingModal
payload={permissions!}
onHide={setHidePluginSettingModal}
onSave={setPermissions}

View File

@ -0,0 +1,9 @@
import type { AutoUpdateConfig } from './types'
import { AUTO_UPDATE_MODE, AUTO_UPDATE_STRATEGY } from './types'
export const defaultValue: AutoUpdateConfig = {
strategy_setting: AUTO_UPDATE_STRATEGY.disabled,
upgrade_time_of_day: 0,
upgrade_mode: AUTO_UPDATE_MODE.update_all,
exclude_plugins: [],
include_plugins: [],
}

View File

@ -0,0 +1,19 @@
'use client'
import type { FC } from 'react'
import React from 'react'
import type { AutoUpdateConfig } from './types'
type Props = {
payload: AutoUpdateConfig
}
const AutoUpdateSetting: FC<Props> = ({
payload,
}) => {
console.log(payload)
return (
<div>
</div>
)
}
export default React.memo(AutoUpdateSetting)

View File

@ -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[]
}

View File

@ -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
}