mirror of
https://github.com/kemko/nomad.git
synced 2026-01-07 19:05:42 +03:00
Make the facet filter function clearer with more brackets
This commit is contained in:
committed by
Preetha Appan
parent
fc794efce8
commit
70ab07ee6e
@@ -173,12 +173,22 @@ export default Controller.extend(Sortable, Searchable, {
|
||||
// A job must match ALL filter facets, but it can match ANY selection within a facet
|
||||
// Always return early to prevent unnecessary facet predicates.
|
||||
return this.get('visibleJobs').filter(job => {
|
||||
if (types.length && !types.includes(job.get('displayType'))) return false;
|
||||
if (statuses.length && !statuses.includes(job.get('status'))) return false;
|
||||
if (datacenters.length && !job.get('datacenters').find(dc => datacenters.includes(dc)))
|
||||
if (types.length && !types.includes(job.get('displayType'))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (statuses.length && !statuses.includes(job.get('status'))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (datacenters.length && !job.get('datacenters').find(dc => datacenters.includes(dc))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const name = job.get('name');
|
||||
if (prefixes.length && !prefixes.find(prefix => name.startsWith(prefix))) return false;
|
||||
if (prefixes.length && !prefixes.find(prefix => name.startsWith(prefix))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user