Sha256: c9d67e50d59ac770793ca8400baedb4dca4340cca3141ad59711559f065f008c

Contents?: true

Size: 1.19 KB

Versions: 54

Compression:

Stored size: 1.19 KB

Contents

import { translate as __ } from 'foremanReact/common/I18n';
import { sum } from 'lodash';

export const getNumberOfActivationKeys = versions =>
  sum(versions.map(({ environments }) =>
    sum(environments.map(({ activation_key_count: akCount }) => akCount))));

export const getNumberOfHosts = versions =>
  sum(versions.map(({ environments }) =>
    sum(environments.map(({ host_count: hostCount }) => hostCount))));

// Gets a non-duplicated list of environments from within a given set of versions
export const getEnvironmentList = (versions) => {
  const envIds = [];
  const environmentList = [];
  versions.forEach(({ environments }) => environments.forEach((env) => {
    if (!envIds.includes(env.id)) {
      environmentList.push(env);
      envIds.push(env.id);
    }
  }));
  return environmentList;
};

export const getNumberOfEnvironments = versions => getEnvironmentList(versions).length;

// Creates a string from a list of versions: '3.0' or '3.0 and 2.0' or '3.0, 2.0 and 1.0' etc.
export const getVersionListString = versions => versions.map(({ version }, index) =>
  `${index > 0 && index === (versions.length - 1) ?
    __(' and') : ''} ${version}${versions.length - index > 2 ? ',' : ''}`).join('');

Version data entries

54 entries across 54 versions & 1 rubygems

Version Path
katello-4.15.0.rc2 webpack/scenes/ContentViews/Details/Versions/BulkDelete/BulkDeleteHelpers.js
katello-4.15.0.rc1 webpack/scenes/ContentViews/Details/Versions/BulkDelete/BulkDeleteHelpers.js
katello-4.14.1 webpack/scenes/ContentViews/Details/Versions/BulkDelete/BulkDeleteHelpers.js
katello-4.14.0 webpack/scenes/ContentViews/Details/Versions/BulkDelete/BulkDeleteHelpers.js
katello-4.14.0.rc3 webpack/scenes/ContentViews/Details/Versions/BulkDelete/BulkDeleteHelpers.js
katello-4.14.0.rc2 webpack/scenes/ContentViews/Details/Versions/BulkDelete/BulkDeleteHelpers.js
katello-4.14.0.rc1.1 webpack/scenes/ContentViews/Details/Versions/BulkDelete/BulkDeleteHelpers.js
katello-4.14.0.rc1 webpack/scenes/ContentViews/Details/Versions/BulkDelete/BulkDeleteHelpers.js
katello-4.13.1 webpack/scenes/ContentViews/Details/Versions/BulkDelete/BulkDeleteHelpers.js
katello-4.13.0 webpack/scenes/ContentViews/Details/Versions/BulkDelete/BulkDeleteHelpers.js
katello-4.12.1 webpack/scenes/ContentViews/Details/Versions/BulkDelete/BulkDeleteHelpers.js
katello-4.13.0.rc1 webpack/scenes/ContentViews/Details/Versions/BulkDelete/BulkDeleteHelpers.js
katello-4.12.0 webpack/scenes/ContentViews/Details/Versions/BulkDelete/BulkDeleteHelpers.js
katello-4.12.0.rc3 webpack/scenes/ContentViews/Details/Versions/BulkDelete/BulkDeleteHelpers.js
katello-4.12.0.rc2 webpack/scenes/ContentViews/Details/Versions/BulkDelete/BulkDeleteHelpers.js
katello-4.12.0.rc1 webpack/scenes/ContentViews/Details/Versions/BulkDelete/BulkDeleteHelpers.js
katello-4.11.1 webpack/scenes/ContentViews/Details/Versions/BulkDelete/BulkDeleteHelpers.js
katello-4.11.0 webpack/scenes/ContentViews/Details/Versions/BulkDelete/BulkDeleteHelpers.js
katello-4.11.0.rc2 webpack/scenes/ContentViews/Details/Versions/BulkDelete/BulkDeleteHelpers.js
katello-4.11.0.rc1 webpack/scenes/ContentViews/Details/Versions/BulkDelete/BulkDeleteHelpers.js