diff options
Diffstat (limited to 'openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups')
5 files changed, 54 insertions, 177 deletions
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsActionHelper.js index ebbe84abd3..39af2054c2 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsActionHelper.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsActionHelper.js @@ -40,7 +40,6 @@ function postLicenseKeyGroup(licenseModelId, licenseKeyGroup, version) { return RestAPIUtil.post(baseUrl(licenseModelId, version), { name: licenseKeyGroup.name, description: licenseKeyGroup.description, - operationalScope: getValue(licenseKeyGroup.operationalScope), type: licenseKeyGroup.type, increments: licenseKeyGroup.increments, thresholdValue: licenseKeyGroup.thresholdValue, @@ -56,7 +55,6 @@ function putLicenseKeyGroup(licenseModelId, licenseKeyGroup, version) { { name: licenseKeyGroup.name, description: licenseKeyGroup.description, - operationalScope: getValue(licenseKeyGroup.operationalScope), type: licenseKeyGroup.type, increments: licenseKeyGroup.increments, thresholdValue: licenseKeyGroup.thresholdValue, diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsConstants.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsConstants.js index aad0a0b1fb..d20188667d 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsConstants.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsConstants.js @@ -35,24 +35,13 @@ export const actionTypes = keyMirror({ export const defaultState = { licenseKeyGroupsEditor: { - type: '', - operationalScope: { choices: [], other: '' } + type: '' } }; export const LKG_FORM_NAME = 'LKGFORM'; export const optionsInputValues = { - OPERATIONAL_SCOPE: [ - { enum: '', title: i18n('please select…') }, - { enum: 'Network_Wide', title: 'Network Wide' }, - { enum: 'Availability_Zone', title: 'Availability Zone' }, - { enum: 'Data_Center', title: 'Data Center' }, - { enum: 'Tenant', title: 'Tenant' }, - { enum: 'VM', title: 'VM' }, - { enum: 'CPU', title: 'CPU' }, - { enum: 'Core', title: 'Core' } - ], TYPE: [ { enum: '', title: i18n('please select…') }, { enum: 'Universal', title: 'Universal' }, @@ -73,27 +62,6 @@ export const extractValue = item => { : ''; }; -export const getOperationalScopes = operationalScope => { - if ( - operationalScope.choices.toString() === i18n(optionInputOther.OTHER) && - operationalScope.other !== '' - ) { - return operationalScope.other; - } else { - let allOpScopes = ''; - for (let opScope of operationalScope.choices) { - allOpScopes += - allOpScopes === '' - ? InputOptions.getTitleByName(optionsInputValues, opScope) - : `, ${InputOptions.getTitleByName( - optionsInputValues, - opScope - )}`; - } - return allOpScopes; - } -}; - export const tabIds = { GENERAL: 'GENERAL', SP_LIMITS: 'SP_LIMITS', diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsEditorReducer.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsEditorReducer.js index e948e9cef8..948398a56c 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsEditorReducer.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsEditorReducer.js @@ -64,11 +64,6 @@ export default (state = {}, action) => { errorText: '', validations: [{ type: 'required', data: true }] }, - operationalScope: { - isValid: true, - errorText: '', - validations: [] - }, thresholdUnits: { isValid: true, errorText: '', diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsEditorView.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsEditorView.jsx index b53ce8f0a9..0d5c6bc25d 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsEditorView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsEditorView.jsx @@ -36,8 +36,6 @@ import { validateStartDate, thresholdValueValidation } from '../LicenseModelValidations.js'; -import { other as optionInputOther } from 'nfvo-components/input/validation/InputOptions.jsx'; -import InputOptions from 'nfvo-components/input/validation/InputOptions.jsx'; import { DATE_FORMAT } from 'sdc-app/onboarding/OnboardingConstants.js'; @@ -52,10 +50,6 @@ const LicenseKeyGroupPropType = PropTypes.shape({ name: PropTypes.string, description: PropTypes.string, increments: PropTypes.string, - operationalScope: PropTypes.shape({ - choices: PropTypes.array, - other: PropTypes.string - }), type: PropTypes.string, thresholdUnits: PropTypes.string, thresholdValue: PropTypes.number, @@ -75,7 +69,6 @@ const LicenseKeyGroupFormContent = ({ name, description, increments, - operationalScope, type, thresholdUnits, thresholdValue, @@ -100,82 +93,6 @@ const LicenseKeyGroupFormContent = ({ type="text" /> </GridItem> - <GridItem colSpan={2} lastColInRow> - <InputOptions - onInputChange={() => {}} - isMultiSelect={true} - onEnumChange={operationalScope => - onDataChanged( - { - operationalScope: { - choices: operationalScope, - other: '' - } - }, - LKG_FORM_NAME - ) - } - onOtherChange={operationalScope => - onDataChanged( - { - operationalScope: { - choices: [optionInputOther.OTHER], - other: operationalScope - } - }, - LKG_FORM_NAME - ) - } - label={i18n('Operational Scope')} - data-test-id="create-lkg-operational-scope" - type="select" - multiSelectedEnum={ - operationalScope && operationalScope.choices - } - otherValue={operationalScope && operationalScope.other} - values={licenseKeyGroupOptionsInputValues.OPERATIONAL_SCOPE} - isValid={genericFieldInfo.operationalScope.isValid} - errorText={genericFieldInfo.operationalScope.errorText} - /> - </GridItem> - <GridItem colSpan={2}> - <Input - onChange={description => - onDataChanged({ description }, LKG_FORM_NAME) - } - label={i18n('Description')} - data-test-id="create-lkg-description" - value={description} - isValid={genericFieldInfo.description.isValid} - errorText={genericFieldInfo.description.errorText} - type="textarea" - overlayPos="bottom" - /> - </GridItem> - <GridItem colSpan={2} lastColInRow> - <Input - isRequired={true} - onChange={e => { - const selectedIndex = e.target.selectedIndex; - const val = e.target.options[selectedIndex].value; - onDataChanged({ type: val }, LKG_FORM_NAME); - }} - value={type} - label={i18n('Type')} - data-test-id="create-lkg-type" - isValid={genericFieldInfo.type.isValid} - errorText={genericFieldInfo.type.errorText} - groupClassName="bootstrap-input-options" - className="input-options-select" - overlayPos="bottom" - type="select"> - {licenseKeyGroupOptionsInputValues.TYPE.map(type => ( - <option key={type.enum} value={type.enum}> - {type.title} - </option> - ))} - </Input> - </GridItem> <GridItem> <Input onChange={e => { @@ -209,7 +126,7 @@ const LicenseKeyGroupFormContent = ({ )} </Input> </GridItem> - <GridItem> + <GridItem lastColInRow> <Input className="entitlement-pools-form-row-threshold-value" onChange={thresholdValue => @@ -225,6 +142,55 @@ const LicenseKeyGroupFormContent = ({ type="text" /> </GridItem> + <GridItem colSpan={2}> + <Input + onChange={description => + onDataChanged({ description }, LKG_FORM_NAME) + } + label={i18n('Description')} + data-test-id="create-lkg-description" + value={description} + isValid={genericFieldInfo.description.isValid} + errorText={genericFieldInfo.description.errorText} + type="textarea" + overlayPos="bottom" + /> + </GridItem> + <GridItem colSpan={2} lastColInRow> + <Input + onChange={increments => + onDataChanged({ increments }, LKG_FORM_NAME) + } + label={i18n('Increments')} + value={increments} + data-test-id="create-ep-increments" + type="text" + /> + </GridItem> + <GridItem colSpan={2}> + <Input + isRequired={true} + onChange={e => { + const selectedIndex = e.target.selectedIndex; + const val = e.target.options[selectedIndex].value; + onDataChanged({ type: val }, LKG_FORM_NAME); + }} + value={type} + label={i18n('Type')} + data-test-id="create-lkg-type" + isValid={genericFieldInfo.type.isValid} + errorText={genericFieldInfo.type.errorText} + groupClassName="bootstrap-input-options" + className="input-options-select" + overlayPos="bottom" + type="select"> + {licenseKeyGroupOptionsInputValues.TYPE.map(type => ( + <option key={type.enum} value={type.enum}> + {type.title} + </option> + ))} + </Input> + </GridItem> <GridItem> <Input type="date" @@ -275,17 +241,6 @@ const LicenseKeyGroupFormContent = ({ selectsEnd /> </GridItem> - <GridItem colSpan={2}> - <Input - onChange={increments => - onDataChanged({ increments }, LKG_FORM_NAME) - } - label={i18n('Increments')} - value={increments} - data-test-id="create-ep-increments" - type="text" - /> - </GridItem> </GridSection> ); }; diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsListEditorView.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsListEditorView.jsx index 4c8c8cee6f..9d961b41f5 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsListEditorView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsListEditorView.jsx @@ -106,18 +106,10 @@ class LicenseKeyGroupsListEditorView extends React.Component { if (localFilter.trim()) { const filter = new RegExp(escape(localFilter), 'i'); return licenseKeyGroupsList.filter( - ({ - name = '', - description = '', - operationalScope = '', - type = '' - }) => { + ({ name = '', description = '', type = '' }) => { return ( escape(name).match(filter) || escape(description).match(filter) || - escape(this.extractValue(operationalScope)).match( - filter - ) || escape(type).match(filter) ); } @@ -128,7 +120,7 @@ class LicenseKeyGroupsListEditorView extends React.Component { } renderLicenseKeyGroupListItem(licenseKeyGroup, isReadOnlyMode) { - let { id, name, description, operationalScope, type } = licenseKeyGroup; + let { id, name, description, type } = licenseKeyGroup; let { onEditLicenseKeyGroupClick, onDeleteLicenseKeyGroupClick @@ -146,17 +138,12 @@ class LicenseKeyGroupsListEditorView extends React.Component { </div> <div className="list-editor-item-view-field"> - <div className="title">{i18n('Operational Scope')}</div> - <div className="text operational-scope"> - {operationalScope && - this.getOperationalScopes(operationalScope)} - </div> - <div className="title">{i18n('Type')}</div> <div className="text type"> {InputOptions.getTitleByName(optionsInputValues, type)} </div> </div> + <div className="list-editor-item-view-field"> <div className="title">{i18n('Description')}</div> <div className="text description">{description}</div> @@ -165,32 +152,6 @@ class LicenseKeyGroupsListEditorView extends React.Component { ); } - getOperationalScopes(operationalScope) { - if ( - operationalScope.choices && - operationalScope.choices.toString() === i18n(optionInputOther.OTHER) - ) { - return operationalScope.other; - } else if (operationalScope.choices) { - let allOpScopes = ''; - for (let opScope of operationalScope.choices) { - allOpScopes += - allOpScopes === '' - ? InputOptions.getTitleByName( - optionsInputValues, - opScope - ) - : `, ${InputOptions.getTitleByName( - optionsInputValues, - opScope - )}`; - } - return allOpScopes; - } else { - return ''; - } - } - extractValue(item) { if (item === undefined) { return ''; |