From 6f05431966ee0e9d136bb0e6e01a6e27dda7a13a Mon Sep 17 00:00:00 2001 From: Antonio <34042064+Desvelao@users.noreply.github.com> Date: Tue, 20 Dec 2022 11:47:18 +0100 Subject: [PATCH] [Backport 4.4-2.4-wzd] Fixed Inventory checks table filters by stats (#4999) (#5005) Fixed Inventory checks table filters by stats (#4999) * Fixed checks table filters by stats * Updated CHANGELOG * Fixed no applicable filter (cherry picked from commit 6e8c94263c5faeb0d02b2b38786d4026b20fb137) Co-authored-by: Maximiliano Ibarra <6089438+Machi3mfl@users.noreply.github.com> --- CHANGELOG.md | 1 + public/components/agents/sca/inventory.tsx | 3 ++- .../components/agents/sca/inventory/checks-table.tsx | 12 +++++++++--- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a27097c1a..16ca586eb1 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. - Fixed WAZUH_PROTOCOL param suggestion [#4849](https://github.com/wazuh/wazuh-kibana-app/pull/4849) - Raspbian OS, Ubuntu, Amazon Linux and Amazon Linux 2 commands in the wizard deploy agent now change when a different architecture is selected [#4876](https://github.com/wazuh/wazuh-kibana-app/pull/4876) [#4880](https://github.com/wazuh/wazuh-kibana-app/pull/4880) - Fixed a bug that caused the flyouts to close when clicking inside them [#4638](https://github.com/wazuh/wazuh-kibana-app/pull/4638) +- Fixed Inventory checks table filters by stats [#4999](https://github.com/wazuh/wazuh-kibana-app/pull/4999) - Fixed agent graph in opensearch dashboard [#4942] (https://github.com/wazuh/wazuh-kibana-app/pull/4942) - Fixed commands in the deploy new agent section(most of the commands are missing '-1') [#4962](https://github.com/wazuh/wazuh-kibana-app/pull/4962) - Fixed agent installation command for macOS in the deploy new agent section. [#4968](https://github.com/wazuh/wazuh-kibana-app/pull/4968) diff --git a/public/components/agents/sca/inventory.tsx b/public/components/agents/sca/inventory.tsx index d5de1ed4ef..45db9d3725 100644 --- a/public/components/agents/sca/inventory.tsx +++ b/public/components/agents/sca/inventory.tsx @@ -544,7 +544,7 @@ export class Inventory extends Component { { diff --git a/public/components/agents/sca/inventory/checks-table.tsx b/public/components/agents/sca/inventory/checks-table.tsx index d31d614e99..190d638382 100644 --- a/public/components/agents/sca/inventory/checks-table.tsx +++ b/public/components/agents/sca/inventory/checks-table.tsx @@ -8,6 +8,7 @@ import { getFilterValues } from './lib'; type Props = { agent: { [key: string]: any }; lookingPolicy: { [key: string]: any }; + filters: any[]; }; type State = { @@ -24,12 +25,12 @@ export class InventoryPolicyChecksTable extends Component { columnsChecks: any; constructor(props) { super(props); - const { agent, lookingPolicy } = this.props; + const { agent, lookingPolicy, filters } = this.props; this.state = { agent, lookingPolicy, itemIdToExpandedRowMap: {}, - filters: [], + filters: filters || [], pageTableChecks: { pageIndex: 0 }, }; this.suggestions = [ @@ -208,7 +209,12 @@ export class InventoryPolicyChecksTable extends Component { async componentDidMount() {} - async componentDidUpdate(prevProps, prevState) {} + async componentDidUpdate(prevProps) { + const { filters } = this.props + if (filters !== prevProps.filters) { + this.setState({ filters: filters }); + } + } componentWillUnmount() { this._isMount = false;