From 7fd3ba930f7ecd4086313a75f63f26906ff0bc1b Mon Sep 17 00:00:00 2001 From: Dmytro Bukhanets Date: Wed, 18 Apr 2018 17:08:59 +0200 Subject: [PATCH] fixing cluster and scope filtration --- client/lib/application/src/cluster-list.jsx | 4 ++-- client/lib/application/src/folded-scope-list.jsx | 12 +++++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/client/lib/application/src/cluster-list.jsx b/client/lib/application/src/cluster-list.jsx index b17a13b3..d306bef8 100644 --- a/client/lib/application/src/cluster-list.jsx +++ b/client/lib/application/src/cluster-list.jsx @@ -7,7 +7,7 @@ class ClusterList extends React.Component { super(); this.state = { term: '', - filtered: props.clusters, + filtered: props.clusters || [], selected: props.selected || [] }; } @@ -42,7 +42,7 @@ class ClusterList extends React.Component { this.setState({ term: term, filtered: term.length ? - this.props.clusters.filter(c => c.alias.indexOf(term) >= 0 || this.state.selected.some(s => s === c.id)) : + this.props.clusters.filter(c => c.alias.indexOf(term) >= 0 || (this.state.selected && this.state.selected.some(s => s === c.id))) : this.props.clusters }); } diff --git a/client/lib/application/src/folded-scope-list.jsx b/client/lib/application/src/folded-scope-list.jsx index 648955e8..ad1bf801 100644 --- a/client/lib/application/src/folded-scope-list.jsx +++ b/client/lib/application/src/folded-scope-list.jsx @@ -25,13 +25,11 @@ class OwnerScopeList extends ScopeList { } componentWillReceiveProps(nextProps) { - if (!this.state.term.length) { - this.setState({ - filtered: nextProps.scopes, - selected: nextProps.selected, - allResources: nextProps.allResources - }); - } + this.setState({ + filtered: nextProps.scopes, + selected: nextProps.selected, + allResources: nextProps.allResources + }); } toggleFolding(resourceType) {