diff --git a/CHANGELOG.md b/CHANGELOG.md index e75b867862..224520e071 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ All notable changes to the Wazuh app project will be documented in this file. - Improvement of the filter management system by implementing new standard modules [#6534](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6534) [#6772](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6772) [#6873](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6873) - Changed permalink field in the Events tab table in Virustotal to show an external link [#6839](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6839) - Changed the logging system to use the provided by the platform [#6161](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6161) +- Changed the display of rule details flyout to be based on URL [#6886](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6886) ### Fixed diff --git a/plugins/main/public/controllers/management/components/management/ruleset/components/ruleset-table.tsx b/plugins/main/public/controllers/management/components/management/ruleset/components/ruleset-table.tsx index cfbe1de5bb..01983217fb 100644 --- a/plugins/main/public/controllers/management/components/management/ruleset/components/ruleset-table.tsx +++ b/plugins/main/public/controllers/management/components/management/ruleset/components/ruleset-table.tsx @@ -10,7 +10,7 @@ * Find more information about this on the LICENSE file. */ -import React, { useEffect, useState, useCallback } from 'react'; +import React, { useState, useCallback } from 'react'; import { getToasts } from '../../../../../../kibana-services'; import { resourceDictionary, @@ -38,7 +38,9 @@ import { } from '../../common/actions-buttons'; import apiSuggestsItems from './ruleset-suggestions'; -import { useRouterSearch } from '../../../../../../components/common/hooks'; +import { Route, Switch } from '../../../../../../components/router-search'; +import { withRouterSearch } from '../../../../../../components/common/hocs'; +import NavigationService from '../../../../../../react-services/navigation-service'; const searchBarWQLOptions = { searchTermFields: [ @@ -107,52 +109,60 @@ const FilesTable = ({ /> ); -const RulesFlyoutTable = ({ - actionButtons, - columns, - searchBarSuggestions, - filters, - updateFilters, - getRowProps, - isFlyoutVisible, - currentItem, - closeFlyout, - cleanFilters, - ...props -}) => ( - <> - - {isFlyoutVisible && ( - ( + <> + - )} - + + ( + { + NavigationService.getInstance().updateAndNavigateSearchParams({ + redirectRule: null, + }); + }} + showViewInEvents={true} + outsideClickCloses={true} + filters={filters} + onFiltersChange={updateFilters} + cleanFilters={cleanFilters} + {...props} + /> + )} + > + + + ), ); /*************************************** @@ -160,23 +170,10 @@ const RulesFlyoutTable = ({ */ function RulesetTable({ setShowingFiles, showingFiles, ...props }) { const [filters, setFilters] = useState([]); - const [isFlyoutVisible, setIsFlyoutVisible] = useState(false); - const [currentItem, setCurrentItem] = useState(null); - const search = useRouterSearch(); - const [tableFootprint, setTableFootprint] = useState(0); const resourcesHandler = new ResourcesHandler(ResourcesConstants.RULES); - useEffect(() => { - if (search.redirectRule) { - // TODO: the view to display the specific group should be managed through the routing based on - // the URL instead of a component state. This lets refreshing the page and display the same view - setCurrentItem(parseInt(search.redirectRule)); - setIsFlyoutVisible(true); - } - }, []); - const updateFilters = filters => { setFilters(filters); }; @@ -190,10 +187,6 @@ function RulesetTable({ setShowingFiles, showingFiles, ...props }) { setShowingFiles(!showingFiles); }; - const closeFlyout = () => { - setIsFlyoutVisible(false); - }; - /** * Remove files method */ @@ -266,8 +259,9 @@ function RulesetTable({ setShowingFiles, showingFiles, ...props }) { props.userPermissions, ) ? item => { - setCurrentItem(id); - setIsFlyoutVisible(true); + NavigationService.getInstance().updateAndNavigateSearchParams({ + redirectRule: id, + }); } : undefined, }; @@ -326,9 +320,6 @@ function RulesetTable({ setShowingFiles, showingFiles, ...props }) { filters={filters} updateFilters={updateFilters} getRowProps={getRowProps} - isFlyoutVisible={isFlyoutVisible} - currentItem={currentItem} - closeFlyout={closeFlyout} cleanFilters={cleanFilters} updateFileContent={updateFileContent} />