aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-ui/src/sdc-app/onboarding/softwareProduct
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-ui/src/sdc-app/onboarding/softwareProduct')
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js1
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsView.jsx25
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPage.js30
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPageView.jsx91
4 files changed, 113 insertions, 34 deletions
diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js
index a067fd4765..02e5a24f3b 100644
--- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js
@@ -134,6 +134,7 @@ function putSoftwareProduct({ softwareProduct, version }) {
? softwareProduct.licensingVersion
: undefined,
icon: softwareProduct.icon,
+ licenseType: softwareProduct.licenseType,
licensingData: getLicensingData(softwareProduct.licensingData)
}
);
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 dbc04d0e87..06ecf6b773 100644
--- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsView.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsView.jsx
@@ -204,7 +204,8 @@ class LicensesSection extends React.Component {
onLicensingDataChanged: PropTypes.func.isRequired,
featureGroupsList: PropTypes.array,
licenseAgreementList: PropTypes.array,
- isVendorArchived: PropTypes.bool
+ isVendorArchived: PropTypes.bool,
+ licenseType: PropTypes.string
};
onVendorParamChanged(e) {
@@ -234,7 +235,10 @@ class LicensesSection extends React.Component {
onChange={e => this.onVendorParamChanged(e)}
value={this.props.licensingVersion || ''}
label={i18n('Licensing Version')}
- disabled={this.props.isVendorArchived}
+ disabled={
+ this.props.isVendorArchived ||
+ this.props.licenseType !== 'internal'
+ }
type="select">
{this.props.licensingVersionsList.map(version => (
<option key={version.enum} value={version.enum}>
@@ -248,7 +252,10 @@ class LicensesSection extends React.Component {
data-test-id="vsp-license-agreement"
label={i18n('License Agreement')}
type="select"
- disabled={this.props.isVendorArchived}
+ disabled={
+ this.props.isVendorArchived ||
+ this.props.licenseType !== 'internal'
+ }
value={
this.props.licensingData.licenseAgreement
? this.props.licensingData.licenseAgreement
@@ -272,7 +279,10 @@ class LicensesSection extends React.Component {
type="select"
isMultiSelect={true}
onInputChange={() => {}}
- disabled={this.props.isVendorArchived}
+ disabled={
+ this.props.isVendorArchived ||
+ this.props.licenseType !== 'internal'
+ }
onEnumChange={featureGroups =>
this.props.onFeatureGroupsChanged({
featureGroups
@@ -466,6 +476,7 @@ class SoftwareProductDetails extends Component {
vendorId: PropTypes.string,
vendorName: PropTypes.string,
licensingVersion: PropTypes.string,
+ licenseType: PropTypes.string,
licensingData: PropTypes.shape({
licenceAgreement: PropTypes.string,
featureGroups: PropTypes.array
@@ -527,7 +538,8 @@ class SoftwareProductDetails extends Component {
let {
vendorId,
licensingVersion,
- licensingData = {}
+ licensingData = {},
+ licenseType
} = currentSoftwareProduct;
return {
onVendorParamChanged: args => this.onVendorParamChanged(args),
@@ -539,7 +551,8 @@ class SoftwareProductDetails extends Component {
onLicensingDataChanged: args => this.onLicensingDataChanged(args),
featureGroupsList,
licenseAgreementList,
- isVendorArchived
+ isVendorArchived,
+ licenseType
};
}
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;