summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/togglz/ToggleableFeature.java2
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/togglz/TogglzConfiguration.java7
-rw-r--r--openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_5_setup_configuration.rb8
-rw-r--r--openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/templates/default/features.properties.erb1
-rw-r--r--openecomp-be/dist/sdc-onboard-backend-docker/artifacts/startup.sh1
-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
-rw-r--r--openecomp-ui/test/softwareProduct/landingPage/landingPage.test.js15
8 files changed, 102 insertions, 11 deletions
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/togglz/ToggleableFeature.java b/common-be/src/main/java/org/openecomp/sdc/be/togglz/ToggleableFeature.java
index bc60eb9be4..7cd5bbdc44 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/togglz/ToggleableFeature.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/togglz/ToggleableFeature.java
@@ -25,7 +25,7 @@ import org.togglz.core.annotation.Label;
import org.togglz.core.context.FeatureContext;
public enum ToggleableFeature implements Feature {
- @Label("Default Feature") DEFAULT_FEATURE, @Label("Healing") HEALING;
+ @Label("Default Feature") DEFAULT_FEATURE, @Label("Healing") HEALING, @Label("External License") EXTERNAL_LICENSE;
public static Feature getFeatureByName(String featureName) {
return Arrays.stream(values()).filter(e -> e.name().equals(featureName)).findFirst().orElse(null);
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/togglz/TogglzConfiguration.java b/common-be/src/main/java/org/openecomp/sdc/be/togglz/TogglzConfiguration.java
index 9278b4fb44..9f5b486354 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/togglz/TogglzConfiguration.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/togglz/TogglzConfiguration.java
@@ -29,7 +29,10 @@ import org.togglz.core.user.UserProvider;
public class TogglzConfiguration implements TogglzConfig {
- private static final String TOGGLZ_FILE_LOCATION = "/tmp/features.properties";
+ private String togglzFileLocation;
+ public TogglzConfiguration(){
+ this.togglzFileLocation = System.getProperty("features.properties","/tmp/features.properties");
+ }
@Override
public Class<? extends Feature> getFeatureClass() {
@@ -38,7 +41,7 @@ public class TogglzConfiguration implements TogglzConfig {
@Override
public StateRepository getStateRepository() {
- return new FileBasedStateRepository(new File(TOGGLZ_FILE_LOCATION));
+ return new FileBasedStateRepository(new File(togglzFileLocation));
}
@Override
diff --git a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_5_setup_configuration.rb b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_5_setup_configuration.rb
index cb8d392741..1cd2ed284f 100644
--- a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_5_setup_configuration.rb
+++ b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_5_setup_configuration.rb
@@ -70,3 +70,11 @@ template "ExternalTestingConfiguration" do
:EP2_CONFIG => node['EXTTEST']['ep2_config']
})
end
+
+template "FeaturesProperties" do
+ path "#{ENV['JETTY_BASE']}/config/onboarding-be/features.properties"
+ source "features.properties.erb"
+ owner "#{ENV['JETTY_USER']}"
+ group "#{ENV['JETTY_GROUP']}"
+ mode "0755"
+end
diff --git a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/templates/default/features.properties.erb b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/templates/default/features.properties.erb
new file mode 100644
index 0000000000..1f87ee24d4
--- /dev/null
+++ b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/templates/default/features.properties.erb
@@ -0,0 +1 @@
+EXTERNAL_LICENSE=true \ No newline at end of file
diff --git a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/startup.sh b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/startup.sh
index 7381d50dfe..dc68d6f3a5 100644
--- a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/startup.sh
+++ b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/startup.sh
@@ -6,6 +6,7 @@ JAVA_OPTIONS="$JAVA_OPTIONS \
-Dlog.home=$JETTY_BASE/logs \
-Dlogback.configurationFile=$JETTY_BASE/config/onboarding-be/logback.xml \
-Dconfiguration.yaml=$JETTY_BASE/config/onboarding-be/onboarding_configuration.yaml \
+ -Dfeatures.properties=$JETTY_BASE/config/onboarding-be/features.properties \
-Dconfig.location=$JETTY_BASE/config/onboarding-be/."
cd $JETTY_BASE
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;
diff --git a/openecomp-ui/test/softwareProduct/landingPage/landingPage.test.js b/openecomp-ui/test/softwareProduct/landingPage/landingPage.test.js
index 3928a3de95..ff36101c32 100644
--- a/openecomp-ui/test/softwareProduct/landingPage/landingPage.test.js
+++ b/openecomp-ui/test/softwareProduct/landingPage/landingPage.test.js
@@ -95,7 +95,8 @@ describe('Software Product Landing Page: ', function () {
const params = {
...currentScreen.props,
currentSoftwareProduct,
- componentsList: VSPComponentsFactory.buildList(2)
+ componentsList: VSPComponentsFactory.buildList(2),
+ features: [{name:'EXTERNAL_LICENCE', active: true}]
};
const store = storeCreator();
@@ -111,7 +112,8 @@ describe('Software Product Landing Page: ', function () {
const params = {
...currentScreen.props,
currentSoftwareProduct,
- componentsList: VSPComponentsFactory.buildList(2)
+ componentsList: VSPComponentsFactory.buildList(2),
+ features: [{name:'EXTERNAL_LICENCE', active: true}]
};
const e = { target: {
value: 'INTERNAL'
@@ -140,7 +142,8 @@ describe('Software Product Landing Page: ', function () {
const params = {
currentSoftwareProduct,
...currentScreen.props,
- componentsList: VSPComponentsFactory.buildList(2)
+ componentsList: VSPComponentsFactory.buildList(2),
+ features: [{name:'EXTERNAL_LICENCE', active: true}]
};
const store = storeCreator();
@@ -167,7 +170,8 @@ describe('Software Product Landing Page: ', function () {
componentsList: VSPComponentsFactory.buildList(2),
onUploadConfirmation: dummyFunc,
onUpload: dummyFunc,
- onInvalidFileSizeUpload: dummyFunc
+ onInvalidFileSizeUpload: dummyFunc,
+ features: [{name:'EXTERNAL_LICENCE', active: true}]
};
const files = [
@@ -210,7 +214,8 @@ describe('Software Product Landing Page: ', function () {
componentsList: VSPComponentsFactory.buildList(2),
onUploadConfirmation: dummyFunc,
onUpload: dummyFunc,
- onInvalidFileSizeUpload: dummyFunc
+ onInvalidFileSizeUpload: dummyFunc,
+ features: [{name:'EXTERNAL_LICENCE', active: true}]
};
const store = storeCreator();