From 2b27820da84f0a17eb41c65ba0988d745cdd4400 Mon Sep 17 00:00:00 2001 From: CPAlejandro Date: Thu, 11 Feb 2021 10:37:12 +0100 Subject: [PATCH 1/3] Fixed that alerts table is empty when switching pinned agents --- public/components/common/modules/discover/discover.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/public/components/common/modules/discover/discover.tsx b/public/components/common/modules/discover/discover.tsx index 0c28f3db78..88593b3373 100644 --- a/public/components/common/modules/discover/discover.tsx +++ b/public/components/common/modules/discover/discover.tsx @@ -190,6 +190,9 @@ export const Discover = compose( this.setState({ query: {...this.props.query}}); return; }; + if(!_.isEqual(this.props.shareFilterManager, this.state.searchBarFilters)){ + this.setState({columns: this.getColumns(), searchBarFilters: this.props.shareFilterManager || []}); //initial columns + }; if((!_.isEqual(this.props.shareFilterManager, prevProps.shareFilterManager)) || (this.props.currentAgentData.id !== prevProps.currentAgentData.id) || (!_.isEqual(this.state.query, prevState.query)) @@ -339,7 +342,11 @@ export const Discover = compose( } async getAlerts() { - if (!this.indexPattern || this.state.isLoading) return; + if (!this.indexPattern) return; + if (this.state.isLoading){ + this.getAlerts(); + return; + } //compare filters so we only make a request into Elasticsearch if needed const newFilters = this.buildFilter(); try { From 38abbd0cbbe4fb586c4f8036f6a8d792e7725fd7 Mon Sep 17 00:00:00 2001 From: CPAlejandro Date: Thu, 11 Feb 2021 12:31:03 +0100 Subject: [PATCH 2/3] Made changes in the position of the if --- .../components/common/modules/discover/discover.tsx | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/public/components/common/modules/discover/discover.tsx b/public/components/common/modules/discover/discover.tsx index 88593b3373..633f8e0753 100644 --- a/public/components/common/modules/discover/discover.tsx +++ b/public/components/common/modules/discover/discover.tsx @@ -190,9 +190,6 @@ export const Discover = compose( this.setState({ query: {...this.props.query}}); return; }; - if(!_.isEqual(this.props.shareFilterManager, this.state.searchBarFilters)){ - this.setState({columns: this.getColumns(), searchBarFilters: this.props.shareFilterManager || []}); //initial columns - }; if((!_.isEqual(this.props.shareFilterManager, prevProps.shareFilterManager)) || (this.props.currentAgentData.id !== prevProps.currentAgentData.id) || (!_.isEqual(this.state.query, prevState.query)) @@ -201,9 +198,11 @@ export const Discover = compose( || (this.props.refreshAngularDiscover !== prevProps.refreshAngularDiscover) ){ this.setState({ pageIndex: 0 , tsUpdated: Date.now()}); + if(!_.isEqual(this.props.shareFilterManager, this.state.searchBarFilters)){ + this.setState({columns: this.getColumns(), searchBarFilters: this.props.shareFilterManager || []}); //initial columns + } return; }; - if(['pageIndex', 'pageSize', 'sortField', 'sortDirection'].some(field => this.state[field] !== prevState[field]) || (this.state.tsUpdated !== prevState.tsUpdated)){ try { await this.getAlerts(); @@ -342,11 +341,7 @@ export const Discover = compose( } async getAlerts() { - if (!this.indexPattern) return; - if (this.state.isLoading){ - this.getAlerts(); - return; - } + if (!this.indexPattern || this.state.isLoading) return; //compare filters so we only make a request into Elasticsearch if needed const newFilters = this.buildFilter(); try { From 6d0012ff82ab2c20b797a1c5264ef52238856fac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Mart=C3=ADnez?= Date: Thu, 18 Feb 2021 18:18:14 +0100 Subject: [PATCH 3/3] Changelog updated --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a9857e98a1..d87204e946 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to the Wazuh app project will be documented in this file. +## Wazuh v4.1.1 - Kibana 7.10.0 , 7.10.2 - Revision 4102 + +### Fixed + +- Fixed alerts table is empty when switching pinned agents [#2956](https://github.com/wazuh/wazuh-kibana-app/pull/2956) + ## Wazuh v4.1.0 - Kibana 7.10.0 , 7.10.2 - Revision 4101 ### Added