From f2c0a4118c3c0b6360b639622766543bd754b59c Mon Sep 17 00:00:00 2001 From: JerzySzachniewicz Date: Fri, 12 Feb 2021 13:53:13 +0100 Subject: Creation of Vendor Licensing Model is an optional step in VSP onboarding Issue-ID: SDC-3471 Signed-off-by: JerzySzachniewicz Change-Id: Icb98d0832c49939e200ece77f4ca26744cb82222 --- .../landingPage/SoftwareProductLandingPage.js | 30 +++++-- .../landingPage/SoftwareProductLandingPageView.jsx | 91 ++++++++++++++++------ 2 files changed, 93 insertions(+), 28 deletions(-) (limited to 'openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage') 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 52a69803a6..5dc0aab0d7 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPage.js +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPage.js @@ -75,14 +75,32 @@ export const mapStateToProps = ({ }; }; +function handleScreenChange(softwareProduct, dispatch, version) { + const softwareProductId = softwareProduct.id; + if (softwareProduct.licenseType === 'INTERNAL') { + ScreensHelper.loadScreen(dispatch, { + screen: enums.SCREEN.SOFTWARE_PRODUCT_DETAILS, + screenType: screenTypes.SOFTWARE_PRODUCT, + props: { softwareProductId, version } + }); + } else { + ScreensHelper.loadScreen(dispatch, { + screen: enums.SCREEN.SOFTWARE_PRODUCT_LANDING_PAGE, + screenType: screenTypes.SOFTWARE_PRODUCT, + props: { softwareProductId, version } + }); + } +} + const mapActionsToProps = (dispatch, { version }) => { return { - onDetailsSelect: ({ id: softwareProductId }) => - ScreensHelper.loadScreen(dispatch, { - screen: enums.SCREEN.SOFTWARE_PRODUCT_DETAILS, - screenType: screenTypes.SOFTWARE_PRODUCT, - props: { softwareProductId, version } - }), + onLicenseChange: softwareProduct => { + SoftwareProductActionHelper.updateSoftwareProductData(dispatch, { + softwareProduct, + version + }).then(() => {}); + handleScreenChange(softwareProduct, dispatch, version); + }, onCandidateInProcess: softwareProductId => ScreensHelper.loadScreen(dispatch, { screen: enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS_SETUP, 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 e4337c70d1..f5cd4c6e71 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPageView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPageView.jsx @@ -23,7 +23,6 @@ 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({ @@ -33,6 +32,7 @@ const SoftwareProductPropType = PropTypes.shape({ id: PropTypes.string, categoryId: PropTypes.string, vendorId: PropTypes.string, + licenseType: PropTypes.string, status: PropTypes.string, licensingData: PropTypes.object, validationData: PropTypes.object @@ -57,7 +57,7 @@ class SoftwareProductLandingPageView extends React.Component { isReadOnlyMode: PropTypes.bool, componentsList: PropTypes.arrayOf(ComponentPropType), version: PropTypes.object, - onDetailsSelect: PropTypes.func, + onLicenseChange: PropTypes.func, onUpload: PropTypes.func, onUploadConfirmation: PropTypes.func, onInvalidFileSizeUpload: PropTypes.func, @@ -74,13 +74,20 @@ class SoftwareProductLandingPageView extends React.Component { onCandidateInProcess(currentSoftwareProduct.id); } } + + licenceChange = (e, currentSoftwareProduct, onLicenseChange) => { + currentSoftwareProduct.licenseType = e.target.value; + onLicenseChange(currentSoftwareProduct); + }; + render() { let { currentSoftwareProduct, isReadOnlyMode, isManual, - onDetailsSelect + onLicenseChange } = this.props; + let licenceChange = this.licenceChange; return (
{this.renderProductDetails( isManual, @@ -223,22 +231,23 @@ class SoftwareProductLandingPageView extends React.Component { } } -const ProductSummary = ({ currentSoftwareProduct, onDetailsSelect }) => { +const ProductSummary = ({ + currentSoftwareProduct, + licenceChange, + onLicenseChange +}) => { let { name = '', description = '', vendorName = '', - fullCategoryDisplayName = '', - licenseAgreementName = '' + fullCategoryDisplayName = '' } = currentSoftwareProduct; return (
{i18n('Software Product Details')}
-
onDetailsSelect(currentSoftwareProduct)}> +
@@ -263,9 +272,11 @@ const ProductSummary = ({ currentSoftwareProduct, onDetailsSelect }) => {
@@ -281,16 +292,52 @@ const ProductSummary = ({ currentSoftwareProduct, onDetailsSelect }) => { ); }; -const LicenseAgreement = ({ licenseAgreementName }) => { - if (!licenseAgreementName) { - return ( -
- -
{i18n('Missing')}
-
- ); - } - return
{licenseAgreementName}
; +const LicenseAgreement = ({ + licenceChange, + currentSoftwareProduct, + onLicenseChange +}) => { + return ( +
+
+ + licenceChange( + event, + currentSoftwareProduct, + onLicenseChange + ) + } + checked={currentSoftwareProduct.licenseType === 'INTERNAL'} + name="license" + /> +
+ {i18n('Internal license')} +
+
+ + licenceChange( + event, + currentSoftwareProduct, + onLicenseChange + ) + } + checked={currentSoftwareProduct.licenseType === 'EXTERNAL'} + name="license" + /> +
+ {i18n('External license')} +
+
+
+ ); }; export default SoftwareProductLandingPageView; -- cgit