diff options
author | JerzySzachniewicz <jerzy.szachniewicz@nokia.com> | 2021-02-12 13:53:13 +0100 |
---|---|---|
committer | Christophe Closset <christophe.closset@intl.att.com> | 2021-02-17 15:43:47 +0000 |
commit | f2c0a4118c3c0b6360b639622766543bd754b59c (patch) | |
tree | 19e8aa82bc11dd1be0d487dde833cbaa33d69cfd /openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage | |
parent | 7f418398a37283d68c0fc934e0e4a91f529fe466 (diff) |
Creation of Vendor Licensing Model is an optional step in VSP onboarding
Issue-ID: SDC-3471
Signed-off-by: JerzySzachniewicz <jerzy.szachniewicz@nokia.com>
Change-Id: Icb98d0832c49939e200ece77f4ca26744cb82222
Diffstat (limited to 'openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage')
2 files changed, 93 insertions, 28 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 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 ( <div className="software-product-landing-wrapper"> <Dropzone @@ -106,7 +113,8 @@ class SoftwareProductLandingPageView extends React.Component { currentSoftwareProduct={ currentSoftwareProduct } - onDetailsSelect={onDetailsSelect} + licenceChange={licenceChange} + onLicenseChange={onLicenseChange} /> {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 ( <div className="details-panel"> <div className="software-product-landing-view-heading-title"> {i18n('Software Product Details')} </div> - <div - className="software-product-landing-view-top-block clickable" - onClick={() => onDetailsSelect(currentSoftwareProduct)}> + <div className="software-product-landing-view-top-block"> <div className="details-container"> <div className="single-detail-section title-section"> <div className="single-detail-section title-text"> @@ -263,9 +272,11 @@ const ProductSummary = ({ currentSoftwareProduct, onDetailsSelect }) => { </div> <div className="description"> <LicenseAgreement - licenseAgreementName={ - licenseAgreementName + licenceChange={licenceChange} + currentSoftwareProduct={ + currentSoftwareProduct } + onLicenseChange={onLicenseChange} /> </div> </div> @@ -281,16 +292,52 @@ const ProductSummary = ({ currentSoftwareProduct, onDetailsSelect }) => { ); }; -const LicenseAgreement = ({ licenseAgreementName }) => { - if (!licenseAgreementName) { - return ( - <div className="missing-license"> - <SVGIcon color="warning" name="exclamationTriangleFull" /> - <div className="warning-text">{i18n('Missing')}</div> - </div> - ); - } - return <div>{licenseAgreementName}</div>; +const LicenseAgreement = ({ + licenceChange, + currentSoftwareProduct, + onLicenseChange +}) => { + return ( + <div className="missing-license"> + <form> + <input + type="radio" + value="INTERNAL" + id="INTERNAL" + onChange={event => + licenceChange( + event, + currentSoftwareProduct, + onLicenseChange + ) + } + checked={currentSoftwareProduct.licenseType === 'INTERNAL'} + name="license" + /> + <div className="description licenceLabel"> + {i18n('Internal license')} + </div> + <br /> + <input + type="radio" + value="EXTERNAL" + id="EXTERNAL" + onChange={event => + licenceChange( + event, + currentSoftwareProduct, + onLicenseChange + ) + } + checked={currentSoftwareProduct.licenseType === 'EXTERNAL'} + name="license" + /> + <div className="description licenceLabel"> + {i18n('External license')} + </div> + </form> + </div> + ); }; export default SoftwareProductLandingPageView; |