mirror of
https://github.com/langgenius/dify.git
synced 2026-09-08 11:04:27 +08:00
fix(agent-v2): use default select composition for time range picker (#38977)
This commit is contained in:
parent
c17a0f4e18
commit
7dd33929c7
@ -155,7 +155,7 @@ export function AgentMonitoringTimeRangePicker({
|
|||||||
|
|
||||||
const selectedOption = timeRangeOptions.find((option) => option.value === selectedRange)
|
const selectedOption = timeRangeOptions.find((option) => option.value === selectedRange)
|
||||||
|
|
||||||
const handleRangeChange = (nextValue: string | null) => {
|
const handleRangeChange = (nextValue: TimeRangeKey | null) => {
|
||||||
if (!nextValue) return
|
if (!nextValue) return
|
||||||
|
|
||||||
const option = timeRangeOptions.find((item) => item.value === nextValue)
|
const option = timeRangeOptions.find((item) => item.value === nextValue)
|
||||||
@ -196,37 +196,25 @@ export function AgentMonitoringTimeRangePicker({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex min-w-0 items-center">
|
<div className="flex min-w-0 items-center">
|
||||||
<Select
|
<Select<TimeRangeKey>
|
||||||
value={selectedRange === 'custom' ? null : selectedRange}
|
value={selectedRange === 'custom' ? null : selectedRange}
|
||||||
onValueChange={handleRangeChange}
|
onValueChange={handleRangeChange}
|
||||||
>
|
>
|
||||||
<SelectTrigger
|
<SelectTrigger
|
||||||
aria-label={t(($) => $['agentDetail.monitoring.timeRangeLabel'])}
|
aria-label={t(($) => $['agentDetail.monitoring.timeRangeLabel'])}
|
||||||
className="mt-0 h-auto w-20 shrink-0 border-0 bg-transparent p-0 hover:bg-transparent focus-visible:bg-transparent [&>*:last-child]:hidden"
|
className="w-fit shrink-0 cursor-pointer gap-1.5 pr-2 pl-3"
|
||||||
>
|
>
|
||||||
<div className="flex h-8 w-full cursor-pointer items-center justify-between rounded-lg bg-components-input-bg-normal pr-2 pl-3 group-data-popup-open:bg-state-base-hover-alt">
|
{selectedRange === 'custom'
|
||||||
<div className="system-sm-regular text-components-input-text-filled">
|
? t(($) => $['agentDetail.monitoring.timeRanges.custom'])
|
||||||
{selectedRange === 'custom'
|
: selectedOption
|
||||||
? t(($) => $['agentDetail.monitoring.timeRanges.custom'])
|
? t(($) => $[selectedOption.nameKey])
|
||||||
: selectedOption
|
: value.name}
|
||||||
? t(($) => $[selectedOption.nameKey])
|
|
||||||
: value.name}
|
|
||||||
</div>
|
|
||||||
<span
|
|
||||||
aria-hidden
|
|
||||||
className="i-ri-arrow-down-s-line size-4 text-text-quaternary group-data-popup-open:text-text-secondary"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent className="translate-x-[-24px]" popupClassName="w-50" listClassName="p-1">
|
<SelectContent popupClassName="w-50">
|
||||||
{timeRangeOptions.map((option) => (
|
{timeRangeOptions.map((option) => (
|
||||||
<SelectItem
|
<SelectItem key={option.value} value={option.value}>
|
||||||
key={option.value}
|
<SelectItemText>{t(($) => $[option.nameKey])}</SelectItemText>
|
||||||
value={option.value}
|
<SelectItemIndicator />
|
||||||
className="h-8 py-0 pr-2 pl-7 system-md-regular"
|
|
||||||
>
|
|
||||||
<SelectItemText className="px-0">{t(($) => $[option.nameKey])}</SelectItemText>
|
|
||||||
<SelectItemIndicator className="absolute top-2 left-2 ml-0" />
|
|
||||||
</SelectItem>
|
</SelectItem>
|
||||||
))}
|
))}
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user