Skip to content

Commit

Permalink
fix: UI 6337 cluster filter improvement for issue #6337 (#6856)
Browse files Browse the repository at this point in the history
* fix: when cluster field is bge-dev1, the applications with cluster dev1 is selected #6337

Signed-off-by: ciiay <yicai@redhat.com>
  • Loading branch information
ciiay authored and alexmt committed Aug 4, 2021
1 parent 8d78f0a commit e7e93b2
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,16 @@ export function getFilterResults(applications: Application[], pref: AppsListPref
namespaces: pref.namespacesFilter.length === 0 || pref.namespacesFilter.some(ns => app.spec.destination.namespace && minimatch(app.spec.destination.namespace, ns)),
clusters:
pref.clustersFilter.length === 0 ||
pref.clustersFilter.some(
selector =>
(app.spec.destination.server && selector.includes(app.spec.destination.server)) ||
(app.spec.destination.name && selector.includes(app.spec.destination.name))
),
pref.clustersFilter.some(filterString => {
const match = filterString.match('^(.*) [(](http.*)[)]$');
if (match?.length === 3) {
const [, name, url] = match;
return url === app.spec.destination.server || name === app.spec.destination.name;
} else {
const inputMatch = filterString.match('^http.*$');
return (inputMatch && inputMatch[0] === app.spec.destination.server) || (app.spec.destination.name && minimatch(app.spec.destination.name, filterString));
}
}),
labels: pref.labelsFilter.length === 0 || pref.labelsFilter.every(selector => LabelSelector.match(selector, app.metadata.labels))
}
}));
Expand Down

0 comments on commit e7e93b2

Please sign in to comment.