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

Version Path
foreman_remote_execution-5.0.8 webpack/JobWizard/steps/HostsAndInputs/buildHostQuery.js
foreman_remote_execution-5.0.7 webpack/JobWizard/steps/HostsAndInputs/buildHostQuery.js
foreman_remote_execution-5.0.6 webpack/JobWizard/steps/HostsAndInputs/buildHostQuery.js
foreman_remote_execution-6.2.0 webpack/JobWizard/steps/HostsAndInputs/buildHostQuery.js
foreman_remote_execution-5.0.5 webpack/JobWizard/steps/HostsAndInputs/buildHostQuery.js
foreman_remote_execution-6.1.0 webpack/JobWizard/steps/HostsAndInputs/buildHostQuery.js
foreman_remote_execution-5.0.4 webpack/JobWizard/steps/HostsAndInputs/buildHostQuery.js
foreman_remote_execution-5.0.3 webpack/JobWizard/steps/HostsAndInputs/buildHostQuery.js
foreman_remote_execution-6.0.0 webpack/JobWizard/steps/HostsAndInputs/buildHostQuery.js
foreman_remote_execution-5.0.2 webpack/JobWizard/steps/HostsAndInputs/buildHostQuery.js
foreman_remote_execution-5.1.0 webpack/JobWizard/steps/HostsAndInputs/buildHostQuery.js
foreman_remote_execution-5.0.1 webpack/JobWizard/steps/HostsAndInputs/buildHostQuery.js
foreman_remote_execution-5.0.0 webpack/JobWizard/steps/HostsAndInputs/buildHostQuery.js