From 4d614ee4b43cf2f63c3d7d3bc917a234e3e22d64 Mon Sep 17 00:00:00 2001 From: Vincent Fiduccia Date: Wed, 6 Jan 2021 16:28:50 -0700 Subject: [PATCH] Fix duplicate expressions and null values --- components/form/MatchExpressions.vue | 4 +++- edit/fleet.cattle.io.clustergroup.vue | 12 +++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/components/form/MatchExpressions.vue b/components/form/MatchExpressions.vue index 046028fb817..26e4e79e5c2 100644 --- a/components/form/MatchExpressions.vue +++ b/components/form/MatchExpressions.vue @@ -160,7 +160,9 @@ export default { return; } - matchExpression.values = val ? val.split(/\s*,\s*/).filter(x => !!x) : null; + if ( val !== null ) { + matchExpression.values = val.split(/\s*,\s*/).filter(x => !!x); + } return matchExpression; }).filter(x => !!x); diff --git a/edit/fleet.cattle.io.clustergroup.vue b/edit/fleet.cattle.io.clustergroup.vue index f9f1c041871..19738a06e83 100644 --- a/edit/fleet.cattle.io.clustergroup.vue +++ b/edit/fleet.cattle.io.clustergroup.vue @@ -38,7 +38,12 @@ export default { }; } - this.updateMatchingClusters(); + const expressions = convert( + this.value.spec.selector.matchLabels || {}, + this.value.spec.selector.matchExpressions || [] + ); + + this.matchChanged(expressions); }, data() { @@ -46,10 +51,7 @@ export default { allClusters: null, allWorkspaces: null, matchingClusters: null, - expressions: [ - ...convert(this.value.spec.selector.matchLabels || {}), - ...(this.value.spec.selector.matchExpressions || []), - ], + expressions: null, }; },