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>
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);
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() {
@Override
public StateRepository getStateRepository() {
- return new FileBasedStateRepository(new File(TOGGLZ_FILE_LOCATION));
+ return new FileBasedStateRepository(new File(togglzFileLocation));
}
@Override
: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
--- /dev/null
+EXTERNAL_LICENSE=true
\ No newline at end of file
-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
import VNFImportActionHelper from '../vnfMarketPlace/VNFImportActionHelper.js';
export const mapStateToProps = ({
+ features,
softwareProduct,
licenseModel: { licenseAgreement },
currentScreen: { itemPermission: { isCertified } }
fullCategoryDisplayName = `${subCategoryName} (${categoryName})`;
return {
+ features,
currentSoftwareProduct: {
...currentSoftwareProduct,
licenseAgreementName,
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({
files: []
};
+ constructor(props) {
+ super(props);
+ this.getExternalLicenceFeatureState = this.getExternalLicenceFeatureState.bind(
+ this
+ );
+ }
+
static propTypes = {
currentSoftwareProduct: SoftwareProductPropType,
isReadOnlyMode: PropTypes.bool,
}
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,
}
licenceChange={licenceChange}
onLicenseChange={onLicenseChange}
+ externalLicenceEnabled={this.getExternalLicenceFeatureState()}
/>
{this.renderProductDetails(
isManual,
const ProductSummary = ({
currentSoftwareProduct,
licenceChange,
- onLicenseChange
+ onLicenseChange,
+ externalLicenceEnabled
}) => {
let {
name = '',
currentSoftwareProduct
}
onLicenseChange={onLicenseChange}
+ externalLicenceEnabled={
+ externalLicenceEnabled
+ }
/>
</div>
</div>
);
};
-const LicenseAgreement = ({
+const LicenseAgreementWithExternal = ({
licenceChange,
currentSoftwareProduct,
onLicenseChange
);
};
+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;
const params = {
...currentScreen.props,
currentSoftwareProduct,
- componentsList: VSPComponentsFactory.buildList(2)
+ componentsList: VSPComponentsFactory.buildList(2),
+ features: [{name:'EXTERNAL_LICENCE', active: true}]
};
const store = storeCreator();
const params = {
...currentScreen.props,
currentSoftwareProduct,
- componentsList: VSPComponentsFactory.buildList(2)
+ componentsList: VSPComponentsFactory.buildList(2),
+ features: [{name:'EXTERNAL_LICENCE', active: true}]
};
const e = { target: {
value: 'INTERNAL'
const params = {
currentSoftwareProduct,
...currentScreen.props,
- componentsList: VSPComponentsFactory.buildList(2)
+ componentsList: VSPComponentsFactory.buildList(2),
+ features: [{name:'EXTERNAL_LICENCE', active: true}]
};
const store = storeCreator();
componentsList: VSPComponentsFactory.buildList(2),
onUploadConfirmation: dummyFunc,
onUpload: dummyFunc,
- onInvalidFileSizeUpload: dummyFunc
+ onInvalidFileSizeUpload: dummyFunc,
+ features: [{name:'EXTERNAL_LICENCE', active: true}]
};
const files = [
componentsList: VSPComponentsFactory.buildList(2),
onUploadConfirmation: dummyFunc,
onUpload: dummyFunc,
- onInvalidFileSizeUpload: dummyFunc
+ onInvalidFileSizeUpload: dummyFunc,
+ features: [{name:'EXTERNAL_LICENCE', active: true}]
};
const store = storeCreator();