fat: auto update mode

This commit is contained in:
Joel 2025-06-19 17:56:53 +08:00
parent bc75d810c4
commit 3061280f7a
3 changed files with 29 additions and 3 deletions

View File

@ -1,13 +1,14 @@
'use client'
import type { FC } from 'react'
import React, { useCallback, useMemo } from 'react'
import { AUTO_UPDATE_STRATEGY, type AutoUpdateConfig } from './types'
import { AUTO_UPDATE_MODE, AUTO_UPDATE_STRATEGY, type AutoUpdateConfig } from './types'
import Label from '../label'
import StrategyPicker from './strategy-picker'
import { useTranslation } from 'react-i18next'
import TimePicker from '@/app/components/base/date-and-time-picker/time-picker'
import type { Dayjs } from 'dayjs'
import dayjs from 'dayjs'
import OptionCard from '@/app/components/workflow/nodes/_base/components/option-card'
const i18nPrefix = 'plugin.autoUpdate'
@ -33,7 +34,11 @@ const AutoUpdateSetting: FC<Props> = ({
onChange,
}) => {
const { t } = useTranslation()
const { strategy_setting, upgrade_time_of_day } = payload
const {
strategy_setting,
upgrade_time_of_day,
upgrade_mode,
} = payload
const strategyDescription = useMemo(() => {
switch (strategy_setting) {
case AUTO_UPDATE_STRATEGY.fixOnly:
@ -76,8 +81,19 @@ const AutoUpdateSetting: FC<Props> = ({
title={t(`${i18nPrefix}.updateTime`)}
/>
</div>
<div className='flex items-center'>
<div>
<Label label={t(`${i18nPrefix}.specifyPluginsToUpdate`)} />
<div className='mt-1 flex w-full items-start justify-between gap-2'>
{[AUTO_UPDATE_MODE.update_all, AUTO_UPDATE_MODE.exclude, AUTO_UPDATE_MODE.partial].map(option => (
<OptionCard
key={option}
title={t(`${i18nPrefix}.upgradeMode.${option}`)}
onSelect={() => handleChange('upgrade_mode')(option)}
selected={upgrade_mode === option}
className="flex-1"
/>
))}
</div>
</div>
</>
)}

View File

@ -134,6 +134,11 @@ const translation = {
},
},
updateTimeTitle: 'Update time',
upgradeMode: {
update_all: 'Update all',
exclude: 'Exclude selected',
partial: 'Only selected',
},
},
pluginInfoModal: {
title: 'Plugin info',

View File

@ -134,6 +134,11 @@ const translation = {
},
},
updateTimeTitle: '更新时间',
upgradeMode: {
update_all: '更新全部',
exclude: '排除选定',
partial: '仅选定',
},
},
pluginInfoModal: {
title: '插件信息',