Sha256: 993f7806c99d0cf9fbcd8001a578874a4d834cfb68c2bb58cede60d80ebc53c4

Contents?: true

Size: 849 Bytes

Versions: 44

Compression:

Stored size: 849 Bytes

Contents

import { STATUS } from 'foremanReact/constants';

export const getHostIds = (hostIdFromUrl) => {
  if (hostIdFromUrl) return [hostIdFromUrl];

  const cookie = document.cookie.split('; ')
    .find(row => row.startsWith('_ForemanSelectedhosts'));
  const params = new URLSearchParams(cookie);
  const ids = params.get('_ForemanSelectedhosts');

  if (ids) return JSON.parse(ids);
  return [];
};

export const formIsLoading = (data, contentView, change) => (
  data === STATUS.PENDING ||
  contentView === STATUS.PENDING ||
  change === STATUS.PENDING
);

export const copyToClipboard = (event, textToCopy) => {
  const clipboard = event.currentTarget.parentElement;
  const el = document.createElement('textarea');
  el.value = textToCopy;
  clipboard.appendChild(el);
  el.select();
  document.execCommand('copy');
  clipboard.removeChild(el);
};

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
katello-4.14.3 webpack/scenes/Hosts/ChangeContentSource/helpers.js
katello-4.14.2 webpack/scenes/Hosts/ChangeContentSource/helpers.js
katello-4.14.1 webpack/scenes/Hosts/ChangeContentSource/helpers.js
katello-4.14.0 webpack/scenes/Hosts/ChangeContentSource/helpers.js
katello-4.14.0.rc3 webpack/scenes/Hosts/ChangeContentSource/helpers.js
katello-4.14.0.rc2 webpack/scenes/Hosts/ChangeContentSource/helpers.js
katello-4.14.0.rc1.1 webpack/scenes/Hosts/ChangeContentSource/helpers.js
katello-4.14.0.rc1 webpack/scenes/Hosts/ChangeContentSource/helpers.js
katello-4.13.1 webpack/scenes/Hosts/ChangeContentSource/helpers.js
katello-4.13.0 webpack/scenes/Hosts/ChangeContentSource/helpers.js
katello-4.12.1 webpack/scenes/Hosts/ChangeContentSource/helpers.js
katello-4.13.0.rc1 webpack/scenes/Hosts/ChangeContentSource/helpers.js
katello-4.12.0 webpack/scenes/Hosts/ChangeContentSource/helpers.js
katello-4.12.0.rc3 webpack/scenes/Hosts/ChangeContentSource/helpers.js
katello-4.12.0.rc2 webpack/scenes/Hosts/ChangeContentSource/helpers.js
katello-4.12.0.rc1 webpack/scenes/Hosts/ChangeContentSource/helpers.js
katello-4.11.1 webpack/scenes/Hosts/ChangeContentSource/helpers.js
katello-4.11.0 webpack/scenes/Hosts/ChangeContentSource/helpers.js
katello-4.11.0.rc2 webpack/scenes/Hosts/ChangeContentSource/helpers.js
katello-4.11.0.rc1 webpack/scenes/Hosts/ChangeContentSource/helpers.js