diff options
Diffstat (limited to 'openecomp-ui/src/sdc-app/onboarding/softwareProduct')
2 files changed, 76 insertions, 3 deletions
diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPage.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPage.js index 5dc0aab0d7..fa136f2f1b 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPage.js +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPage.js @@ -24,6 +24,7 @@ import { enums, screenTypes } from 'sdc-app/onboarding/OnboardingConstants.js'; import VNFImportActionHelper from '../vnfMarketPlace/VNFImportActionHelper.js'; export const mapStateToProps = ({ + features, softwareProduct, licenseModel: { licenseAgreement }, currentScreen: { itemPermission: { isCertified } } @@ -63,6 +64,7 @@ export const mapStateToProps = ({ fullCategoryDisplayName = `${subCategoryName} (${categoryName})`; return { + features, currentSoftwareProduct: { ...currentSoftwareProduct, licenseAgreementName, diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPageView.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPageView.jsx index f5cd4c6e71..3e320c4a24 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPageView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPageView.jsx @@ -23,6 +23,7 @@ import Configuration from 'sdc-app/config/Configuration.js'; import DraggableUploadFileBox from 'nfvo-components/fileupload/DraggableUploadFileBox.jsx'; import VnfRepositorySearchBox from 'nfvo-components/vnfMarketPlace/VnfRepositorySearchBox.jsx'; +import { SVGIcon } from 'onap-ui-react'; import SoftwareProductComponentsList from 'sdc-app/onboarding/softwareProduct/components/SoftwareProductComponents.js'; const SoftwareProductPropType = PropTypes.shape({ @@ -52,6 +53,13 @@ class SoftwareProductLandingPageView extends React.Component { files: [] }; + constructor(props) { + super(props); + this.getExternalLicenceFeatureState = this.getExternalLicenceFeatureState.bind( + this + ); + } + static propTypes = { currentSoftwareProduct: SoftwareProductPropType, isReadOnlyMode: PropTypes.bool, @@ -76,10 +84,19 @@ class SoftwareProductLandingPageView extends React.Component { } licenceChange = (e, currentSoftwareProduct, onLicenseChange) => { - currentSoftwareProduct.licenseType = e.target.value; + currentSoftwareProduct.licenseType = e.target.value + ? e.target.value + : 'INTERNAL'; onLicenseChange(currentSoftwareProduct); }; + getExternalLicenceFeatureState() { + var licenseFeature = this.props.features.find( + feature => feature.name === 'EXTERNAL_LICENCE' + ); + return licenseFeature ? licenseFeature.active : true; + } + render() { let { currentSoftwareProduct, @@ -115,6 +132,7 @@ class SoftwareProductLandingPageView extends React.Component { } licenceChange={licenceChange} onLicenseChange={onLicenseChange} + externalLicenceEnabled={this.getExternalLicenceFeatureState()} /> {this.renderProductDetails( isManual, @@ -234,7 +252,8 @@ class SoftwareProductLandingPageView extends React.Component { const ProductSummary = ({ currentSoftwareProduct, licenceChange, - onLicenseChange + onLicenseChange, + externalLicenceEnabled }) => { let { name = '', @@ -277,6 +296,9 @@ const ProductSummary = ({ currentSoftwareProduct } onLicenseChange={onLicenseChange} + externalLicenceEnabled={ + externalLicenceEnabled + } /> </div> </div> @@ -292,7 +314,7 @@ const ProductSummary = ({ ); }; -const LicenseAgreement = ({ +const LicenseAgreementWithExternal = ({ licenceChange, currentSoftwareProduct, onLicenseChange @@ -340,4 +362,53 @@ const LicenseAgreement = ({ ); }; +const LicenseAgreementWithoutExternal = ({ + licenceChange, + currentSoftwareProduct, + onLicenseChange +}) => { + if (!currentSoftwareProduct.licenseAgreementName) { + return ( + <div + className="missing-license clickable" + onClick={event => + licenceChange( + event, + currentSoftwareProduct, + onLicenseChange + ) + }> + <SVGIcon color="warning" name="exclamationTriangleFull" /> + <div className="warning-text">{i18n('Missing')}</div> + </div> + ); + } + return <div>{currentSoftwareProduct.licenseAgreementName}</div>; +}; + +const LicenseAgreement = ({ + licenceChange, + currentSoftwareProduct, + onLicenseChange, + externalLicenceEnabled +}) => { + if (externalLicenceEnabled) { + return ( + <LicenseAgreementWithExternal + licenceChange={licenceChange} + currentSoftwareProduct={currentSoftwareProduct} + onLicenseChange={onLicenseChange} + /> + ); + } else { + return ( + <LicenseAgreementWithoutExternal + licenceChange={licenceChange} + currentSoftwareProduct={currentSoftwareProduct} + onLicenseChange={onLicenseChange} + /> + ); + } +}; + export default SoftwareProductLandingPageView; |