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

Version Path
foreman_remote_execution-8.2.0 webpack/JobWizard/steps/HostsAndInputs/buildHostQuery.js
foreman_remote_execution-9.0.1 webpack/JobWizard/steps/HostsAndInputs/buildHostQuery.js
foreman_remote_execution-9.0.0 webpack/JobWizard/steps/HostsAndInputs/buildHostQuery.js
foreman_remote_execution-8.1.2 webpack/JobWizard/steps/HostsAndInputs/buildHostQuery.js
foreman_remote_execution-8.1.1 webpack/JobWizard/steps/HostsAndInputs/buildHostQuery.js
foreman_remote_execution-8.1.0 webpack/JobWizard/steps/HostsAndInputs/buildHostQuery.js
foreman_remote_execution-7.2.2 webpack/JobWizard/steps/HostsAndInputs/buildHostQuery.js
foreman_remote_execution-7.2.1 webpack/JobWizard/steps/HostsAndInputs/buildHostQuery.js
foreman_remote_execution-7.2.0 webpack/JobWizard/steps/HostsAndInputs/buildHostQuery.js
foreman_remote_execution-8.0.0 webpack/JobWizard/steps/HostsAndInputs/buildHostQuery.js
foreman_remote_execution-7.1.1 webpack/JobWizard/steps/HostsAndInputs/buildHostQuery.js
foreman_remote_execution-7.1.0 webpack/JobWizard/steps/HostsAndInputs/buildHostQuery.js
foreman_remote_execution-7.0.0 webpack/JobWizard/steps/HostsAndInputs/buildHostQuery.js