Sha256: b8df033272d8d7e257259ebe898c7b8a04e27124316d98179ed0c92f3890679b

Contents?: true

Size: 1.15 KB

Versions: 6

Compression:

Stored size: 1.15 KB

Contents

import {
  cloneDeep,
} from 'lodash';

export const isNewDefinition = (mode) => {
  if (mode == "newDefinition")
    return true;
  return false;
}

export const isEditDefinition = (mode) => {
  if (mode == "editDefinition")
    return true;
  return false;
}

export const isDefinition = (mode) => {
  return (isNewDefinition(mode) || isEditDefinition(mode))
}

export const isNewInstance = (mode) => {
  if (mode == "newInstance")
    return true;
  return false;
}

export const isEditInstance = (mode) => {
  if (mode == "editInstance")
    return true;
  return false;
}

export const isInstance = (mode) => {
  return (isNewInstance(mode) || isEditInstance(mode))
}

export const transformForemanData = (fdata) => {
  if (fdata === undefined) {
    return "";
  }
  var result = {};
  fdata.map(item => result[item.id] = item.name)
  return (result);
}

export const filterUsedParameterTypes = (options, parameters) => {
  var newOptions = cloneDeep(options);
  // hostparam can be used multiple times
  var alreadyUsed = parameters.map(item => item["type"]).filter(item => item != 'hostparam');
  alreadyUsed.forEach(item => delete newOptions[item])
  return newOptions;
}

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
foreman_acd-0.0.6 webpack/components/ParameterSelection/ParameterSelectionHelper.js
foreman_acd-0.0.5 webpack/components/ParameterSelection/ParameterSelectionHelper.js
foreman_acd-0.0.4 webpack/components/ParameterSelection/ParameterSelectionHelper.js
foreman_acd-0.0.3 webpack/components/ParameterSelection/ParameterSelectionHelper.js
foreman_acd-0.0.2 webpack/components/ParameterSelection/ParameterSelectionHelper.js
foreman_acd-0.0.1 webpack/components/ParameterSelection/ParameterSelectionHelper.js