diff options
Diffstat (limited to 'openecomp-ui/src/sdc-app/onboarding/softwareProduct')
9 files changed, 223 insertions, 50 deletions
diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/ArchivedSoftwareProductReducer.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/ArchivedSoftwareProductReducer.js new file mode 100644 index 0000000000..b484f5e0a0 --- /dev/null +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/ArchivedSoftwareProductReducer.js @@ -0,0 +1,25 @@ +/*! + * Copyright © 2016-2018 European Support Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +import {actionTypes} from './SoftwareProductConstants.js'; + +export default (state = [], action) => { + switch (action.type) { + case actionTypes.ARCHIVED_SOFTWARE_PRODUCT_LIST_LOADED: + return [...action.response.results]; + default: + return state; + } +}; diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProduct.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProduct.js index 683dd4f682..e3ea7e1907 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProduct.js +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProduct.js @@ -20,7 +20,6 @@ import ScreensHelper from 'sdc-app/common/helpers/ScreensHelper.js'; import TabulatedEditor from 'src/nfvo-components/editor/TabulatedEditor.jsx'; import {enums, screenTypes} from 'sdc-app/onboarding/OnboardingConstants.js'; - import {onboardingMethod as onboardingMethodTypes, onboardingOriginTypes} from './SoftwareProductConstants.js'; import SoftwareProductActionHelper from './SoftwareProductActionHelper.js'; import SoftwareProductComponentsActionHelper from './components/SoftwareProductComponentsActionHelper.js'; @@ -163,7 +162,7 @@ const buildNavigationBarProps = ({softwareProduct, meta, screen, componentId, co }; }; -const buildVersionControllerProps = ({softwareProduct, versions, currentVersion, permissions, userInfo, usersList, itemPermission, isReadOnlyMode}) => { +const buildVersionControllerProps = ({softwareProduct, versions, currentVersion, permissions, userInfo, isArchived, usersList, itemPermission, isReadOnlyMode}) => { const {softwareProductEditor = {data: {}}} = softwareProduct; const {isValidityData = true, data: {name, onboardingMethod, candidateOnboardingOrigin}} = softwareProductEditor; @@ -175,6 +174,7 @@ const buildVersionControllerProps = ({softwareProduct, versions, currentVersion, itemName: name, itemPermission, isReadOnlyMode, + isArchived, userInfo, usersList, isManual: onboardingMethod === onboardingMethodType.MANUAL, @@ -220,6 +220,7 @@ const mapStateToProps = ( currentVersion, userInfo, usersList, + isArchived: itemPermission.isArchived, permissions, itemPermission: {...itemPermission, isDirty: true}, isReadOnlyMode @@ -355,7 +356,6 @@ const mapActionsToProps = (dispatch, {currentScreen: {screen, props: {softwarePr if((action === versionControllerActions.SYNC && !inMerge) || ((action === versionControllerActions.COMMIT || action === versionControllerActions.SYNC) && updatedVersion.status === catalogItemStatuses.CERTIFIED)) { ScreensHelper.loadLandingScreen(dispatch, {previousScreenName: screen, props: {softwareProductId, version: updatedVersion}}); - } else { ScreensHelper.loadScreen(dispatch, {screen, screenType: screenTypes.SOFTWARE_PRODUCT, props: {softwareProductId, version: updatedVersion, componentId: currentComponentId}}); diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js index 9ed6005397..42786bf752 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js @@ -32,7 +32,7 @@ import {actionTypes as componentActionTypes} from './components/SoftwareProductC import ValidationHelper from 'sdc-app/common/helpers/ValidationHelper.js'; import {actionTypes as modalActionTypes} from 'nfvo-components/modal/GlobalModalConstants.js'; import {modalContentMapper} from 'sdc-app/common/modal/ModalContentMapper.js'; -import ItemsHelper from 'sdc-app/common/helpers/ItemsHelper.js'; +import {default as ItemsHelper} from 'sdc-app/common/helpers/ItemsHelper.js'; import ScreensHelper from 'sdc-app/common/helpers/ScreensHelper.js'; import {enums, screenTypes} from 'sdc-app/onboarding/OnboardingConstants.js'; import MergeEditorActionHelper from 'sdc-app/common/merge/MergeEditorActionHelper.js'; @@ -90,11 +90,15 @@ function putSoftwareProductAction(id, action, version) { } function fetchSoftwareProductList() { - return RestAPIUtil.fetch(`${baseUrl()}?versionFilter=Draft`); + return RestAPIUtil.fetch(`${baseUrl()}?versionFilter=${catalogItemStatuses.DRAFT}`); +} + +function fetchArchivedSoftwareProductList() { + return RestAPIUtil.fetch(`${baseUrl()}?Status=${catalogItemStatuses.ARCHIVED}`); } function fetchFinalizedSoftwareProductList() { - return RestAPIUtil.fetch(`${baseUrl()}?versionFilter=Certified`); + return RestAPIUtil.fetch(`${baseUrl()}?versionFilter=${catalogItemStatuses.CERTIFIED}`); } function fetchSoftwareProduct(vspId, version) { @@ -202,6 +206,13 @@ const SoftwareProductActionHelper = { })); }, + fetchArchivedSoftwareProductList(dispatch) { + return fetchArchivedSoftwareProductList().then(response => dispatch({ + type: actionTypes.ARCHIVED_SOFTWARE_PRODUCT_LIST_LOADED, + response + })); + }, + loadSoftwareProductAssociatedData(dispatch) { fetchSoftwareProductCategories(dispatch); LicenseModelActionHelper.fetchFinalizedLicenseModels(dispatch); @@ -473,14 +484,15 @@ const SoftwareProductActionHelper = { performVCAction(dispatch, {softwareProductId, action, version, comment}) { return MergeEditorActionHelper.analyzeSyncResult(dispatch, {itemId: softwareProductId, version}).then(({inMerge, isDirty, updatedVersion}) => { - if (updatedVersion.status === catalogItemStatuses.CERTIFIED && + if ((updatedVersion.status === catalogItemStatuses.CERTIFIED || updatedVersion.archivedStatus === catalogItemStatuses.ARCHIVED) && (action === VersionControllerActionsEnum.COMMIT || action === VersionControllerActionsEnum.SYNC)) { versionPageActionHelper.fetchVersions(dispatch, {itemType: itemTypes.SOFTWARE_PRODUCT, itemId: softwareProductId}); + const msg = updatedVersion.archivedStatus === catalogItemStatuses.ARCHIVED ? i18n('Item was Archived') : i18n('Item version already Certified'); dispatch({ type: modalActionTypes.GLOBAL_MODAL_WARNING, data: { title: i18n('Commit error'), - msg: i18n('Item version already Certified'), + msg, cancelButtonText: i18n('Cancel') } }); diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js index c82483740f..d33eb822cf 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js @@ -18,6 +18,7 @@ import keyMirror from 'nfvo-utils/KeyMirror.js'; export const actionTypes = keyMirror({ SOFTWARE_PRODUCT_LOADED: null, SOFTWARE_PRODUCT_LIST_LOADED: null, + ARCHIVED_SOFTWARE_PRODUCT_LIST_LOADED: null, FINALIZED_SOFTWARE_PRODUCT_LIST_LOADED: null, SOFTWARE_PRODUCT_LIST_EDIT: null, SOFTWARE_PRODUCT_CATEGORIES_LOADED: null, diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsView.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsView.jsx index 4ced98f314..2a849f376e 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsView.jsx @@ -31,8 +31,8 @@ class HeatScreenView extends Component { setActiveTab: PropTypes.func }; - componentDidMount() { - if (!this.props.goToOverview && this.props.candidateInProcess) { + componentDidMount() { + if (!this.props.goToOverview && this.props.candidateInProcess) { this.props.setActiveTab({activeTab: tabsMapping.VALIDATION}); } } @@ -49,9 +49,9 @@ class HeatScreenView extends Component { data-test-id='proceed-to-validation-btn' disabled={!isValidationAvailable} className='proceed-to-validation-btn' - onClick={()=>this.validate()}>{i18n('PROCEED TO VALIDATION')}</Button> - } - {candidateInProcess && <SVGIcon + onClick={()=>this.validate()}>{i18n('PROCEED TO VALIDATION')}</Button> + } + {candidateInProcess && <SVGIcon onClick={onUploadAbort} name='close' className='icon-component abort-btn' @@ -59,26 +59,24 @@ class HeatScreenView extends Component { labelPosition='right' color='secondary' data-test-id='abort-btn'/> - } - + } {(activeTab === tabsMapping.VALIDATION && softwareProductId) && <Button btnType='outline' data-test-id='go-to-overview' disabled={this.props.goToOverview !== true} className='go-to-overview-btn' onClick={this.props.goToOverview ? () => onGoToOverview({version}) : undefined}>{i18n('GO TO OVERVIEW')}</Button>} - <div className='separator'></div> + <div className='separator'></div> <SVGIcon disabled={heatDataExist ? false : true} name='download' - className='icon-component' + className='icon-component' color='dark-gray' onClick={heatDataExist ? () => onDownload({heatCandidate: heatSetup, isReadOnlyMode: isReadOnlyMode || !candidateInProcess, version}) : undefined} data-test-id='download-heat'/> - <SVGIcon name='upload' - className='icon-component' + className='icon-component' color='dark-gray' disabled={isReadOnlyMode || candidateInProcess} onClick={isReadOnlyMode ? undefined : evt => this.refs.hiddenImportFileInput.click(evt)} @@ -144,7 +142,6 @@ class HeatScreenView extends Component { ); } save() { - return this.props.onboardingOrigin === onboardingOriginTypes.ZIP ? this.props.onSave(this.props.heatSetup, this.props.version) : Promise.resolve(); diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/creation/SoftwareProductCreation.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/creation/SoftwareProductCreation.js index 0136048bf7..569b33f999 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/creation/SoftwareProductCreation.js +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/creation/SoftwareProductCreation.js @@ -1,5 +1,5 @@ /*! - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright © 2016-2018 European Support Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,14 +25,17 @@ import ScreensHelper from 'sdc-app/common/helpers/ScreensHelper.js'; import {enums, screenTypes} from 'sdc-app/onboarding/OnboardingConstants.js'; import PermissionsActionHelper from 'sdc-app/onboarding/permissions/PermissionsActionHelper.js'; -export const mapStateToProps = ({finalizedLicenseModelList, users: {usersList}, softwareProductList, softwareProduct: {softwareProductCreation, softwareProductCategories} }) => { +export const mapStateToProps = ({finalizedLicenseModelList, users: {usersList}, archivedSoftwareProductList, + softwareProductList, finalizedSoftwareProductList, softwareProduct: {softwareProductCreation, softwareProductCategories} }) => { let {genericFieldInfo} = softwareProductCreation; let isFormValid = ValidationHelper.checkFormValid(genericFieldInfo); let VSPNames = {}; - for (let i = 0; i < softwareProductList.length; i++) { - VSPNames[softwareProductList[i].name.toLowerCase()] = softwareProductList[i].id; - } + const allVspList = [...softwareProductList, ...finalizedSoftwareProductList, ...archivedSoftwareProductList]; + allVspList.map(item => { + VSPNames[item.name.toLowerCase()] = item.id; + }); + return { data: softwareProductCreation.data, diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetails.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetails.js index b7ddf134bb..0973537d43 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetails.js +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetails.js @@ -1,5 +1,5 @@ /*! - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright © 2016-2018 European Support Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,15 +14,18 @@ * permissions and limitations under the License. */ import {connect} from 'react-redux'; - +import i18n from 'nfvo-utils/i18n/i18n.js'; import SoftwareProductActionHelper from 'sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js'; import SoftwareProductDetailsView from './SoftwareProductDetailsView.jsx'; import ValidationHelper from 'sdc-app/common/helpers/ValidationHelper.js'; import {PRODUCT_QUESTIONNAIRE} from 'sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js'; - +import {actionTypes as modalActionTypes, modalSizes} from 'nfvo-components/modal/GlobalModalConstants.js'; +import {modalContentMapper} from 'sdc-app/common/modal/ModalContentMapper.js'; +import {forms} from 'sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js'; export const mapStateToProps = ({ finalizedLicenseModelList, + archivedLicenseModelList, softwareProduct, licenseModel: {licenseAgreement, featureGroup} }) => { @@ -44,7 +47,7 @@ export const mapStateToProps = ({ let {qdata, qgenericFieldInfo : qGenericFieldInfo, dataMap} = softwareProductQuestionnaire; let isFormValid = ValidationHelper.checkFormValid(genericFieldInfo); - + const isVendorArchived = archivedLicenseModelList.find(item => item.id === currentSoftwareProduct.vendorId); return { currentSoftwareProduct, softwareProductCategories, @@ -56,7 +59,8 @@ export const mapStateToProps = ({ isFormValid, genericFieldInfo, qGenericFieldInfo, - dataMap + dataMap, + isVendorArchived: !!isVendorArchived }; }; @@ -67,7 +71,21 @@ export const mapActionsToProps = (dispatch, {version}) => { onVendorParamChanged: (deltaData, formName) => SoftwareProductActionHelper.softwareProductEditorVendorChanged(dispatch, {deltaData, formName}), onQDataChanged: (deltaData) => ValidationHelper.qDataChanged(dispatch, {deltaData, qName: PRODUCT_QUESTIONNAIRE}), onValidityChanged: isValidityData => SoftwareProductActionHelper.setIsValidityData(dispatch, {isValidityData}), - onSubmit: (softwareProduct, qdata) => SoftwareProductActionHelper.updateSoftwareProduct(dispatch, {softwareProduct, qdata, version}) + onSubmit: (softwareProduct, qdata) => SoftwareProductActionHelper.updateSoftwareProduct(dispatch, {softwareProduct, qdata, version}), + onArchivedVendorRemove: ({onVendorParamChanged, finalizedLicenseModelList, vendorName}) => dispatch({ + type: modalActionTypes.GLOBAL_MODAL_SHOW, + data:{ + title: i18n('Change Archived VLM'), + modalComponentName: modalContentMapper.VENDOR_SELECTOR, + modalComponentProps: { + size: modalSizes.MEDIUM, + finalizedLicenseModelList, + vendorName, + onClose: () => dispatch({type: modalActionTypes.GLOBAL_MODAL_CLOSE}), + onConfirm: (vendorId) => onVendorParamChanged({vendorId}, forms.VENDOR_SOFTWARE_PRODUCT_DETAILS) + } + } + }) }; }; diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsVendorSelector.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsVendorSelector.jsx new file mode 100644 index 0000000000..c2a3e0bd02 --- /dev/null +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsVendorSelector.jsx @@ -0,0 +1,78 @@ +/*! + * Copyright © 2016-2018 European Support Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +import React from 'react'; +import PropTypes from 'prop-types'; +import i18n from 'nfvo-utils/i18n/i18n.js'; +import Form from 'nfvo-components/input/validation/Form.jsx'; +import Input from 'nfvo-components/input/validation/Input.jsx'; +import sortByStringProperty from 'nfvo-utils/sortByStringProperty.js'; + +class VendorSelector extends React.Component { + static propTypes = { + finalizedLicenseModelList: PropTypes.array, + vendorName: PropTypes.string, + onClose: PropTypes.func.isRequired, + onConfirm: PropTypes.func.isRequired + } + constructor(props){ + super(props); + const selectedValue = props.finalizedLicenseModelList.length ? props.finalizedLicenseModelList[0].id : ''; + this.state = { + selectedValue + }; + } + submit() { + const vendor = this.props.finalizedLicenseModelList.find(item => item.id === this.state.selectedValue); + this.props.onConfirm(vendor.id); + this.props.onClose(); + } + render() { + const {finalizedLicenseModelList, vendorName, onClose} = this.props; + const {selectedValue} = this.state; + return ( + <div className='vsp-details-vendor-select'> + <Form + onSubmit={() => this.submit()} + onReset={() => onClose()} + isValid = {!!selectedValue} + submitButtonText={i18n('Save')} + hasButtons={true}> + <div className='vendor-selector-modal-title'>{`${i18n('The VLM')} '${vendorName}' ${i18n('assigned to this VSP is archived')}.`}</div> + <div className='vendor-selector-modal-additional-text'>{i18n('If you select a different VLM you will not be able to reselect the archived VLM.')}</div> + <Input + data-test-id='vsp-vendor-name-select' + label={i18n('Vendor')} + type='select' + onChange={e => {this.setState({ + selectedValue: e.target.options[e.target.selectedIndex].value + });}} + value={selectedValue}> + <option key='emtyVendor' value=''>{i18n('please select...')}</option> + {sortByStringProperty( + finalizedLicenseModelList, + 'name' + ).map(lm => <option key={lm.id} value={lm.id}>{lm.name}</option>) + } + </Input> + </Form> + </div> + ); + } +} + +export default VendorSelector; + diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsView.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsView.jsx index f6199ec83e..24aa319c24 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsView.jsx @@ -1,5 +1,5 @@ /*! - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright © 2016-2018 European Support Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,6 +26,22 @@ import GridItem from 'nfvo-components/grid/GridItem.jsx'; import SoftwareProductCategoriesHelper from 'sdc-app/onboarding/softwareProduct/SoftwareProductCategoriesHelper.js'; import {forms} from 'sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js'; +const DeprecatedVlmInfo = ({vendorName, onVendorRemove}) => { + return ( + <div className='depricated-vlm-info'> + <Input + data-test-id='vsp-vendor-name' + isRequired={true} + onClick={() => onVendorRemove()} + label={i18n('Vendor')} + type='select' + value={`${vendorName} (Archived)`}> + <option key={vendorName} value={`${vendorName} (Archived)`}>{`${vendorName} (Archived)`}</option> + </Input> + </div> + ); +}; + class GeneralSection extends React.Component { static propTypes = { vendorId: PropTypes.string, @@ -36,7 +52,9 @@ class GeneralSection extends React.Component { finalizedLicenseModelList: PropTypes.array, onDataChanged: PropTypes.func.isRequired, onVendorParamChanged: PropTypes.func.isRequired, - onSelectSubCategory: PropTypes.func.isRequired + onSelectSubCategory: PropTypes.func.isRequired, + isVendorArchived: PropTypes.bool, + onArchivedVendorRemove: PropTypes.func }; onVendorParamChanged(e) { @@ -51,6 +69,10 @@ class GeneralSection extends React.Component { const subCategory = e.target.options[selectedIndex].value; this.props.onSelectSubCategory(subCategory); } + onVendorRemove() { + const {finalizedLicenseModelList, vendorName, onVendorParamChanged} = this.props; + this.props.onArchivedVendorRemove({finalizedLicenseModelList, onVendorParamChanged, vendorName}); + } render (){ let {genericFieldInfo} = this.props; @@ -67,18 +89,21 @@ class GeneralSection extends React.Component { errorText={genericFieldInfo.name.errorText} isValid={genericFieldInfo.name.isValid} onChange={name => name.length <= 25 && this.props.onDataChanged({name}, forms.VENDOR_SOFTWARE_PRODUCT_DETAILS)}/> - <Input - data-test-id='vsp-vendor-name' - label={i18n('Vendor')} - type='select' - value={this.props.vendorId} - onChange={e => this.onVendorParamChanged(e)}> - {sortByStringProperty( - this.props.finalizedLicenseModelList, - 'name' - ).map(lm => <option key={lm.id} value={lm.id}>{lm.name}</option>) - } - </Input> + {this.props.isVendorArchived ? + <DeprecatedVlmInfo onVendorRemove={()=>this.onVendorRemove()} vendorName={this.props.vendorName} /> : + <Input + data-test-id='vsp-vendor-name' + label={i18n('Vendor')} + type='select' + value={this.props.vendorId} + onChange={e => this.onVendorParamChanged(e)}> + {sortByStringProperty( + this.props.finalizedLicenseModelList, + 'name' + ).map(lm => <option key={lm.id} value={lm.id}>{lm.name}</option>) + } + </Input> + } <Input data-test-id='vsp-category-name' label={i18n('Category')} @@ -127,7 +152,8 @@ class LicensesSection extends React.Component { onFeatureGroupsChanged: PropTypes.func.isRequired, onLicensingDataChanged: PropTypes.func.isRequired, featureGroupsList: PropTypes.array, - licenseAgreementList: PropTypes.array + licenseAgreementList: PropTypes.array, + isVendorArchived: PropTypes.bool }; onVendorParamChanged(e) { @@ -151,6 +177,7 @@ class LicensesSection extends React.Component { onChange={e => this.onVendorParamChanged(e)} value={this.props.licensingVersion || ''} label={i18n('Licensing Version')} + disabled={this.props.isVendorArchived} type='select'> {this.props.licensingVersionsList.map(version => <option @@ -165,6 +192,7 @@ class LicensesSection extends React.Component { data-test-id='vsp-license-agreement' label={i18n('License Agreement')} type='select' + disabled={this.props.isVendorArchived} value={this.props.licensingData.licenseAgreement ? this.props.licensingData.licenseAgreement : '' } onChange={(e) => this.onLicensingDataChanged(e)}> <option key='placeholder' value=''>{i18n('Select...')}</option> @@ -178,6 +206,7 @@ class LicensesSection extends React.Component { type='select' isMultiSelect={true} onInputChange={()=>{}} + disabled={this.props.isVendorArchived} onEnumChange={featureGroups => this.props.onFeatureGroupsChanged({featureGroups})} multiSelectedEnum={this.props.licensingData.featureGroups} name='feature-groups' @@ -295,8 +324,8 @@ class SoftwareProductDetails extends Component { }; prepareDataForGeneralSection(){ - let {softwareProductCategories, finalizedLicenseModelList, onDataChanged, currentSoftwareProduct, genericFieldInfo} = this.props; - let {name, description, vendorId, subCategory} = currentSoftwareProduct; + let {softwareProductCategories, finalizedLicenseModelList, onDataChanged, currentSoftwareProduct, genericFieldInfo, isVendorArchived, onArchivedVendorRemove} = this.props; + let {name, description, vendorId, subCategory, vendorName} = currentSoftwareProduct; return { name, description, @@ -307,13 +336,16 @@ class SoftwareProductDetails extends Component { onDataChanged, onVendorParamChanged: args => this.onVendorParamChanged(args), onSelectSubCategory: args => this.onSelectSubCategory(args), - genericFieldInfo + genericFieldInfo, + vendorName, + isVendorArchived, + onArchivedVendorRemove }; } prepareDataForLicensesSection(){ - let { featureGroupsList, licenseAgreementList, currentSoftwareProduct } = this.props; + let { featureGroupsList, licenseAgreementList, currentSoftwareProduct, isVendorArchived} = this.props; let {vendorId, licensingVersion, licensingData = {}} = currentSoftwareProduct; return { onVendorParamChanged: args => this.onVendorParamChanged(args), @@ -325,6 +357,7 @@ class SoftwareProductDetails extends Component { onLicensingDataChanged: args => this.onLicensingDataChanged(args), featureGroupsList, licenseAgreementList, + isVendorArchived }; } @@ -356,11 +389,17 @@ class SoftwareProductDetails extends Component { } onVendorParamChanged({vendorId, licensingVersion}) { + let {finalizedLicenseModelList, onVendorParamChanged} = this.props; if(!licensingVersion) { const licensingVersionsList = this.buildLicensingVersionsListItems(); licensingVersion = licensingVersionsList[0].enum; } + + if (!vendorId) { + vendorId = finalizedLicenseModelList[0].id; + } + let vendorName = finalizedLicenseModelList.find(licenseModelItem => licenseModelItem.id === vendorId).name || ''; let deltaData = { vendorId, |