mirror of https://github.com/langgenius/dify.git
feat: only choose 15 time
This commit is contained in:
parent
01cdffaa08
commit
8b290ac7a1
|
|
@ -21,6 +21,7 @@ const TimePicker = ({
|
|||
onClear,
|
||||
renderTrigger,
|
||||
title,
|
||||
minuteFilter,
|
||||
popupClassName,
|
||||
}: TimePickerProps) => {
|
||||
const { t } = useTranslation()
|
||||
|
|
@ -152,6 +153,7 @@ const TimePicker = ({
|
|||
{/* Time Options */}
|
||||
<Options
|
||||
selectedTime={selectedTime}
|
||||
minuteFilter={minuteFilter}
|
||||
handleSelectHour={handleSelectHour}
|
||||
handleSelectMinute={handleSelectMinute}
|
||||
handleSelectPeriod={handleSelectPeriod}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import OptionListItem from '../common/option-list-item'
|
|||
|
||||
const Options: FC<TimeOptionsProps> = ({
|
||||
selectedTime,
|
||||
minuteFilter,
|
||||
handleSelectHour,
|
||||
handleSelectMinute,
|
||||
handleSelectPeriod,
|
||||
|
|
@ -33,7 +34,7 @@ const Options: FC<TimeOptionsProps> = ({
|
|||
{/* Minute */}
|
||||
<ul className='no-scrollbar flex h-[208px] flex-col gap-y-0.5 overflow-y-auto pb-[184px]'>
|
||||
{
|
||||
minuteOptions.map((minute) => {
|
||||
(minuteFilter ? minuteFilter(minuteOptions) : minuteOptions).map((minute) => {
|
||||
const isSelected = selectedTime?.format('mm') === minute
|
||||
return (
|
||||
<OptionListItem
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ export type DatePickerProps = {
|
|||
onClear: () => void
|
||||
triggerWrapClassName?: string
|
||||
renderTrigger?: (props: TriggerProps) => React.ReactNode
|
||||
minuteFilter?: (minutes: string[]) => string[]
|
||||
popupZIndexClassname?: string
|
||||
}
|
||||
|
||||
|
|
@ -55,6 +56,7 @@ export type TimePickerProps = {
|
|||
onClear: () => void
|
||||
renderTrigger?: () => React.ReactNode
|
||||
title?: string
|
||||
minuteFilter?: (minutes: string[]) => string[]
|
||||
popupClassName?: string
|
||||
}
|
||||
|
||||
|
|
@ -83,6 +85,7 @@ export type CalendarItemProps = {
|
|||
|
||||
export type TimeOptionsProps = {
|
||||
selectedTime: Dayjs | undefined
|
||||
minuteFilter?: (minutes: string[]) => string[]
|
||||
handleSelectHour: (hour: string) => void
|
||||
handleSelectMinute: (minute: string) => void
|
||||
handleSelectPeriod: (period: Period) => void
|
||||
|
|
|
|||
|
|
@ -42,6 +42,13 @@ const AutoUpdateSetting: FC<Props> = ({
|
|||
exclude_plugins,
|
||||
include_plugins,
|
||||
} = payload
|
||||
|
||||
const minuteFilter = useCallback((minutes: string[]) => {
|
||||
return minutes.filter((m) => {
|
||||
const time = Number.parseInt(m, 10)
|
||||
return time % 15 === 0
|
||||
})
|
||||
}, [])
|
||||
const strategyDescription = useMemo(() => {
|
||||
switch (strategy_setting) {
|
||||
case AUTO_UPDATE_STRATEGY.fixOnly:
|
||||
|
|
@ -108,6 +115,7 @@ const AutoUpdateSetting: FC<Props> = ({
|
|||
onClear={() => handleChange('upgrade_time_of_day')(0)}
|
||||
popupClassName='z-[99]'
|
||||
title={t(`${i18nPrefix}.updateTime`)}
|
||||
minuteFilter={minuteFilter}
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue