Sha256: ea4c354007d05aa298dc825b676c510a721f0fe6424481d3e4faec22f2648d97
Contents?: true
Size: 661 Bytes
Versions: 13
Compression:
Stored size: 661 Bytes
Contents
export const buildHostQuery = (selected, search) => { const { hosts, hostCollections, hostGroups } = selected; const hostsSearch = `(name ^ (${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