diff --git a/CHANGELOG.md b/CHANGELOG.md index 662ce5ff43..aac05a217d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ All notable changes to the Wazuh app project will be documented in this file. ### Fixed - Fixed a problem with the agent menu header when the side menu is docked [#5840](https://github.com/wazuh/wazuh-dashboard-plugins/pull/5840) +- Fixed how the query filters apply on the Security Alerts table [#6102](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6102) ### Removed diff --git a/plugins/main/public/components/common/hooks/use-query.ts b/plugins/main/public/components/common/hooks/use-query.ts index c3838414a4..4a79c5843b 100644 --- a/plugins/main/public/components/common/hooks/use-query.ts +++ b/plugins/main/public/components/common/hooks/use-query.ts @@ -11,38 +11,6 @@ */ import { getDataPlugin } from '../../../kibana-services'; import { useState, useEffect } from 'react'; -import { ModulesHelper } from '../modules/modules-helper'; -import _ from 'lodash'; - -export function useQuery(): [ - { - language: 'kuery' | 'lucene'; - query: string; - }, - (query: any) => void -] { - const [query, setQuery] = useState({ language: 'kuery', query: '' }); - useEffect(() => { - let subscription; - ModulesHelper.getDiscoverScope().then((scope) => { - setQuery(scope.state.query); - subscription = scope.$watchCollection('fetchStatus', () => { - if (!_.isEqual(query, scope.state.query)) { - setQuery(scope.state.query); - } - }); - }); - return () => { - subscription && subscription(); - }; - }, []); - const updateQuery = (query) => { - ModulesHelper.getDiscoverScope().then((scope) => { - scope.state.query = query; - }); - }; - return [query, updateQuery]; -} export const useQueryManager = () => { const [query, setQuery] = useState(getDataPlugin().query.queryString.getQuery()); diff --git a/plugins/main/public/components/visualize/components/security-alerts.tsx b/plugins/main/public/components/visualize/components/security-alerts.tsx index 0dcd529df2..93459e76ac 100644 --- a/plugins/main/public/components/visualize/components/security-alerts.tsx +++ b/plugins/main/public/components/visualize/components/security-alerts.tsx @@ -10,7 +10,7 @@ * Find more information about this on the LICENSE file. */ import React from 'react'; -import { useFilterManager, useQuery, useRefreshAngularDiscover } from '../../common/hooks'; +import { useFilterManager, useQueryManager, useRefreshAngularDiscover } from '../../common/hooks'; import { Discover } from '../../common/modules/discover'; import { useAllowedAgents } from '../../common/hooks/useAllowedAgents'; @@ -37,7 +37,7 @@ export const SecurityAlerts = ({ ], useAgentColumns = true, }) => { - const [query] = useQuery(); + const [query] = useQueryManager(); const { filterManager } = useFilterManager(); const refreshAngularDiscover = useRefreshAngularDiscover();