From 8179b35be871905c4b8f7917235d1e78a9856938 Mon Sep 17 00:00:00 2001 From: Andreas Gerstmayr Date: Thu, 9 Oct 2025 14:14:40 +0200 Subject: [PATCH] COO-1118: Show an actionable error message if the namespace filter is empty Signed-off-by: Andreas Gerstmayr --- .../plugin__distributed-tracing-console-plugin.json | 2 +- web/src/components/TypeaheadCheckboxSelect.tsx | 5 +++-- .../pages/TracesPage/Toolbar/AttributeFilters.tsx | 13 ++++++++++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/web/locales/en/plugin__distributed-tracing-console-plugin.json b/web/locales/en/plugin__distributed-tracing-console-plugin.json index 293f452..bad7121 100644 --- a/web/locales/en/plugin__distributed-tracing-console-plugin.json +++ b/web/locales/en/plugin__distributed-tracing-console-plugin.json @@ -21,12 +21,12 @@ "Trace": "Trace", "Tracing": "Tracing", "Limit traces": "Limit traces", - "No datapoints found.": "No datapoints found.", "Hide graph": "Hide graph", "Show graph": "Show graph", "Filter": "Filter", "Filter by namespace": "Filter by namespace", "This filter is based on the <1>k8s.namespace.name resource attribute. To set this attribute, it is recommended to enable the <4>Kubernetes Attributes Processor in your OpenTelemetry Collector pipeline.": "This filter is based on the <1>k8s.namespace.name resource attribute. To set this attribute, it is recommended to enable the <4>Kubernetes Attributes Processor in your OpenTelemetry Collector pipeline.", + "No results found. Please ensure that the <2>Kubernetes Attributes Processor<3>is enabled in your OpenTelemetry collector pipeline.": "No results found. Please ensure that the <2>Kubernetes Attributes Processor<3>is enabled in your OpenTelemetry collector pipeline.", "between {{min}} and {{max}}": "between {{min}} and {{max}}", "greater than {{min}}": "greater than {{min}}", "less than {{max}}": "less than {{max}}", diff --git a/web/src/components/TypeaheadCheckboxSelect.tsx b/web/src/components/TypeaheadCheckboxSelect.tsx index 408ca39..550dc98 100644 --- a/web/src/components/TypeaheadCheckboxSelect.tsx +++ b/web/src/components/TypeaheadCheckboxSelect.tsx @@ -16,6 +16,7 @@ import { TypeaheadSelectOption } from '@patternfly/react-templates'; export interface TypeaheadCheckboxSelectProps { placeholder: string; + noResultsFoundText?: React.ReactNode; toggleWidth?: string; isCreatable?: boolean; style?: CSSProperties; @@ -102,7 +103,7 @@ export function TypeaheadCheckboxSelect(props: TypeaheadCheckboxSelectProps) { newSelectOptions = [ { isAriaDisabled: true, - children: `No results found`, + children: props.noResultsFoundText ?? `No results found`, value: NO_RESULTS, hasCheckbox: false, }, @@ -110,7 +111,7 @@ export function TypeaheadCheckboxSelect(props: TypeaheadCheckboxSelectProps) { } setSelectOptions(newSelectOptions); - }, [inputValue, initialSelectOptions, isOpen, props.isCreatable]); + }, [inputValue, initialSelectOptions, isOpen, props.isCreatable, props.noResultsFoundText]); const createItemId = (value: string) => `select-multi-typeahead-${value.replace(' ', '-')}`; diff --git a/web/src/pages/TracesPage/Toolbar/AttributeFilters.tsx b/web/src/pages/TracesPage/Toolbar/AttributeFilters.tsx index 150a347..aac47d8 100644 --- a/web/src/pages/TracesPage/Toolbar/AttributeFilters.tsx +++ b/web/src/pages/TracesPage/Toolbar/AttributeFilters.tsx @@ -148,6 +148,14 @@ export function AttributeFilters(props: AttributeFiltersProps) { } + noResultsFoundText={ + + No results found. Please ensure that the{' '} + Kubernetes Attributes Processor +
+ is enabled in your OpenTelemetry collector pipeline. +
+ } show={activeFilter === namespaceFilter.value} options={namespaceOptions ?? []} value={filter.namespace} @@ -186,6 +194,7 @@ interface TypeaheadStringAttributeFilterProps { filterName: string; label?: React.ReactNode; labelHelp?: React.ReactElement; + noResultsFoundText?: React.ReactNode; show?: boolean; options: TypeaheadSelectOption[]; value: string[]; @@ -193,7 +202,8 @@ interface TypeaheadStringAttributeFilterProps { } function TypeaheadStringAttributeFilter(props: TypeaheadStringAttributeFilterProps) { - const { filterName, label, labelHelp, show, options, value, setValue } = props; + const { filterName, label, labelHelp, noResultsFoundText, show, options, value, setValue } = + props; return ( 0 ? ' (' + value.length + ')' : '' }`} + noResultsFoundText={noResultsFoundText} options={options} value={value} setValue={setValue}