diff --git a/changelog/unreleased/pr-18241.toml b/changelog/unreleased/pr-18241.toml new file mode 100644 index 000000000000..d063a74009aa --- /dev/null +++ b/changelog/unreleased/pr-18241.toml @@ -0,0 +1,4 @@ +type = "f" +message = "Do not display info for dashboard query filter in aggregation builder, when dashboard query is empty" + +pulls = ["18241"] diff --git a/graylog2-web-interface/src/views/components/WidgetQueryControls.test.tsx b/graylog2-web-interface/src/views/components/WidgetQueryControls.test.tsx index 422f006b9466..097ae11d5157 100644 --- a/graylog2-web-interface/src/views/components/WidgetQueryControls.test.tsx +++ b/graylog2-web-interface/src/views/components/WidgetQueryControls.test.tsx @@ -133,7 +133,14 @@ describe('WidgetQueryControls', () => { renderSUT(); expect(screen.queryByRole('button', { name: resetTimeRangeButtonTitle })).toBeNull(); - expect(screen.queryByRole('button', { name: resetTimeRangeButtonTitle })).toBeNull(); + expect(screen.queryByRole('button', { name: resetQueryButtonTitle })).toBeNull(); + }); + + it('does not show global override query indicator if global override query is an object with an empty query string', async () => { + asMock(useGlobalOverride).mockReturnValue(GlobalOverride.create(undefined, { type: 'elasticsearch', query_string: '' })); + renderSUT(); + + expect(screen.queryByRole('button', { name: resetQueryButtonTitle })).toBeNull(); }); it('triggers resetting global override when reset time range override button is clicked', async () => { diff --git a/graylog2-web-interface/src/views/components/WidgetQueryControls.tsx b/graylog2-web-interface/src/views/components/WidgetQueryControls.tsx index 41dbae7338fa..81c7feb00d79 100644 --- a/graylog2-web-interface/src/views/components/WidgetQueryControls.tsx +++ b/graylog2-web-interface/src/views/components/WidgetQueryControls.tsx @@ -171,7 +171,7 @@ const WidgetQueryControls = ({ availableStreams }: Props) => { const pluggableSearchBarControls = usePluginEntities('views.components.searchBar'); const limitDuration = moment.duration(config?.query_time_range_limit).asSeconds() ?? 0; const hasTimeRangeOverride = globalOverride?.timerange !== undefined; - const hasQueryOverride = globalOverride?.query !== undefined; + const hasQueryOverride = !!globalOverride?.query?.query_string; const formRef = useRef(null); const { parameters } = useParameters(); const handlerContext = useHandlerContext();