Sha256: 27010576d2b8986c55333d26c554382955cb4d1179eb4726e3507ad23a490c9a
Contents?: true
Size: 659 Bytes
Versions: 13
Compression:
Stored size: 659 Bytes
Contents
export const buildHostQuery = (selected, search) => { const { hosts, hostCollections, hostGroups } = selected; const hostsSearch = `(id ^ (${hosts.map(({ id }) => id).join(',')}))`; const hostCollectionsSearch = `(host_collection_id ^ (${hostCollections .map(({ id }) => id) .join(',')}))`; const hostGroupsSearch = `(hostgroup_id ^ (${hostGroups .map(({ id }) => id) .join(',')}))`; return [ hosts.length ? hostsSearch : false, hostCollections.length ? hostCollectionsSearch : false, hostGroups.length ? hostGroupsSearch : false, search.length ? `(${search})` : false, ] .filter(Boolean) .join(' or '); };
Version data entries
13 entries across 13 versions & 1 rubygems