Chore: change query log time range (#28052)

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Joel
2025-11-10 18:39:12 +08:00
committed by GitHub
parent b9bc48d8dd
commit 2c62a77cf4
18 changed files with 410 additions and 48 deletions

View File

@@ -36,6 +36,8 @@ const DatePicker = ({
renderTrigger,
triggerWrapClassName,
popupZIndexClassname = 'z-[11]',
noConfirm,
getIsDateDisabled,
}: DatePickerProps) => {
const { t } = useTranslation()
const [isOpen, setIsOpen] = useState(false)
@@ -120,11 +122,20 @@ const DatePicker = ({
setCurrentDate(currentDate.clone().subtract(1, 'month'))
}, [currentDate])
const handleConfirmDate = useCallback((passedInSelectedDate?: Dayjs) => {
// passedInSelectedDate may be a click event when noConfirm is false
const nextDate = (dayjs.isDayjs(passedInSelectedDate) ? passedInSelectedDate : selectedDate)
onChange(nextDate ? nextDate.tz(timezone) : undefined)
setIsOpen(false)
}, [selectedDate, onChange, timezone])
const handleDateSelect = useCallback((day: Dayjs) => {
const newDate = cloneTime(day, selectedDate || getDateWithTimezone({ timezone }))
setCurrentDate(newDate)
setSelectedDate(newDate)
}, [selectedDate, timezone])
if (noConfirm)
handleConfirmDate(newDate)
}, [selectedDate, timezone, noConfirm, handleConfirmDate])
const handleSelectCurrentDate = () => {
const newDate = getDateWithTimezone({ timezone })
@@ -134,12 +145,6 @@ const DatePicker = ({
setIsOpen(false)
}
const handleConfirmDate = () => {
// debugger
onChange(selectedDate ? selectedDate.tz(timezone) : undefined)
setIsOpen(false)
}
const handleClickTimePicker = () => {
if (view === ViewType.date) {
setView(ViewType.time)
@@ -270,6 +275,7 @@ const DatePicker = ({
days={days}
selectedDate={selectedDate}
onDateClick={handleDateSelect}
getIsDateDisabled={getIsDateDisabled}
/>
) : view === ViewType.yearMonth ? (
<YearAndMonthPickerOptions
@@ -290,7 +296,7 @@ const DatePicker = ({
{/* Footer */}
{
[ViewType.date, ViewType.time].includes(view) ? (
[ViewType.date, ViewType.time].includes(view) && !noConfirm && (
<DatePickerFooter
needTimePicker={needTimePicker}
displayTime={displayTime}
@@ -299,7 +305,10 @@ const DatePicker = ({
handleSelectCurrentDate={handleSelectCurrentDate}
handleConfirmDate={handleConfirmDate}
/>
) : (
)
}
{
![ViewType.date, ViewType.time].includes(view) && (
<YearAndMonthPickerFooter
handleYearMonthCancel={handleYearMonthCancel}
handleYearMonthConfirm={handleYearMonthConfirm}