import $ from 'jquery'; import React from 'react'; import PropTypes from 'prop-types'; import * as sort from 'sortabular'; import { orderBy } from 'lodash'; import * as resolve from 'table-resolver'; import Select from 'foremanReact/components/common/forms/Select'; import AddTableEntry from '../common/AddTableEntry'; import EditTableEntry from '../common/EditTableEntry'; import DeleteTableEntry from '../common/DeleteTableEntry'; import LockTableEntry from '../common/LockTableEntry'; import ExtSelect from '../common/ExtSelect'; import { transformForemanData, } from './ParameterSelectionHelper'; import { dropRight, findIndex, cloneDeep, } from 'lodash'; import { PARAMETER_SELECTION_TYPES, PARAMETER_SELECTION_PARAM_TYPE_FOREMAN, PARAMETER_SELECTION_PARAM_TYPE_ANSIBLE, } from './ParameterSelectionConstants'; import { Icon, Button, Table, FormControl, defaultSortingOrder, customHeaderFormattersDefinition, inlineEditFormatterFactory, } from 'patternfly-react'; const theme = { scheme: 'foreman', backgroundColor: 'rgba(0, 0, 0, 255)', base00: 'rgba(0, 0, 0, 0)', }; class ParameterSelection extends React.Component { constructor(props) { super(props); } isEditing({rowData}) { return (rowData.backup !== undefined); } // enables our custom header formatters extensions to reactabular customHeaderFormatters = customHeaderFormattersDefinition; componentDidMount() { const { data: { useDefaultValue, allowRowAdjustment, allowNameAdjustment, allowDescriptionAdjustment, parameters, paramDefinition }, location, organization, paramType, paramDataUrl, initParameterSelection, sortParameter, deleteParameter, lockParameter, activateEditParameter, changeEditParameter, loadParamData, } = this.props; if (paramDataUrl !== undefined) { switch (paramType) { case PARAMETER_SELECTION_PARAM_TYPE_FOREMAN: { loadParamData({ paramDefinition: paramDefinition, url: paramDataUrl, dataType: paramType, clearParameters: false }); break; } default: { } } } const inlineEditButtonsFormatter = inlineEditFormatterFactory({ isEditing: additionalData => this.props.editMode, renderValue: (value, additionalData) => ( activateEditParameter(additionalData)} additionalData={additionalData} />