From 1568f964df3ed3e07650dcdb1109c63bf45f4568 Mon Sep 17 00:00:00 2001 From: Maksym Yadlovskyi Date: Fri, 10 Jan 2025 13:54:37 +0100 Subject: [PATCH 1/4] Add a feature flag which hides the Executive Dashboard from the user. --- .../resources/org/graylog2/featureflag/feature-flag.config | 3 +++ 1 file changed, 3 insertions(+) diff --git a/graylog2-server/src/main/resources/org/graylog2/featureflag/feature-flag.config b/graylog2-server/src/main/resources/org/graylog2/featureflag/feature-flag.config index 598fc99fe0bf..c6cd2305c6e3 100644 --- a/graylog2-server/src/main/resources/org/graylog2/featureflag/feature-flag.config +++ b/graylog2-server/src/main/resources/org/graylog2/featureflag/feature-flag.config @@ -96,3 +96,6 @@ setup_mode=off # Show security events in paginated entity data table show_security_events_in_pedt=off + +# Show executive dashboard +show_executive_dashboard_page=off From a0f8ece4a96dc9b224642d76b9bb5173bfb67a29 Mon Sep 17 00:00:00 2001 From: Maksym Yadlovskyi Date: Fri, 10 Jan 2025 14:05:03 +0100 Subject: [PATCH 2/4] Revert "Add a feature flag which hides the Executive Dashboard from the user." This reverts commit 2bee26679ebe739e518dbf3e0854191d1edb5ce2. --- .../resources/org/graylog2/featureflag/feature-flag.config | 3 --- 1 file changed, 3 deletions(-) diff --git a/graylog2-server/src/main/resources/org/graylog2/featureflag/feature-flag.config b/graylog2-server/src/main/resources/org/graylog2/featureflag/feature-flag.config index c6cd2305c6e3..598fc99fe0bf 100644 --- a/graylog2-server/src/main/resources/org/graylog2/featureflag/feature-flag.config +++ b/graylog2-server/src/main/resources/org/graylog2/featureflag/feature-flag.config @@ -96,6 +96,3 @@ setup_mode=off # Show security events in paginated entity data table show_security_events_in_pedt=off - -# Show executive dashboard -show_executive_dashboard_page=off From 77e884e6bc0a8b082cf44c11970a9b22628f2a7a Mon Sep 17 00:00:00 2001 From: Maksym Yadlovskyi Date: Mon, 13 Jan 2025 15:39:24 +0100 Subject: [PATCH 3/4] Add dependency array to useCreateSavedSearch hook --- changelog/unreleased/issue-20465.toml | 5 +++++ .../views/logic/views/UseCreateSavedSearch.ts | 19 +++++++++++-------- .../src/views/pages/StreamSearchPage.test.tsx | 11 ++++++----- .../src/views/pages/StreamSearchPage.tsx | 2 +- 4 files changed, 23 insertions(+), 14 deletions(-) create mode 100644 changelog/unreleased/issue-20465.toml diff --git a/changelog/unreleased/issue-20465.toml b/changelog/unreleased/issue-20465.toml new file mode 100644 index 000000000000..18220abe43a5 --- /dev/null +++ b/changelog/unreleased/issue-20465.toml @@ -0,0 +1,5 @@ +type = "f" +message = "Fixed the issue when the streams link in the message table was not working on the streams page." + +issues=["20465"] +pulls = [""] diff --git a/graylog2-web-interface/src/views/logic/views/UseCreateSavedSearch.ts b/graylog2-web-interface/src/views/logic/views/UseCreateSavedSearch.ts index 57ab09a9872b..d6bc718f796f 100644 --- a/graylog2-web-interface/src/views/logic/views/UseCreateSavedSearch.ts +++ b/graylog2-web-interface/src/views/logic/views/UseCreateSavedSearch.ts @@ -21,22 +21,25 @@ import type { ElasticsearchQueryString, TimeRange } from 'views/logic/queries/Qu import ViewGenerator from 'views/logic/views/ViewGenerator'; import type Parameter from 'views/logic/parameters/Parameter'; +type Props = { + streamId?: string | string[], + streamCategory?: string | string[], + timeRange?: TimeRange, + queryString?: ElasticsearchQueryString, + parameters?: Array, +} + +type Deps = Array | []; const useCreateSavedSearch = ({ streamId, streamCategory, timeRange, queryString, parameters, -}:{ - streamId?: string | string[], - streamCategory?: string | string[], - timeRange?: TimeRange, - queryString?: ElasticsearchQueryString, - parameters?: Array, -}) => useMemo( +}:Props, deps: Deps = []) => useMemo( () => ViewGenerator({ type: View.Type.Search, streamId, streamCategory, timeRange, queryString, parameters }), // eslint-disable-next-line react-hooks/exhaustive-deps - [], + deps, ); export default useCreateSavedSearch; diff --git a/graylog2-web-interface/src/views/pages/StreamSearchPage.test.tsx b/graylog2-web-interface/src/views/pages/StreamSearchPage.test.tsx index af500aba9364..9815a4952109 100644 --- a/graylog2-web-interface/src/views/pages/StreamSearchPage.test.tsx +++ b/graylog2-web-interface/src/views/pages/StreamSearchPage.test.tsx @@ -86,19 +86,20 @@ describe('StreamSearchPage', () => { queryString: undefined, streamId: 'stream-id-1', timeRange: undefined, - })); + }, [streamId])); }); - it('should recreate view when streamId passed from props changes', async () => { + it('should rerender hook when streamId passed from props changes', async () => { const { rerender } = render(); await waitFor(() => expect(useCreateSavedSearch).toHaveBeenCalledWith({ queryString: undefined, streamId: 'stream-id-1', timeRange: undefined, - })); + }, [streamId])); - asMock(useParams).mockReturnValue({ streamId: 'stream-id-2' }); + const secondStream = 'stream-id-2'; + asMock(useParams).mockReturnValue({ streamId: secondStream }); rerender(); @@ -106,7 +107,7 @@ describe('StreamSearchPage', () => { queryString: undefined, streamId: 'stream-id-2', timeRange: undefined, - })); + }, [secondStream])); }); describe('loading another view', () => { diff --git a/graylog2-web-interface/src/views/pages/StreamSearchPage.tsx b/graylog2-web-interface/src/views/pages/StreamSearchPage.tsx index 0ae1bebb966a..67f064609f9b 100644 --- a/graylog2-web-interface/src/views/pages/StreamSearchPage.tsx +++ b/graylog2-web-interface/src/views/pages/StreamSearchPage.tsx @@ -35,7 +35,7 @@ const StreamSearchPage = () => { } const { timeRange, queryString } = useSearchURLQueryParams(); - const viewPromise = useCreateSavedSearch({ streamId, timeRange, queryString }); + const viewPromise = useCreateSavedSearch({ streamId, timeRange, queryString }, [streamId]); const view = useCreateSearch(viewPromise); const _loadNewView = useCallback(() => loadNewViewForStream(history, streamId), [history, streamId]); From 04b805ac8ce66051f79a16e45ac9ba60c49e4069 Mon Sep 17 00:00:00 2001 From: Maksym Yadlovskyi Date: Mon, 13 Jan 2025 15:40:16 +0100 Subject: [PATCH 4/4] changelog --- changelog/unreleased/issue-20465.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog/unreleased/issue-20465.toml b/changelog/unreleased/issue-20465.toml index 18220abe43a5..80bc3da35f75 100644 --- a/changelog/unreleased/issue-20465.toml +++ b/changelog/unreleased/issue-20465.toml @@ -2,4 +2,4 @@ type = "f" message = "Fixed the issue when the streams link in the message table was not working on the streams page." issues=["20465"] -pulls = [""] +pulls = ["21338"]