Sha256: 68689ade5d8163ef0073063681043802690707b4734ec4649f46c7694943a38a

Contents?: true

Size: 1.13 KB

Versions: 5

Compression:

Stored size: 1.13 KB

Contents

import { STATUS } from 'foremanReact/constants';
import { translate as __ } from 'foremanReact/common/I18n';

export const getCVPlaceholderText = ({
  contentSourceId = null,
  environments = [],
  contentViewsStatus = STATUS.PENDING,
  cvSelectOptions = [],
}) => {
  if (contentSourceId === '') return __('Select a content source first');
  if (environments.length === 0) return __('Select an environment first');
  if (contentViewsStatus === STATUS.PENDING) return __('Loading...');
  if (contentViewsStatus === STATUS.ERROR) return __('Error loading content views');
  if (cvSelectOptions.length === 0) return __('No content views available');
  return __('Select a content view');
};

export const shouldDisableCVSelect = ({
  contentSourceId = null,
  environments = [],
  contentViewsStatus = STATUS.PENDING,
  cvSelectOptions = [],
}) => {
  if (contentSourceId === '') return true;
  if (environments.length === 0) return true;
  if (contentViewsStatus === STATUS.PENDING) return true;
  if (contentViewsStatus === STATUS.ERROR) return true;
  if (cvSelectOptions.length === 0) return true;
  return false;
};

export default getCVPlaceholderText;

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
katello-4.9.2 webpack/scenes/ContentViews/components/ContentViewSelect/helpers.js
katello-4.9.1 webpack/scenes/ContentViews/components/ContentViewSelect/helpers.js
katello-4.9.0 webpack/scenes/ContentViews/components/ContentViewSelect/helpers.js
katello-4.9.0.rc2 webpack/scenes/ContentViews/components/ContentViewSelect/helpers.js
katello-4.9.0.rc1 webpack/scenes/ContentViews/components/ContentViewSelect/helpers.js