Sha256: d61555c7c7fc0beb4cc4b7ca9a76cdd50596c90036b7eb3784cee71ffee87406

Contents?: true

Size: 1.83 KB

Versions: 1

Compression:

Stored size: 1.83 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 '../YumInstallablePackages/YumInstallablePackagesConstants';
import { PACKAGES_SEARCH_QUERY } from '../HostPackages/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

1 entries across 1 versions & 1 rubygems

Version Path
katello-4.4.0.rc2 webpack/components/extensions/HostDetails/Tabs/customizedRexUrlHelpers.js