Sha256: 6c6b21b57f9f889d09972cbb977e57b9274b85bd984ed0c147b029ffdc5c3d98

Contents?: true

Size: 1.82 KB

Versions: 7

Compression:

Stored size: 1.82 KB

Contents

import { REX_FEATURES } from './RemoteExecutionConstants';
import { TRACES_SEARCH_QUERY } from './TracesTab/HostTracesConstants';
import { ERRATA_SEARCH_QUERY } from './ErrataTab/HostErrataConstants';
import { PACKAGE_SEARCH_QUERY } from './PackagesTab/YumInstallablePackagesConstants';
import { PACKAGES_SEARCH_QUERY } from './PackagesTab/HostPackagesConstants';

export const createJob = ({
  hostname, feature, inputs,
}) => {
  const inputParams = Object.keys(inputs).map(key => `inputs[${key}]=${inputs[key]}`);
  const params = [
    `feature=${feature}`,
    `host_ids=name ^ (${hostname})`,
    ...inputParams,
  ];
  const urlQuery = encodeURI(params.join('&'));
  return `/job_invocations/new?${urlQuery}`;
};

export const katelloPackageInstallUrl = ({ hostname, packages }) => createJob({
  hostname,
  feature: REX_FEATURES.KATELLO_PACKAGE_INSTALL,
  inputs: { package: packages },
});

export const katelloPackageInstallBySearchUrl = ({ hostname, search }) => createJob({
  hostname,
  feature: REX_FEATURES.KATELLO_PACKAGE_INSTALL_BY_SEARCH,
  inputs: { [PACKAGE_SEARCH_QUERY]: search },
});

export const katelloPackageUpdateUrl = ({ hostname, packageName }) => createJob({
  hostname,
  feature: REX_FEATURES.KATELLO_PACKAGE_UPDATE,
  inputs: { package: packageName },
});

export const packagesUpdateUrl = ({ hostname, search }) => createJob({
  hostname,
  feature: REX_FEATURES.KATELLO_PACKAGES_UPDATE_BY_SEARCH,
  inputs: { [PACKAGES_SEARCH_QUERY]: search },
});

export const resolveTraceUrl = ({ hostname, search }) => createJob({
  hostname,
  feature: REX_FEATURES.KATELLO_HOST_TRACER_RESOLVE,
  inputs: { [TRACES_SEARCH_QUERY]: search },
});

export const errataInstallUrl = ({ hostname, search }) => createJob({
  hostname,
  feature: REX_FEATURES.KATELLO_HOST_ERRATA_INSTALL_BY_SEARCH,
  inputs: { [ERRATA_SEARCH_QUERY]: search },
});

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
katello-4.4.2.2 webpack/components/extensions/HostDetails/Tabs/customizedRexUrlHelpers.js
katello-4.4.2.1 webpack/components/extensions/HostDetails/Tabs/customizedRexUrlHelpers.js
katello-4.4.2 webpack/components/extensions/HostDetails/Tabs/customizedRexUrlHelpers.js
katello-4.4.1 webpack/components/extensions/HostDetails/Tabs/customizedRexUrlHelpers.js
katello-4.4.0.2 webpack/components/extensions/HostDetails/Tabs/customizedRexUrlHelpers.js
katello-4.4.0.1 webpack/components/extensions/HostDetails/Tabs/customizedRexUrlHelpers.js
katello-4.4.0 webpack/components/extensions/HostDetails/Tabs/customizedRexUrlHelpers.js