summaryrefslogtreecommitdiffstats
path: root/openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage
diff options
context:
space:
mode:
authormarine <marine.de.dorlodot@intl.att.com>2021-06-18 17:51:46 +0200
committerMichael Morris <michael.morris@est.tech>2021-07-05 08:45:12 +0000
commit3453264c35275af52a2fdcde33f6e8347a65d15b (patch)
treec33f49b95ac80b2240df631f0a354bc221d15030 /openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage
parent14a9a365c5aaaa4a34fe23541dc455134056cbdb (diff)
External license as "toggleable feature"
Code modification in onboarding BE and onboarding UI so that the External License can be seen as a toggleable feature. By default this will set to true but could be disabled. Issue-ID: SDC-3618 Signed-off-by: sebdet <sebastien.determe@intl.att.com> Change-Id: I01690c4cb44d3df590987bb340e8fbb58fe960e0 Signed-off-by: marine <marine.de.dorlodot@intl.att.com>
Diffstat (limited to 'openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage')
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPage.js2
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPageView.jsx77
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;