Sha256: e6324221186f90350484f3df5fd03b1a5665241aae2f37b0be5be3e47a7535fc

Contents?: true

Size: 790 Bytes

Versions: 9

Compression:

Stored size: 790 Bytes

Contents

import { STATUS } from 'foremanReact/constants';

export const getHostIds = () => {
  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

9 entries across 9 versions & 1 rubygems

Version Path
katello-4.4.2.2 webpack/scenes/Hosts/ChangeContentSource/helpers.js
katello-4.4.2.1 webpack/scenes/Hosts/ChangeContentSource/helpers.js
katello-4.4.2 webpack/scenes/Hosts/ChangeContentSource/helpers.js
katello-4.4.1 webpack/scenes/Hosts/ChangeContentSource/helpers.js
katello-4.4.0.2 webpack/scenes/Hosts/ChangeContentSource/helpers.js
katello-4.4.0.1 webpack/scenes/Hosts/ChangeContentSource/helpers.js
katello-4.4.0 webpack/scenes/Hosts/ChangeContentSource/helpers.js
katello-4.4.0.rc2 webpack/scenes/Hosts/ChangeContentSource/helpers.js
katello-4.4.0.rc1 webpack/scenes/Hosts/ChangeContentSource/helpers.js