fix(ui): SearchableValueSelect 支持 commitOnType,恢复域名边打边筛
设计补刀:域名筛换成可搜 Select 后丢失「键入即过滤当前页」。新增 commitOnType——键入即 onChange、列表当建议、「全部」清空;长选项 truncate+title。域名筛启用;采集器 sidecar 命名空间/工作负载长列表一并改为可搜(同刀)。
This commit is contained in:
1 parent
8c9f5a95f8
commit
305d7c5904
3 files changed
+50
-24
No files matched your search
@@ -22,6 +22,7 @@ import {
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from '@/components/ui/select'
|
||||
import { SearchableValueSelect } from '@/components/SearchableValueSelect'
|
||||
import {
|
||||
Form,
|
||||
FormControl,
|
||||
@@ -367,15 +368,19 @@ export const CollectorFormDialog = memo(function CollectorFormDialog({
|
||||
<FormLabel>{t('form.namespace')}{isSidecarType ? ' *' : ''}</FormLabel>
|
||||
<FormControl>
|
||||
{isSidecarType && !manualNamespace ? (
|
||||
<Select value={field.value} onValueChange={(value) => {
|
||||
field.onChange(value)
|
||||
form.setValue('targetDeployment', '')
|
||||
}} disabled={!clusterID || namespacesLoading}>
|
||||
<SelectTrigger><SelectValue placeholder={!clusterID ? t('form.nsPickCluster') : namespacesLoading ? t('form.nsLoading') : t('form.nsPick')} /></SelectTrigger>
|
||||
<SelectContent>
|
||||
{namespaces.map((item) => <SelectItem key={item} value={item}>{item}</SelectItem>)}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<SearchableValueSelect
|
||||
hideLabel
|
||||
ariaLabel={t('form.namespace')}
|
||||
values={namespaces}
|
||||
value={field.value}
|
||||
onChange={(value) => {
|
||||
field.onChange(value)
|
||||
form.setValue('targetDeployment', '')
|
||||
}}
|
||||
loading={namespacesLoading}
|
||||
disabled={!clusterID || namespacesLoading}
|
||||
placeholder={!clusterID ? t('form.nsPickCluster') : namespacesLoading ? t('form.nsLoading') : t('form.nsPick')}
|
||||
/>
|
||||
) : (
|
||||
<Input placeholder={collectorType === 'k8s-daemonset' ? 'logging' : 'default'} {...field} onChange={(event) => {
|
||||
field.onChange(event)
|
||||
@@ -405,14 +410,16 @@ export const CollectorFormDialog = memo(function CollectorFormDialog({
|
||||
{manualDeployment ? (
|
||||
<Input placeholder="my-app" {...field} />
|
||||
) : (
|
||||
<Select value={field.value} onValueChange={field.onChange} disabled={!namespace || workloadsLoading}>
|
||||
<SelectTrigger><SelectValue placeholder={!namespace ? t('form.wlPickNamespace') : workloadsLoading ? t('form.wlLoading') : t('form.wlPick')} /></SelectTrigger>
|
||||
<SelectContent>
|
||||
{workloads.map((item) => <SelectItem key={item.name} value={item.name}>
|
||||
{item.name}{t('form.wlReady', { ready: item.readyReplicas, total: item.replicas })}
|
||||
</SelectItem>)}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<SearchableValueSelect
|
||||
hideLabel
|
||||
ariaLabel={t('form.targetDeployment')}
|
||||
values={workloads.map((item) => item.name)}
|
||||
value={field.value}
|
||||
onChange={field.onChange}
|
||||
loading={workloadsLoading}
|
||||
disabled={!namespace || workloadsLoading}
|
||||
placeholder={!namespace ? t('form.wlPickNamespace') : workloadsLoading ? t('form.wlLoading') : t('form.wlPick')}
|
||||
/>
|
||||
)}
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
|
||||
@@ -59,6 +59,7 @@ export function LogResultsPanel({ entries, searched, hasSource, pageIndex, hasNe
|
||||
onChange={setDomainFilter}
|
||||
allowEmpty
|
||||
emptyLabel={t('results.domainAll')}
|
||||
commitOnType
|
||||
placeholder={t('results.domainPlaceholder')}
|
||||
className="min-w-60"
|
||||
triggerClassName="h-8"
|
||||
|
||||
Reference in new issue
Block a user