Add collaboration feature
Issue-ID: SDC-767
Change-Id: I14fb4c1f54086ed03a56a7ff7fab9ecd40381795
Signed-off-by: talig <talig@amdocs.com>
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModel.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModel.js
index 895a329..73027c7 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModel.js
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModel.js
@@ -16,18 +16,17 @@
import {connect} from 'react-redux';
import i18n from 'nfvo-utils/i18n/i18n.js';
-import VersionControllerUtils from 'nfvo-components/panel/versionController/VersionControllerUtils.js';
import TabulatedEditor from 'src/nfvo-components/editor/TabulatedEditor.jsx';
-import ActivityLogActionHelper from 'sdc-app/common/activity-log/ActivityLogActionHelper.js';
-import {enums} from 'sdc-app/onboarding/OnboardingConstants.js';
-import OnboardingActionHelper from 'sdc-app/onboarding/OnboardingActionHelper.js';
+import ScreensHelper from 'sdc-app/common/helpers/ScreensHelper.js';
+import {enums, screenTypes} from 'sdc-app/onboarding/OnboardingConstants.js';
-import {navigationItems} from './LicenseModelConstants.js';
+import PermissionsActionHelper from './../permissions/PermissionsActionHelper.js';
+import RevisionsActionHelper from './../revisions/RevisionsActionHelper.js';
+
import LicenseModelActionHelper from './LicenseModelActionHelper.js';
-import LicenseAgreementActionHelper from './licenseAgreement/LicenseAgreementActionHelper.js';
-import FeatureGroupsActionHelper from './featureGroups/FeatureGroupsActionHelper.js';
-import EntitlementPoolsActionHelper from './entitlementPools/EntitlementPoolsActionHelper.js';
-import LicenseKeyGroupsActionHelper from './licenseKeyGroups/LicenseKeyGroupsActionHelper.js';
+import {actionTypes as modalActionTypes} from 'nfvo-components/modal/GlobalModalConstants.js';
+import {modalContentMapper} from 'sdc-app/common/modal/ModalContentMapper.js';
+import {CommitModalType} from 'nfvo-components/panel/versionController/components/CommitCommentModal.jsx';
const buildNavigationBarProps = (licenseModel, screen) => {
@@ -39,131 +38,135 @@
name: vendorName,
items: [
{
- id: navigationItems.LICENSE_MODEL_OVERVIEW,
+ id: enums.SCREEN.LICENSE_MODEL_OVERVIEW,
name: i18n('Overview'),
meta
},
{
- id: navigationItems.LICENSE_AGREEMENTS,
+ id: enums.SCREEN.LICENSE_AGREEMENTS,
name: i18n('License Agreements'),
meta
},
{
- id: navigationItems.FEATURE_GROUPS,
+ id: enums.SCREEN.FEATURE_GROUPS,
name: i18n('Feature Groups'),
meta
},
{
- id: navigationItems.ENTITLEMENT_POOLS,
+ id: enums.SCREEN.ENTITLEMENT_POOLS,
name: i18n('Entitlement Pools'),
meta
},
{
- id: navigationItems.LICENSE_KEY_GROUPS,
+ id: enums.SCREEN.LICENSE_KEY_GROUPS,
name: i18n('License Key Groups'),
meta
},
{
- id: navigationItems.ACTIVITY_LOG,
+ id: enums.SCREEN.ACTIVITY_LOG,
name: i18n('Activity Log'),
meta
}
]
}];
- const activeItemId = ({
- [enums.SCREEN.LICENSE_MODEL_OVERVIEW]: navigationItems.LICENSE_MODEL_OVERVIEW,
- [enums.SCREEN.LICENSE_AGREEMENTS]: navigationItems.LICENSE_AGREEMENTS,
- [enums.SCREEN.FEATURE_GROUPS]: navigationItems.FEATURE_GROUPS,
- [enums.SCREEN.ENTITLEMENT_POOLS]: navigationItems.ENTITLEMENT_POOLS,
- [enums.SCREEN.LICENSE_KEY_GROUPS]: navigationItems.LICENSE_KEY_GROUPS,
- [enums.SCREEN.ACTIVITY_LOG]: navigationItems.ACTIVITY_LOG
- })[screen];
-
return {
- activeItemId, groups
+ activeItemId: screen, groups
};
};
-const buildVersionControllerProps = (licenseModel) => {
- let {version, viewableVersions, status: currentStatus, lockingUser} = licenseModel;
- let {status, isCheckedOut} = VersionControllerUtils.getCheckOutStatusKindByUserID(currentStatus, lockingUser);
-
+const buildVersionControllerProps = ({
+ licenseModelEditor = {data: {}},
+ versions,
+ currentVersion,
+ userInfo,
+ usersList,
+ permissions,
+ itemPermission,
+ isReadOnlyMode
+}) => {
+ const {isValidityData = true} = licenseModelEditor;
return {
- version,
- viewableVersions,
- status,
- isCheckedOut
+ version: currentVersion,
+ viewableVersions: versions,
+ isFormDataValid: isValidityData,
+ permissions,
+ userInfo,
+ usersList,
+ itemName: licenseModelEditor.data.vendorName,
+ itemPermission,
+ isReadOnlyMode
};
};
-const mapStateToProps = ({licenseModel: {licenseModelEditor}}, {currentScreen: {screen}}) => {
+const mapStateToProps = ({
+ users: {userInfo, usersList},
+ licenseModel: {licenseModelEditor},
+ versionsPage: {permissions, versionsList: {versions, itemName}}
+}, {
+ currentScreen: {screen, itemPermission, props: {isReadOnlyMode, version: currentVersion}}
+}) => {
return {
- versionControllerProps: buildVersionControllerProps(licenseModelEditor.data),
+ versionControllerProps: buildVersionControllerProps({
+ licenseModelEditor,
+ versions,
+ currentVersion,
+ userInfo,
+ permissions,
+ usersList,
+ itemPermission,
+ isReadOnlyMode
+ }),
navigationBarProps: buildNavigationBarProps(licenseModelEditor.data, screen)
};
};
-const mapActionsToProps = (dispatch, {currentScreen: {screen, props: {licenseModelId}}}) => {
+const mapActionsToProps = (dispatch, {currentScreen: {screen, props: {licenseModelId, version}}}) => {
return {
- onVersionControllerAction: (action, version) =>
- LicenseModelActionHelper.performVCAction(dispatch, {licenseModelId, action, version}).then((newVersion) => {
- switch(screen) {
- case enums.SCREEN.LICENSE_MODEL_OVERVIEW:
- /**
- * TODO change to specific rest
- */
- LicenseAgreementActionHelper.fetchLicenseAgreementList(dispatch, {licenseModelId, version: newVersion});
- break;
- case enums.SCREEN.LICENSE_AGREEMENTS:
- LicenseAgreementActionHelper.fetchLicenseAgreementList(dispatch, {licenseModelId, version: newVersion});
- break;
- case enums.SCREEN.FEATURE_GROUPS:
- FeatureGroupsActionHelper.fetchFeatureGroupsList(dispatch, {licenseModelId, version: newVersion});
- break;
- case enums.SCREEN.ENTITLEMENT_POOLS:
- EntitlementPoolsActionHelper.fetchEntitlementPoolsList(dispatch, {licenseModelId, version: newVersion});
- break;
- case enums.SCREEN.LICENSE_KEY_GROUPS:
- LicenseKeyGroupsActionHelper.fetchLicenseKeyGroupsList(dispatch, {licenseModelId, version: newVersion});
- break;
- case enums.SCREEN.ACTIVITY_LOG:
- ActivityLogActionHelper.fetchActivityLog(dispatch, {itemId: licenseModelId, versionId: newVersion.id});
- break;
- }
+ onVersionControllerAction: (action, version, comment) =>
+ LicenseModelActionHelper.performVCAction(dispatch, {licenseModelId, action, version, comment}).then(updatedVersion => {
+ ScreensHelper.loadScreen(dispatch, {screen, screenType: screenTypes.LICENSE_MODEL, props: {licenseModelId, version: updatedVersion}});
}),
- onVersionSwitching: version => {
- LicenseModelActionHelper.switchVersion(dispatch, {licenseModelId, version});
- if(screen === enums.SCREEN.ACTIVITY_LOG) {
- ActivityLogActionHelper.fetchActivityLog(dispatch, {itemId: licenseModelId, versionId: version.id});
+
+ onOpenCommentCommitModal: ({onCommit, title}) => dispatch({
+ type: modalActionTypes.GLOBAL_MODAL_SHOW,
+ data: {
+ modalComponentName: modalContentMapper.COMMIT_COMMENT,
+ modalComponentProps: {
+ onCommit,
+ type: CommitModalType.COMMIT
+ },
+ title
}
+ }),
+
+ onVersionSwitching: version => {
+ ScreensHelper.loadScreen(dispatch, {screen, screenType: screenTypes.LICENSE_MODEL, props: {licenseModelId, version}});
},
- onNavigate: ({id, meta: {version}}) => {
- switch(id) {
- case navigationItems.LICENSE_MODEL_OVERVIEW:
- OnboardingActionHelper.navigateToLicenseModelOverview(dispatch, {licenseModelId, version});
- break;
- case navigationItems.LICENSE_AGREEMENTS:
- OnboardingActionHelper.navigateToLicenseAgreements(dispatch, {licenseModelId, version});
- break;
- case navigationItems.FEATURE_GROUPS:
- OnboardingActionHelper.navigateToFeatureGroups(dispatch, {licenseModelId, version});
- break;
- case navigationItems.ENTITLEMENT_POOLS:
- OnboardingActionHelper.navigateToEntitlementPools(dispatch, {licenseModelId, version});
- break;
- case navigationItems.LICENSE_KEY_GROUPS:
- OnboardingActionHelper.navigateToLicenseKeyGroups(dispatch, {licenseModelId, version});
- break;
- case navigationItems.ACTIVITY_LOG:
- OnboardingActionHelper.navigateToLicenseModelActivityLog(dispatch, {licenseModelId, version});
- break;
- }
+ onManagePermissions() {
+ PermissionsActionHelper.openPermissonsManager(dispatch, {itemId: licenseModelId, askForRights: false});
+ },
+
+ onMoreVersionsClick: ({itemName, users}) => {
+ ScreensHelper.loadScreen(dispatch, {screen: enums.SCREEN.VERSIONS_PAGE, screenType: screenTypes.LICENSE_MODEL,
+ props: {licenseModelId, licenseModel: {name: itemName}, usersList: users}});
+ },
+
+ onOpenPermissions: ({users}) => {
+ return PermissionsActionHelper.fetchItemUsers(dispatch, {itemId: licenseModelId, allUsers: users});
+ },
+
+ onOpenRevisionsModal: () => {
+ return RevisionsActionHelper.openRevisionsView(dispatch, {itemId: licenseModelId, version: version, itemType: screenTypes.LICENSE_MODEL});
+ },
+
+ onNavigate: ({id}) => {
+ ScreensHelper.loadScreen(dispatch, {screen: id, screenType: screenTypes.LICENSE_MODEL, props: {licenseModelId, version}});
}
};
};
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelActionHelper.js
index 788528f..ff264b3 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelActionHelper.js
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelActionHelper.js
@@ -23,7 +23,14 @@
import FeatureGroupsActionHelper from './featureGroups/FeatureGroupsActionHelper.js';
import EntitlementPoolsActionHelper from './entitlementPools/EntitlementPoolsActionHelper.js';
import LicenseKeyGroupsActionHelper from './licenseKeyGroups/LicenseKeyGroupsActionHelper.js';
-import OnboardingActionHelper from 'sdc-app/onboarding/OnboardingActionHelper.js';
+import ItemsHelper from '../../common/helpers/ItemsHelper.js';
+import MergeEditorActionHelper from 'sdc-app/common/merge/MergeEditorActionHelper.js';
+import {modalContentMapper} from 'sdc-app/common/modal/ModalContentMapper.js';
+import {CommitModalType} from 'nfvo-components/panel/versionController/components/CommitCommentModal.jsx';
+import versionPageActionHelper from 'sdc-app/onboarding/versionsPage/VersionsPageActionHelper.js';
+import {itemTypes} from 'sdc-app/onboarding/versionsPage/VersionsPageConstants.js';
+import {catalogItemStatuses} from 'sdc-app/onboarding/onboard/onboardingCatalog/OnboardingCatalogConstants.js';
+import {actionsEnum as VersionControllerActionsEnum} from 'nfvo-components/panel/versionController/VersionControllerConstants.js';
function baseUrl() {
const restPrefix = Configuration.get('restPrefix');
@@ -31,11 +38,11 @@
}
function fetchLicenseModels() {
- return RestAPIUtil.fetch(baseUrl());
+ return RestAPIUtil.fetch(`${baseUrl()}?versionFilter=Draft`);
}
function fetchFinalizedLicenseModels() {
- return RestAPIUtil.fetch(`${baseUrl()}?versionFilter=Final`);
+ return RestAPIUtil.fetch(`${baseUrl()}?versionFilter=Certified`);
}
function fetchLicenseModelById(licenseModelId, version) {
@@ -43,11 +50,6 @@
return RestAPIUtil.fetch(`${baseUrl()}${licenseModelId}/versions/${versionId}`);
}
-function putLicenseModelAction(id, action, version) {
- const {id: versionId} = version;
- return RestAPIUtil.put(`${baseUrl()}${id}/versions/${versionId}/actions`, {action: action});
-}
-
function putLicenseModel(licenseModel) {
let {id, vendorName, description, iconRef, version: {id: versionId}} = licenseModel;
return RestAPIUtil.put(`${baseUrl()}${id}/versions/${versionId}`, {
@@ -57,14 +59,9 @@
});
}
-function adjustMinorVersion(version, value) {
- let ar = version.split('.');
- return ar[0] + '.' + (parseInt(ar[1]) + value);
-}
-
-function adjustMajorVersion(version, value) {
- let ar = version.split('.');
- return (parseInt(ar[0]) + value) + '.0';
+function putLicenseModelAction({itemId, action, version}) {
+ const {id: versionId} = version;
+ return RestAPIUtil.put(`${baseUrl()}${itemId}/versions/${versionId}/actions`, {action: action});
}
const LicenseModelActionHelper = {
@@ -87,8 +84,8 @@
},
fetchLicenseModelById(dispatch, {licenseModelId, version}) {
-
- return fetchLicenseModelById(licenseModelId, version).then(response => {
+
+ return fetchLicenseModelById(licenseModelId, version).then(response => {
dispatch({
type: actionTypes.LICENSE_MODEL_LOADED,
response: {...response, version}
@@ -96,13 +93,6 @@
});
},
- addLicenseModel(dispatch, {licenseModel}){
- dispatch({
- type: actionTypes.ADD_LICENSE_MODEL,
- licenseModel
- });
- },
-
fetchLicenseModelItems(dispatch, {licenseModelId, version}) {
return Promise.all([
LicenseAgreementActionHelper.fetchLicenseAgreementList(dispatch, {licenseModelId, version}),
@@ -112,58 +102,94 @@
]);
},
- performVCAction(dispatch, {licenseModelId, action, version}) {
- return putLicenseModelAction(licenseModelId, action, version).then(() => {
- if(action === vcActionsEnum.SUBMIT){
+ manageSubmitAction(dispatch, {licenseModelId, version, isDirty}) {
+ if(isDirty) {
+ const onCommit = comment => {
+ return this.performVCAction(dispatch, {licenseModelId, action: vcActionsEnum.COMMIT, version, comment}).then(() => {
+ return this.performSubmitAction(dispatch, {licenseModelId, version});
+ });
+ };
+ dispatch({
+ type: modalActionTypes.GLOBAL_MODAL_SHOW,
+ data: {
+ modalComponentName: modalContentMapper.COMMIT_COMMENT,
+ modalComponentProps: {
+ onCommit,
+ type: CommitModalType.COMMIT_SUBMIT
+ },
+ title: i18n('Commit & Submit')
+ }
+ });
+ return Promise.reject();
+ }
+ return this.performSubmitAction(dispatch, {licenseModelId, version});
+ },
+
+ performSubmitAction(dispatch, {licenseModelId, version}) {
+ return putLicenseModelAction({itemId: licenseModelId, action: vcActionsEnum.SUBMIT, version}).then(() => {
+ return ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id}).then(updatedVersion => {
dispatch({
type: modalActionTypes.GLOBAL_MODAL_SUCCESS,
data: {
- title: i18n('Submit Succeeded'),
+ title: i18n('Submit Succeeded'),
msg: i18n('This license model successfully submitted'),
- cancelButtonText: i18n('OK'),
+ cancelButtonText: i18n('OK'),
timeout: 2000
}
});
- }
-
- let newVersionId = version.id;
- /*
- TODO Temorary switch to change version label
- */
- switch(action) {
- case vcActionsEnum.CHECK_OUT:
- newVersionId = adjustMinorVersion(version.label, 1);
- break;
- case vcActionsEnum.UNDO_CHECK_OUT:
- newVersionId = adjustMinorVersion(version.label, -1);
- break;
- case vcActionsEnum.SUBMIT:
- newVersionId = adjustMajorVersion(version.label, 1);
- }
-
- OnboardingActionHelper.updateCurrentScreenVersion(dispatch, {label: newVersionId, id: newVersionId});
-
- LicenseModelActionHelper.fetchLicenseModelById(dispatch, {licenseModelId, version:{id: newVersionId, label: newVersionId}});
- return Promise.resolve({id: newVersionId, label: newVersionId});
+ versionPageActionHelper.fetchVersions(dispatch, {itemType: itemTypes.LICENSE_MODEL, itemId: licenseModelId});
+ return Promise.resolve(updatedVersion);
+ });
});
},
- switchVersion(dispatch, {licenseModelId, version}) {
- LicenseModelActionHelper.fetchLicenseModelById(dispatch, {licenseModelId, version: {id: version.id, label: version.label}}).then(() => {
- LicenseModelActionHelper.fetchLicenseModelItems(dispatch, {licenseModelId, version});
+ performVCAction(dispatch, {licenseModelId, action, version, comment}) {
+ return MergeEditorActionHelper.analyzeSyncResult(dispatch, {itemId: licenseModelId, version}).then(({inMerge, isDirty, updatedVersion}) => {
+ if (updatedVersion.status === catalogItemStatuses.CERTIFIED &&
+ (action === VersionControllerActionsEnum.COMMIT || action === VersionControllerActionsEnum.SYNC)) {
+ versionPageActionHelper.fetchVersions(dispatch, {itemType: itemTypes.LICENSE_MODEL, itemId: licenseModelId});
+ dispatch({
+ type: modalActionTypes.GLOBAL_MODAL_WARNING,
+ data: {
+ title: i18n('Commit error'),
+ msg: i18n('Item version already Certified'),
+ cancelButtonText: i18n('Cancel')
+ }
+ });
+ return Promise.resolve(updatedVersion);
+ }
+ if (!inMerge) {
+ if(action === vcActionsEnum.SUBMIT) {
+ return this.manageSubmitAction(dispatch, {licenseModelId, version, isDirty});
+ }
+ else {
+ return ItemsHelper.performVCAction({itemId: licenseModelId, action, version, comment}).then(() => {
+ versionPageActionHelper.fetchVersions(dispatch, {itemType: itemTypes.LICENSE_MODEL, itemId: licenseModelId});
+ if (action === vcActionsEnum.SYNC) {
+ return MergeEditorActionHelper.analyzeSyncResult(dispatch, {itemId: licenseModelId, version}).then(({updatedVersion}) => {
+ return Promise.resolve(updatedVersion);
+ });
+ } else {
+ return ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id});
+ }
+ });
+ }
+ }
});
},
saveLicenseModel(dispatch, {licenseModel}) {
return putLicenseModel(licenseModel).then(() => {
dispatch({
- type: actionTypes.ADD_LICENSE_MODEL,
- licenseModel
- });
- dispatch({
type: actionTypes.LICENSE_MODEL_LOADED,
response: licenseModel
});
+ const {id, version: {id: versionId}} = licenseModel;
+ return ItemsHelper.checkItemStatus(dispatch, {itemId: id, versionId}).then(updatedVersion => {
+ if (updatedVersion.status !== licenseModel.version.status) {
+ versionPageActionHelper.fetchVersions(dispatch, {itemType: itemTypes.LICENSE_MODEL, itemId: licenseModel.id});
+ }
+ });
});
}
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelConstants.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelConstants.js
index 960090c..283cb23 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelConstants.js
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelConstants.js
@@ -20,18 +20,9 @@
LICENSE_MODEL_LOADED: null,
LICENSE_MODELS_LIST_LOADED: null,
FINALIZED_LICENSE_MODELS_LIST_LOADED: null,
- ADD_LICENSE_MODEL: null,
EDIT_LICENSE_MODEL: null
});
-export const navigationItems = keyMirror({
- LICENSE_MODEL_OVERVIEW: 'overview',
- LICENSE_AGREEMENTS: 'license-agreements',
- FEATURE_GROUPS: 'feature-groups',
- ENTITLEMENT_POOLS: 'entitlement-pools',
- LICENSE_KEY_GROUPS: 'license-key-groups',
- ACTIVITY_LOG: 'activity-log'
-});
export const thresholdUnitType = {
ABSOLUTE: 'Absolute',
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelListReducer.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelListReducer.js
index fd73b46..36a190a 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelListReducer.js
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelListReducer.js
@@ -19,8 +19,6 @@
switch (action.type) {
case actionTypes.LICENSE_MODELS_LIST_LOADED:
return [...action.response.results];
- case actionTypes.ADD_LICENSE_MODEL:
- return [...state, action.licenseModel];
default:
return state;
}
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/creation/LicenseModelCreation.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/creation/LicenseModelCreation.js
index 39b3c15..71f4171 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/creation/LicenseModelCreation.js
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/creation/LicenseModelCreation.js
@@ -14,34 +14,42 @@
* permissions and limitations under the License.
*/
import {connect} from 'react-redux';
-import OnboardingActionHelper from 'sdc-app/onboarding/OnboardingActionHelper.js';
import LicenseModelCreationActionHelper from './LicenseModelCreationActionHelper.js';
import LicenseModelCreationView from './LicenseModelCreationView.jsx';
import ValidationHelper from 'sdc-app/common/helpers/ValidationHelper.js';
import LicenseModelActionHelper from 'sdc-app/onboarding/licenseModel/LicenseModelActionHelper.js';
+import VersionsPageActionHelper from 'sdc-app/onboarding/versionsPage/VersionsPageActionHelper.js';
+import {itemTypes as versionItemTypes} from 'sdc-app/onboarding/versionsPage/VersionsPageConstants.js';
+import ScreensHelper from 'sdc-app/common/helpers/ScreensHelper.js';
+import {enums, screenTypes} from 'sdc-app/onboarding/OnboardingConstants.js';
+import PermissionsActionHelper from 'sdc-app/onboarding/permissions/PermissionsActionHelper.js';
-export const mapStateToProps = ({licenseModelList, licenseModel: {licenseModelCreation}}) => {
+export const mapStateToProps = ({users: {usersList}, licenseModelList, licenseModel: {licenseModelCreation}}) => {
let {genericFieldInfo} = licenseModelCreation;
let isFormValid = ValidationHelper.checkFormValid(genericFieldInfo);
let VLMNames = {};
for (let i = 0; i < licenseModelList.length; i++) {
- VLMNames[licenseModelList[i].vendorName.toLowerCase()] = licenseModelList[i].id;
+ VLMNames[licenseModelList[i].name.toLowerCase()] = licenseModelList[i].id;
}
- return {...licenseModelCreation, isFormValid: isFormValid, VLMNames};
+ return {...licenseModelCreation, isFormValid: isFormValid, VLMNames, usersList};
};
export const mapActionsToProps = (dispatch) => {
return {
onDataChanged: (deltaData, formName, customValidations) => ValidationHelper.dataChanged(dispatch, {deltaData, formName, customValidations}),
onCancel: () => LicenseModelCreationActionHelper.close(dispatch),
- onSubmit: (licenseModel) => {
+ onSubmit: (licenseModel, usersList) => {
LicenseModelCreationActionHelper.close(dispatch);
LicenseModelCreationActionHelper.createLicenseModel(dispatch, {licenseModel}).then(response => {
- LicenseModelActionHelper.fetchLicenseModels(dispatch).then(() => {
- OnboardingActionHelper.navigateToLicenseModelOverview(dispatch, {licenseModelId: response.value});
- });
+ let {itemId, version} = response;
+ LicenseModelActionHelper.fetchLicenseModels(dispatch).then(() =>
+ PermissionsActionHelper.fetchItemUsers(dispatch, {itemId, allUsers: usersList}).then(() =>
+ VersionsPageActionHelper.fetchVersions(dispatch, {itemType: versionItemTypes.LICENSE_MODEL, itemId}).then(() =>
+ ScreensHelper.loadScreen(dispatch, {screen: enums.SCREEN.LICENSE_MODEL_OVERVIEW, screenType: screenTypes.LICENSE_MODEL,
+ props: {licenseModelId: itemId, version}})
+ )));
});
},
onValidateForm: (formName) => ValidationHelper.validateForm(dispatch, formName)
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/creation/LicenseModelCreationActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/creation/LicenseModelCreationActionHelper.js
index 51f5b7f..87df138 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/creation/LicenseModelCreationActionHelper.js
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/creation/LicenseModelCreationActionHelper.js
@@ -61,7 +61,13 @@
},
createLicenseModel(dispatch, {licenseModel}){
- return createLicenseModel(licenseModel);
+ return createLicenseModel(licenseModel).then(result => {
+ dispatch({
+ type: actionTypes.LICENSE_MODEL_CREATED,
+ result
+ });
+ return result;
+ });
}
};
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/creation/LicenseModelCreationConstants.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/creation/LicenseModelCreationConstants.js
index 28f1175..e9b1c46 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/creation/LicenseModelCreationConstants.js
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/creation/LicenseModelCreationConstants.js
@@ -17,7 +17,8 @@
export const actionTypes = keyMirror({
OPEN: null,
- CLOSE: null
+ CLOSE: null,
+ LICENSE_MODEL_CREATED: null
});
export const LICENSE_MODEL_CREATION_FORM_NAME = 'LMCREATIONFORM';
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/creation/LicenseModelCreationView.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/creation/LicenseModelCreationView.jsx
index 8004046..948bdc1 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/creation/LicenseModelCreationView.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/creation/LicenseModelCreationView.jsx
@@ -14,27 +14,29 @@
* permissions and limitations under the License.
*/
import React from 'react';
+import PropTypes from 'prop-types';
import i18n from 'nfvo-utils/i18n/i18n.js';
import Validator from 'nfvo-utils/Validator.js';
import Input from 'nfvo-components/input/validation/Input.jsx';
import Form from 'nfvo-components/input/validation/Form.jsx';
import {LICENSE_MODEL_CREATION_FORM_NAME} from './LicenseModelCreationConstants.js';
-const LicenseModelPropType = React.PropTypes.shape({
- id: React.PropTypes.string,
- vendorName: React.PropTypes.string,
- description: React.PropTypes.string
+const LicenseModelPropType = PropTypes.shape({
+ id: PropTypes.string,
+ vendorName: PropTypes.string,
+ description: PropTypes.string
});
class LicenseModelCreationView extends React.Component {
static propTypes = {
data: LicenseModelPropType,
- VLMNames: React.PropTypes.object,
- onDataChanged: React.PropTypes.func.isRequired,
- onSubmit: React.PropTypes.func.isRequired,
- onValidateForm: React.PropTypes.func.isRequired,
- onCancel: React.PropTypes.func.isRequired
+ VLMNames: PropTypes.object,
+ usersList: PropTypes.array,
+ onDataChanged: PropTypes.func.isRequired,
+ onSubmit: PropTypes.func.isRequired,
+ onValidateForm: PropTypes.func.isRequired,
+ onCancel: PropTypes.func.isRequired
};
render() {
@@ -46,6 +48,7 @@
ref='validationForm'
hasButtons={true}
onSubmit={ () => this.submit() }
+ submitButtonText={i18n('Create')}
onReset={ () => this.props.onCancel() }
labledButtons={true}
isValid={this.props.isFormValid}
@@ -79,8 +82,8 @@
submit() {
- const {data:licenseModel} = this.props;
- this.props.onSubmit(licenseModel);
+ const {data:licenseModel, usersList} = this.props;
+ this.props.onSubmit(licenseModel, usersList);
}
validateName(value) {
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsActionHelper.js
index ce4327d..09a6e82 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsActionHelper.js
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsActionHelper.js
@@ -16,9 +16,9 @@
import RestAPIUtil from 'nfvo-utils/RestAPIUtil.js';
import Configuration from 'sdc-app/config/Configuration.js';
import {actionTypes as entitlementPoolsActionTypes } from './EntitlementPoolsConstants.js';
-import LicenseModelActionHelper from 'sdc-app/onboarding/licenseModel/LicenseModelActionHelper.js';
import {actionTypes as limitEditorActions} from 'sdc-app/onboarding/licenseModel/limits/LimitEditorConstants.js';
import {default as getValue, getStrValue} from 'nfvo-utils/getValue.js';
+import ItemsHelper from 'sdc-app/common/helpers/ItemsHelper.js';
function baseUrl(licenseModelId, version) {
const restPrefix = Configuration.get('restPrefix');
@@ -124,6 +124,7 @@
type: entitlementPoolsActionTypes.DELETE_ENTITLEMENT_POOL,
entitlementPoolId
});
+ ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id});
});
},
@@ -147,6 +148,7 @@
type: entitlementPoolsActionTypes.EDIT_ENTITLEMENT_POOL,
entitlementPool
});
+ ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id});
});
}
else {
@@ -159,6 +161,7 @@
id: response.value
}
});
+ ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id});
});
}
},
@@ -176,11 +179,6 @@
});
},
- switchVersion(dispatch, {licenseModelId, version}) {
- LicenseModelActionHelper.fetchLicenseModelById(dispatch, {licenseModelId, version}).then(() => {
- this.fetchEntitlementPoolsList(dispatch, {licenseModelId, version});
- });
- },
fetchLimits(dispatch, {licenseModelId, version, entitlementPool}) {
@@ -200,12 +198,14 @@
type: limitEditorActions.CLOSE
});
this.fetchLimits(dispatch, {licenseModelId, version, entitlementPool});
+ ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id});
});
},
deleteLimit(dispatch, {licenseModelId, version, entitlementPool, limit}) {
return deleteLimit(licenseModelId,entitlementPool.id, version, limit.id).then(() => {
this.fetchLimits(dispatch, {licenseModelId, version, entitlementPool});
+ ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id});
});
}
};
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsEditorView.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsEditorView.jsx
index 8473c1a..154174c 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsEditorView.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsEditorView.jsx
@@ -14,6 +14,7 @@
* permissions and limitations under the License.
*/
import React from 'react';
+import PropTypes from 'prop-types';
import i18n from 'nfvo-utils/i18n/i18n.js';
import Validator from 'nfvo-utils/Validator.js';
@@ -34,19 +35,19 @@
import EntitlementPoolsLimits from './EntitlementPoolsLimits.js';
import {limitType, NEW_LIMIT_TEMP_ID} from '../limits/LimitEditorConstants.js';
-const EntitlementPoolPropType = React.PropTypes.shape({
- id: React.PropTypes.string,
- name: React.PropTypes.string,
- description: React.PropTypes.string,
- operationalScope: React.PropTypes.shape({
- choices: React.PropTypes.array,
- other: React.PropTypes.string
+const EntitlementPoolPropType = PropTypes.shape({
+ id: PropTypes.string,
+ name: PropTypes.string,
+ description: PropTypes.string,
+ operationalScope: PropTypes.shape({
+ choices: PropTypes.array,
+ other: PropTypes.string
}),
- thresholdUnits: React.PropTypes.string,
- thresholdValue: React.PropTypes.number,
- increments: React.PropTypes.string,
- startDate: React.PropTypes.string,
- expiryDate: React.PropTypes.string
+ thresholdUnits: PropTypes.string,
+ thresholdValue: PropTypes.string,
+ increments: PropTypes.string,
+ startDate: PropTypes.string,
+ expiryDate: PropTypes.string
});
const EntitlementPoolsFormContent = ({data, genericFieldInfo, onDataChanged, validateName,
@@ -55,7 +56,7 @@
let {name, description, operationalScope, thresholdUnits, thresholdValue,
increments, startDate, expiryDate} = data;
return (
- <GridSection>
+ <GridSection hasLastColSet>
<GridItem colSpan={2}>
<Input
onChange={name => onDataChanged({name}, SP_ENTITLEMENT_POOL_FORM, {name: validateName})}
@@ -67,7 +68,7 @@
data-test-id='create-ep-name'
type='text'/>
</GridItem>
- <GridItem colSpan={2}>
+ <GridItem colSpan={2} lastColInRow>
<InputOptions
onInputChange={()=>{}}
isMultiSelect={true}
@@ -94,7 +95,7 @@
data-test-id='create-ep-description'
type='textarea'/>
</GridItem>
- <GridItem colSpan={2}>
+ <GridItem colSpan={2} lastColInRow>
<div className='threshold-section'>
<Input
onChange={e => {
@@ -152,7 +153,7 @@
)}
isValid={genericFieldInfo.startDate.isValid}
errorText={genericFieldInfo.startDate.errorText}
- selectsStart/>
+ selectsStart/>
<Input
type='date'
label={i18n('Expiry Date')}
@@ -167,8 +168,8 @@
isValid={genericFieldInfo.expiryDate.isValid}
errorText={genericFieldInfo.expiryDate.errorText}
selectsEnd/>
- </div>
- </GridItem>
+ </div>
+ </GridItem>
</GridSection>
);
};
@@ -178,18 +179,18 @@
static propTypes = {
data: EntitlementPoolPropType,
previousData: EntitlementPoolPropType,
- EPNames: React.PropTypes.object,
- isReadOnlyMode: React.PropTypes.bool,
- onDataChanged: React.PropTypes.func.isRequired,
- onSubmit: React.PropTypes.func.isRequired,
- onCancel: React.PropTypes.func.isRequired
+ EPNames: PropTypes.object,
+ isReadOnlyMode: PropTypes.bool,
+ onDataChanged: PropTypes.func.isRequired,
+ onSubmit: PropTypes.func.isRequired,
+ onCancel: PropTypes.func.isRequired
};
static defaultProps = {
data: {}
};
- componentDidUpdate(prevProps) {
+ componentDidUpdate(prevProps) {
if (this.props.formReady && this.props.formReady !== prevProps.formReady) { // if form validation succeeded -> continue with submit
this.submit();
}
@@ -207,9 +208,9 @@
return (
<div>
- <Tabs
- type='menu'
- activeTab={selectedTab}
+ <Tabs
+ type='menu'
+ activeTab={selectedTab}
onTabClick={(tabIndex)=>{
if (tabIndex === tabIds.ADD_LIMIT_BUTTON) {
this.onAddLimit();
@@ -218,14 +219,13 @@
this.setState({selectedLimit: ''});
onCloseLimitEditor();
}
-
- }}
+ }}
invalidTabs={[]}>
<Tab tabId={tabIds.GENERAL} data-test-id='general-tab' title={i18n('General')}>
{
genericFieldInfo && <Form
ref='validationForm'
- hasButtons={false}
+ hasButtons={false}
labledButtons={false}
isReadOnlyMode={isReadOnlyMode}
isValid={this.props.isFormValid}
@@ -243,20 +243,20 @@
}
</Tab>
<Tab disabled={isTabsDisabled} tabId={tabIds.SP_LIMITS} data-test-id='sp-limits-tab' title={i18n('SP Limits')}>
- {selectedTab === tabIds.SP_LIMITS &&
- <EntitlementPoolsLimits
+ {selectedTab === tabIds.SP_LIMITS &&
+ <EntitlementPoolsLimits
isReadOnlyMode={isReadOnlyMode}
- limitType={limitType.SERVICE_PROVIDER}
+ limitType={limitType.SERVICE_PROVIDER}
limitsList={limitsList.filter(item => item.type === limitType.SERVICE_PROVIDER)}
selectedLimit={this.state.selectedLimit}
onCloseLimitEditor={() => this.onCloseLimitEditor()}
onSelectLimit={limit => this.onSelectLimit(limit)}/>}
</Tab>
<Tab disabled={isTabsDisabled} tabId={tabIds.VENDOR_LIMITS} data-test-id='vendor-limits-tab' title={i18n('Vendor Limits')}>
- {selectedTab === tabIds.VENDOR_LIMITS &&
- <EntitlementPoolsLimits
+ {selectedTab === tabIds.VENDOR_LIMITS &&
+ <EntitlementPoolsLimits
isReadOnlyMode={isReadOnlyMode}
- limitType={limitType.VENDOR}
+ limitType={limitType.VENDOR}
limitsList={limitsList.filter(item => item.type === limitType.VENDOR)}
selectedLimit={this.state.selectedLimit}
onCloseLimitEditor={() => this.onCloseLimitEditor()}
@@ -273,7 +273,7 @@
{i18n('Add Limit')}
</Button>
:
- <div></div> // Render empty div to not break tabs
+ <div></div> // Render empty div to not break tabs
}
</Tabs>
<GridSection className='license-model-modal-buttons entitlement-pools-editor-buttons'>
@@ -285,21 +285,18 @@
<Button btnType={this.state.selectedLimit ? 'default' : 'outline'} onClick={() => this.props.onCancel()} type='reset'>
{i18n('Cancel')}
</Button>
- </GridSection>
+ </GridSection>
</div>
);
}
submit() {
const {data: entitlementPool, previousData: previousEntitlementPool, formReady} = this.props;
-
if (!formReady) {
this.props.onValidateForm(SP_ENTITLEMENT_POOL_FORM);
} else {
this.props.onSubmit({entitlementPool, previousEntitlementPool});
}
-
-
}
validateName(value) {
@@ -329,8 +326,6 @@
this.props.onOpenLimitEditor();
}
-
-
}
export default EntitlementPoolsEditorView;
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsLimits.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsLimits.js
index 1eb6eeb..8300594 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsLimits.js
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsLimits.js
@@ -20,10 +20,10 @@
import {actionTypes as globalModalActionTypes} from 'nfvo-components/modal/GlobalModalConstants.js';
import EntitlementPoolsActionHelper from './EntitlementPoolsActionHelper.js';
-const mapStateToProps = ({licenseModel: {entitlementPool: {entitlementPoolEditor: {data}}, limitEditor}, currentScreen}) => {
+const mapStateToProps = ({licenseModel: {entitlementPool: {entitlementPoolEditor: {data}}, limitEditor}, currentScreen}) => {
let {props: {licenseModelId, version}} = currentScreen;
return {
- parent: data,
+ parent: data,
limitEditor,
licenseModelId,
version
@@ -42,10 +42,10 @@
onDelete: ({limit, parent, licenseModelId, version, onCloseLimitEditor, selectedLimit}) => dispatch({
type: globalModalActionTypes.GLOBAL_MODAL_WARNING,
data:{
- msg: i18n(`Are you sure you want to delete ${limit.name}?`),
+ msg: i18n('Are you sure you want to delete {name}?', {name: limit.name}),
confirmationButtonText: i18n('Delete'),
title: i18n('Delete'),
- onConfirmed: ()=> EntitlementPoolsActionHelper.deleteLimit(dispatch, {limit, entitlementPool: parent, licenseModelId, version}).then(() =>
+ onConfirmed: ()=> EntitlementPoolsActionHelper.deleteLimit(dispatch, {limit, entitlementPool: parent, licenseModelId, version}).then(() =>
selectedLimit === limit.id && onCloseLimitEditor()
)
}
@@ -53,4 +53,4 @@
};
};
-export default connect(mapStateToProps, mapActionsToProps)(Limits);
\ No newline at end of file
+export default connect(mapStateToProps, mapActionsToProps)(Limits);
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsListEditor.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsListEditor.js
index fa21109..f1dc1f8 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsListEditor.js
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsListEditor.js
@@ -14,26 +14,24 @@
* permissions and limitations under the License.
*/
import {connect} from 'react-redux';
-import i18n from 'nfvo-utils/i18n/i18n.js';
+import i18n from 'nfvo-utils/i18n/i18n.js';
import EntitlementPoolsActionHelper from './EntitlementPoolsActionHelper.js';
import EntitlementPoolsListEditorView, {generateConfirmationMsg} from './EntitlementPoolsListEditorView.jsx';
-import VersionControllerUtils from 'nfvo-components/panel/versionController/VersionControllerUtils.js';
import {actionTypes as globalMoadlActions} from 'nfvo-components/modal/GlobalModalConstants.js';
const mapStateToProps = ({licenseModel: {entitlementPool, licenseModelEditor}}) => {
- let {entitlementPoolsList} = entitlementPool;
- let {data} = entitlementPool.entitlementPoolEditor;
- let {vendorName} = licenseModelEditor.data;
- let isReadOnlyMode = VersionControllerUtils.isReadOnly(licenseModelEditor.data);
+ const {entitlementPoolsList} = entitlementPool;
+ const {data} = entitlementPool.entitlementPoolEditor;
+ const {vendorName} = licenseModelEditor.data;
return {
vendorName,
entitlementPoolsList,
- isReadOnlyMode,
isDisplayModal: Boolean(data),
isModalInEditMode: Boolean(data && data.id),
};
+
};
const mapActionsToProps = (dispatch, {licenseModelId, version}) => {
@@ -46,7 +44,7 @@
msg: generateConfirmationMsg(entitlementPool),
confirmationButtonText: i18n('Delete'),
title: i18n('Delete'),
- onConfirmed: ()=>EntitlementPoolsActionHelper.deleteEntitlementPool(dispatch, {
+ onConfirmed: () => EntitlementPoolsActionHelper.deleteEntitlementPool(dispatch, {
licenseModelId,
entitlementPoolId: entitlementPool.id,
version
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsListEditorView.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsListEditorView.jsx
index c730d66..cc0cda1 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsListEditorView.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsListEditorView.jsx
@@ -14,6 +14,7 @@
* permissions and limitations under the License.
*/
import React from 'react';
+import PropTypes from 'prop-types';
import i18n from 'nfvo-utils/i18n/i18n.js';
import Modal from 'nfvo-components/modal/Modal.jsx';
@@ -25,15 +26,15 @@
class EntitlementPoolsListEditorView extends React.Component {
static propTypes = {
- vendorName: React.PropTypes.string,
- licenseModelId: React.PropTypes.string.isRequired,
- entitlementPoolsList: React.PropTypes.array,
- isReadOnlyMode: React.PropTypes.bool.isRequired,
- isDisplayModal: React.PropTypes.bool,
- isModalInEditMode: React.PropTypes.bool,
- onAddEntitlementPoolClick: React.PropTypes.func,
- onEditEntitlementPoolClick: React.PropTypes.func,
- onDeleteEntitlementPool: React.PropTypes.func,
+ vendorName: PropTypes.string,
+ licenseModelId: PropTypes.string.isRequired,
+ entitlementPoolsList: PropTypes.array,
+ isReadOnlyMode: PropTypes.bool.isRequired,
+ isDisplayModal: PropTypes.bool,
+ isModalInEditMode: PropTypes.bool,
+ onAddEntitlementPoolClick: PropTypes.func,
+ onEditEntitlementPoolClick: PropTypes.func,
+ onDeleteEntitlementPool: PropTypes.func,
};
static defaultProps = {
@@ -50,7 +51,7 @@
const {localFilter} = this.state;
return (
- <div className='entitlement-pools-list-editor'>
+ <div className='license-model-list-editor entitlement-pools-list-editor'>
<ListEditorView
title={i18n('Entitlement Pools')}
plusButtonTitle={i18n('Add Entitlement Pool')}
@@ -125,7 +126,7 @@
export function generateConfirmationMsg(entitlementPoolToDelete) {
let poolName = entitlementPoolToDelete ? entitlementPoolToDelete.name : '';
- let msg = i18n(`Are you sure you want to delete "${poolName}"?`);
+ let msg = i18n('Are you sure you want to delete "{poolName}"?', {poolName: poolName});
let subMsg = entitlementPoolToDelete
&& entitlementPoolToDelete.referencingFeatureGroups
&& entitlementPoolToDelete.referencingFeatureGroups.length > 0 ?
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupEditorView.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupEditorView.jsx
index 6a5ee46..6d0acaa 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupEditorView.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupEditorView.jsx
@@ -14,6 +14,7 @@
* permissions and limitations under the License.
*/
import React from 'react';
+import PropTypes from 'prop-types';
import Tabs from 'nfvo-components/input/validation/Tabs.jsx';
import Tab from 'sdc-ui/lib/react/Tab.js';
import GridSection from 'nfvo-components/grid/GridSection.jsx';
@@ -26,20 +27,20 @@
import {state as FeatureGroupStateConstants, FG_EDITOR_FORM} from './FeatureGroupsConstants.js';
-const FeatureGroupsPropType = React.PropTypes.shape({
- id: React.PropTypes.string,
- name: React.PropTypes.string,
- description: React.PropTypes.string,
- partNumber: React.PropTypes.string,
- manufacturerReferenceNumber: React.PropTypes.string,
- entitlementPoolsIds: React.PropTypes.arrayOf(React.PropTypes.string),
- licenseKeyGroupsIds: React.PropTypes.arrayOf(React.PropTypes.string)
+const FeatureGroupsPropType = PropTypes.shape({
+ id: PropTypes.string,
+ name: PropTypes.string,
+ description: PropTypes.string,
+ partNumber: PropTypes.string,
+ manufacturerReferenceNumber: PropTypes.string,
+ entitlementPoolsIds: PropTypes.arrayOf(PropTypes.string),
+ licenseKeyGroupsIds: PropTypes.arrayOf(PropTypes.string)
});
const GeneralTab = ({data = {}, onDataChanged, genericFieldInfo, validateName}) => {
let {name, description, partNumber, manufacturerReferenceNumber} = data;
return (
- <GridSection>
+ <GridSection hasLastColSet>
<GridItem colSpan={2}>
<Input
groupClassName='field-section'
@@ -53,7 +54,7 @@
isValid={genericFieldInfo.name.isValid}
errorText={genericFieldInfo.name.errorText} />
</GridItem>
- <GridItem colSpan={2}>
+ <GridItem colSpan={2} lastColInRow>
<Input
groupClassName='field-section'
className='description-field'
@@ -78,7 +79,7 @@
isValid={genericFieldInfo.partNumber.isValid}
errorText={genericFieldInfo.partNumber.errorText} />
</GridItem>
- <GridItem colSpan={2}>
+ <GridItem colSpan={2} lastColInRow>
<Input
groupClassName='field-section'
onChange={manufacturerReferenceNumber => onDataChanged({manufacturerReferenceNumber}, FG_EDITOR_FORM)}
@@ -142,14 +143,14 @@
static propTypes = {
data: FeatureGroupsPropType,
previousData: FeatureGroupsPropType,
- isReadOnlyMode: React.PropTypes.bool,
- FGNames: React.PropTypes.object,
+ isReadOnlyMode: PropTypes.bool,
+ FGNames: PropTypes.object,
- onSubmit: React.PropTypes.func,
- onCancel: React.PropTypes.func,
+ onSubmit: PropTypes.func,
+ onCancel: PropTypes.func,
- selectedTab: React.PropTypes.number,
- onTabSelect: React.PropTypes.func,
+ selectedTab: PropTypes.number,
+ onTabSelect: PropTypes.func,
entitlementPoolsList: DualListboxView.propTypes.availableList,
licenseKeyGroupsList: DualListboxView.propTypes.availableList
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupListEditor.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupListEditor.js
index fc89238..2692548 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupListEditor.js
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupListEditor.js
@@ -14,17 +14,16 @@
* permissions and limitations under the License.
*/
import {connect} from 'react-redux';
-
import FeatureGroupsActionHelper from './FeatureGroupsActionHelper.js';
import FeatureGroupListEditorView, {generateConfirmationMsg} from './FeatureGroupListEditorView.jsx';
-import VersionControllerUtils from 'nfvo-components/panel/versionController/VersionControllerUtils.js';
import i18n from 'nfvo-utils/i18n/i18n.js';
import {actionTypes as globalMoadlActions} from 'nfvo-components/modal/GlobalModalConstants.js';
export const mapStateToProps = ({licenseModel: {featureGroup, licenseModelEditor}}) => {
+
const {featureGroupEditor: {data}, featureGroupsList} = featureGroup;
- let {vendorName, version} = licenseModelEditor.data;
- let isReadOnlyMode = VersionControllerUtils.isReadOnly(licenseModelEditor.data);
+ const {vendorName, version} = licenseModelEditor.data;
+
return {
vendorName,
version,
@@ -32,9 +31,9 @@
show: Boolean(data),
editMode: Boolean(data && data.id)
},
- featureGroupsList,
- isReadOnlyMode
+ featureGroupsList
};
+
};
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupListEditorView.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupListEditorView.jsx
index 497c29d..f59e000 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupListEditorView.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupListEditorView.jsx
@@ -14,6 +14,7 @@
* permissions and limitations under the License.
*/
import React from 'react';
+import PropTypes from 'prop-types';
import i18n from 'nfvo-utils/i18n/i18n.js';
import Modal from 'nfvo-components/modal/Modal.jsx';
@@ -24,18 +25,18 @@
class FeatureGroupListEditorView extends React.Component {
static propTypes = {
- vendorName: React.PropTypes.string,
- licenseModelId: React.PropTypes.string.isRequired,
- featureGroupsModal: React.PropTypes.shape({
- show: React.PropTypes.bool,
- editMode: React.PropTypes.bool
+ vendorName: PropTypes.string,
+ licenseModelId: PropTypes.string.isRequired,
+ featureGroupsModal: PropTypes.shape({
+ show: PropTypes.bool,
+ editMode: PropTypes.bool
}),
- isReadOnlyMode: React.PropTypes.bool.isRequired,
- onAddFeatureGroupClick: React.PropTypes.func,
- onEditFeatureGroupClick: React.PropTypes.func,
- onDeleteFeatureGroupClick: React.PropTypes.func,
- onCancelFeatureGroupsEditor: React.PropTypes.func,
- featureGroupsList: React.PropTypes.array
+ isReadOnlyMode: PropTypes.bool.isRequired,
+ onAddFeatureGroupClick: PropTypes.func,
+ onEditFeatureGroupClick: PropTypes.func,
+ onDeleteFeatureGroupClick: PropTypes.func,
+ onCancelFeatureGroupsEditor: PropTypes.func,
+ featureGroupsList: PropTypes.array
};
static defaultProps = {
@@ -54,7 +55,7 @@
let {licenseModelId, featureGroupsModal, isReadOnlyMode, onAddFeatureGroupClick, version} = this.props;
const {localFilter} = this.state;
return (
- <div className='feature-groups-list-editor'>
+ <div className='license-model-list-editor feature-groups-list-editor'>
<ListEditorView
title={i18n('Feature Groups')}
plusButtonTitle={i18n('Add Feature Group')}
@@ -155,7 +156,7 @@
export function generateConfirmationMsg(featureGroupToDelete) {
let name = featureGroupToDelete ? featureGroupToDelete.name : '';
- let msg = i18n(`Are you sure you want to delete "${name}"?`);
+ let msg = i18n('Are you sure you want to delete "{name}"?', {name: name});
let subMsg = featureGroupToDelete.referencingLicenseAgreements
&& featureGroupToDelete.referencingLicenseAgreements.length > 0 ?
i18n('This feature group is associated with one ore more license agreements') :
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsActionHelper.js
index b8c0375..aadf8e0 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsActionHelper.js
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsActionHelper.js
@@ -16,9 +16,9 @@
import RestAPIUtil from 'nfvo-utils/RestAPIUtil.js';
import Configuration from 'sdc-app/config/Configuration.js';
import {actionTypes as featureGroupsActionConstants} from './FeatureGroupsConstants.js';
-import LicenseModelActionHelper from 'sdc-app/onboarding/licenseModel/LicenseModelActionHelper.js';
import EntitlementPoolsActionHelper from 'sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsActionHelper.js';
import LicenseKeyGroupsActionHelper from 'sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsActionHelper.js';
+import ItemsHelper from 'sdc-app/common/helpers/ItemsHelper.js';
function baseUrl(licenseModelId, version) {
const restPrefix = Configuration.get('restPrefix');
@@ -26,6 +26,10 @@
return `${restPrefix}/v1.0/vendor-license-models/${licenseModelId}/versions/${versionId}/feature-groups`;
}
+function fetchFeatureGroup(licenseModelId, featureGroupId, version) {
+ return RestAPIUtil.fetch(`${baseUrl(licenseModelId, version)}/${featureGroupId}`);
+}
+
function fetchFeatureGroupsList(licenseModelId, version) {
return RestAPIUtil.fetch(`${baseUrl(licenseModelId, version)}`);
}
@@ -65,6 +69,10 @@
}
export default {
+ fetchFeatureGroup(dispatch, {licenseModelId, featureGroupId, version}) {
+ return fetchFeatureGroup(licenseModelId, featureGroupId, version);
+ },
+
fetchFeatureGroupsList(dispatch, {licenseModelId, version}) {
return fetchFeatureGroupsList(licenseModelId, version).then(response => dispatch({
type: featureGroupsActionConstants.FEATURE_GROUPS_LIST_LOADED,
@@ -73,10 +81,13 @@
},
deleteFeatureGroup(dispatch, {licenseModelId, featureGroupId, version}) {
- return deleteFeatureGroup(licenseModelId, featureGroupId, version).then(() => dispatch({
- type: featureGroupsActionConstants.DELETE_FEATURE_GROUPS,
- featureGroupId
- }));
+ return deleteFeatureGroup(licenseModelId, featureGroupId, version).then(() => {
+ dispatch({
+ type: featureGroupsActionConstants.DELETE_FEATURE_GROUPS,
+ featureGroupId
+ });
+ ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id});
+ });
},
saveFeatureGroup(dispatch, {licenseModelId, previousFeatureGroup, featureGroup, version}) {
@@ -88,6 +99,7 @@
});
EntitlementPoolsActionHelper.fetchEntitlementPoolsList(dispatch, {licenseModelId, version});
LicenseKeyGroupsActionHelper.fetchLicenseKeyGroupsList(dispatch, {licenseModelId, version});
+ ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id});
});
}
else {
@@ -102,6 +114,7 @@
});
EntitlementPoolsActionHelper.fetchEntitlementPoolsList(dispatch, {licenseModelId, version});
LicenseKeyGroupsActionHelper.fetchLicenseKeyGroupsList(dispatch, {licenseModelId, version});
+ ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id});
});
}
},
@@ -114,11 +127,14 @@
},
openFeatureGroupsEditor(dispatch, {featureGroup, licenseModelId, version}) {
- EntitlementPoolsActionHelper.fetchEntitlementPoolsList(dispatch, {licenseModelId, version});
- LicenseKeyGroupsActionHelper.fetchLicenseKeyGroupsList(dispatch, {licenseModelId, version});
- dispatch({
- type: featureGroupsActionConstants.featureGroupsEditor.OPEN,
- featureGroup
+ return Promise.all([
+ EntitlementPoolsActionHelper.fetchEntitlementPoolsList(dispatch, {licenseModelId, version}),
+ LicenseKeyGroupsActionHelper.fetchLicenseKeyGroupsList(dispatch, {licenseModelId, version})
+ ]).then(() => {
+ dispatch({
+ type: featureGroupsActionConstants.featureGroupsEditor.OPEN,
+ featureGroup
+ });
});
},
@@ -126,12 +142,5 @@
dispatch({
type: featureGroupsActionConstants.featureGroupsEditor.CLOSE
});
- },
-
-
- switchVersion(dispatch, {licenseModelId, version}) {
- LicenseModelActionHelper.fetchLicenseModelById(dispatch, {licenseModelId, version}).then(() => {
- this.fetchFeatureGroupsList(dispatch, {licenseModelId, version});
- });
}
};
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementActionHelper.js
index e9d922c..b4f03a6 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementActionHelper.js
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementActionHelper.js
@@ -17,7 +17,7 @@
import Configuration from 'sdc-app/config/Configuration.js';
import {actionTypes as licenseAgreementActionTypes} from './LicenseAgreementConstants.js';
import FeatureGroupsActionHelper from 'sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsActionHelper.js';
-import LicenseModelActionHelper from 'sdc-app/onboarding/licenseModel/LicenseModelActionHelper.js';
+import ItemsHelper from 'sdc-app/common/helpers/ItemsHelper.js';
function baseUrl(licenseModelId, version) {
const restPrefix = Configuration.get('restPrefix');
@@ -29,6 +29,10 @@
return RestAPIUtil.fetch(`${baseUrl(licenseModelId, version)}`);
}
+function fetchLicenseAgreement(licenseModelId, licenseAgreementId, version) {
+ return RestAPIUtil.fetch(`${baseUrl(licenseModelId, version)}/${licenseAgreementId}`);
+}
+
function postLicenseAgreement(licenseModelId, licenseAgreement, version) {
return RestAPIUtil.post(baseUrl(licenseModelId, version), {
name: licenseAgreement.name,
@@ -65,6 +69,10 @@
}));
},
+ fetchLicenseAgreement(dispatch, {licenseModelId, licenseAgreementId, version}) {
+ return fetchLicenseAgreement(licenseModelId, licenseAgreementId, version);
+ },
+
openLicenseAgreementEditor(dispatch, {licenseModelId, licenseAgreement, version}) {
FeatureGroupsActionHelper.fetchFeatureGroupsList(dispatch, {licenseModelId, version});
dispatch({
@@ -84,12 +92,14 @@
if (previousLicenseAgreement) {
return putLicenseAgreement(licenseModelId, previousLicenseAgreement, licenseAgreement, version).then(() => {
this.fetchLicenseAgreementList(dispatch, {licenseModelId, version});
+ ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id});
});
}
else {
return postLicenseAgreement(licenseModelId, licenseAgreement, version).then(() => {
this.fetchLicenseAgreementList(dispatch, {licenseModelId, version});
FeatureGroupsActionHelper.fetchFeatureGroupsList(dispatch, {licenseModelId, version});
+ ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id});
});
}
},
@@ -100,6 +110,7 @@
type: licenseAgreementActionTypes.DELETE_LICENSE_AGREEMENT,
licenseAgreementId
});
+ ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id});
});
},
@@ -108,11 +119,5 @@
type: licenseAgreementActionTypes.licenseAgreementEditor.SELECT_TAB,
tab
});
- },
-
- switchVersion(dispatch, {licenseModelId, version}) {
- LicenseModelActionHelper.fetchLicenseModelById(dispatch, {licenseModelId, version}).then(() => {
- this.fetchLicenseAgreementList(dispatch, {licenseModelId, version});
- });
}
};
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementEditorView.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementEditorView.jsx
index 0b41868..a3e73f4 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementEditorView.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementEditorView.jsx
@@ -14,7 +14,7 @@
* permissions and limitations under the License.
*/
import React from 'react';
-
+import PropTypes from 'prop-types';
import GridSection from 'nfvo-components/grid/GridSection.jsx';
import GridItem from 'nfvo-components/grid/GridItem.jsx';
import {TabsForm as Form} from 'nfvo-components/input/validation/Form.jsx';
@@ -34,21 +34,21 @@
right: i18n('Selected Feature Groups')
};
-const LicenseAgreementPropType = React.PropTypes.shape({
- id: React.PropTypes.string,
- name: React.PropTypes.string,
- description: React.PropTypes.string,
- requirementsAndConstrains: React.PropTypes.string,
- licenseTerm: React.PropTypes.object,
- featureGroupsIds: React.PropTypes.arrayOf(React.PropTypes.string),
- version: React.PropTypes.object
+const LicenseAgreementPropType = PropTypes.shape({
+ id: PropTypes.string,
+ name: PropTypes.string,
+ description: PropTypes.string,
+ requirementsAndConstrains: PropTypes.string,
+ licenseTerm: PropTypes.object,
+ featureGroupsIds: PropTypes.arrayOf(PropTypes.string),
+ version: PropTypes.object
});
const GeneralTabContent = ({data, genericFieldInfo, onDataChanged, validateName}) => {
let {name, description, requirementsAndConstrains, licenseTerm} = data;
return (
- <GridSection>
+ <GridSection hasLastColSet>
<GridItem colSpan={2}>
<Input
isValid={genericFieldInfo.name.isValid}
@@ -86,7 +86,7 @@
isValid={genericFieldInfo.licenseTerm.isValid}
errorText={genericFieldInfo.licenseTerm.errorText} />
</GridItem>
- <GridItem colSpan={2} stretch>
+ <GridItem colSpan={2} stretch lastColInRow>
<Input
isValid={genericFieldInfo.description.isValid}
errorText={genericFieldInfo.description.errorText}
@@ -107,17 +107,17 @@
static propTypes = {
data: LicenseAgreementPropType,
previousData: LicenseAgreementPropType,
- LANames: React.PropTypes.object,
- isReadOnlyMode: React.PropTypes.bool,
- onDataChanged: React.PropTypes.func.isRequired,
- onSubmit: React.PropTypes.func.isRequired,
- onCancel: React.PropTypes.func.isRequired,
+ LANames: PropTypes.object,
+ isReadOnlyMode: PropTypes.bool,
+ onDataChanged: PropTypes.func.isRequired,
+ onSubmit: PropTypes.func.isRequired,
+ onCancel: PropTypes.func.isRequired,
- selectedTab: React.PropTypes.number,
- onTabSelect: React.PropTypes.func,
+ selectedTab: PropTypes.number,
+ onTabSelect: PropTypes.func,
- selectedFeatureGroupsButtonTab: React.PropTypes.number,
- onFeatureGroupsButtonTabSelect: React.PropTypes.func,
+ selectedFeatureGroupsButtonTab: PropTypes.number,
+ onFeatureGroupsButtonTabSelect: PropTypes.func,
featureGroupsList: DualListboxView.propTypes.availableList
};
@@ -151,7 +151,7 @@
data-test-id='general-tab'
title={i18n('General')}>
<fieldset disabled={isReadOnlyMode}>
- <GeneralTabContent data={data} genericFieldInfo={genericFieldInfo} onDataChanged={onDataChanged}
+ <GeneralTabContent data={data} genericFieldInfo={genericFieldInfo} onDataChanged={onDataChanged} validateLTChoice={(value)=>this.validateLTChoice(value)}
validateName={(value)=>this.validateName(value)}/>
</fieldset>
</Tab>
@@ -181,6 +181,12 @@
this.props.onSubmit({licenseAgreement, previousLicenseAgreement});
}
+ validateLTChoice(value) {
+ if (!value.choice) {
+ return {isValid: false, errorText: i18n('Field is required')};
+ }
+ return {isValid: true, errorText: ''};
+ }
validateName(value) {
const {data: {id}, LANames} = this.props;
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementListEditor.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementListEditor.js
index 92c2550..72474ec 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementListEditor.js
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementListEditor.js
@@ -17,24 +17,22 @@
import i18n from 'nfvo-utils/i18n/i18n.js';
import LicenseAgreementActionHelper from './LicenseAgreementActionHelper.js';
import LicenseAgreementListEditorView from './LicenseAgreementListEditorView.jsx';
-import VersionControllerUtils from 'nfvo-components/panel/versionController/VersionControllerUtils.js';
import {actionTypes as globalMoadlActions} from 'nfvo-components/modal/GlobalModalConstants.js';
const mapStateToProps = ({licenseModel: {licenseAgreement, licenseModelEditor}}) => {
+
let {licenseAgreementList} = licenseAgreement;
let {data} = licenseAgreement.licenseAgreementEditor;
let {vendorName, version} = licenseModelEditor.data;
- let isReadOnlyMode = VersionControllerUtils.isReadOnly(licenseModelEditor.data);
-
return {
vendorName,
version,
licenseAgreementList,
- isReadOnlyMode,
isDisplayModal: Boolean(data),
isModalInEditMode: Boolean(data && data.id)
};
+
};
const mapActionsToProps = (dispatch, {licenseModelId}) => {
@@ -44,7 +42,7 @@
onDeleteLicenseAgreement: (licenseAgreement, version) => dispatch({
type: globalMoadlActions.GLOBAL_MODAL_WARNING,
data:{
- msg: i18n(`Are you sure you want to delete "${licenseAgreement.name}"?`),
+ msg: i18n('Are you sure you want to delete "{name}"?', {name: licenseAgreement.name}),
confirmationButtonText: i18n('Delete'),
title: i18n('Delete'),
onConfirmed: ()=>LicenseAgreementActionHelper.deleteLicenseAgreement(dispatch, {licenseModelId, licenseAgreementId: licenseAgreement.id, version})
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementListEditorView.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementListEditorView.jsx
index 6247723..ad3cdb0 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementListEditorView.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementListEditorView.jsx
@@ -14,6 +14,7 @@
* permissions and limitations under the License.
*/
import React from 'react';
+import PropTypes from 'prop-types';
import i18n from 'nfvo-utils/i18n/i18n.js';
import Modal from 'nfvo-components/modal/Modal.jsx';
@@ -24,15 +25,15 @@
class LicenseAgreementListEditorView extends React.Component {
static propTypes = {
- vendorName: React.PropTypes.string,
- licenseModelId: React.PropTypes.string.isRequired,
- licenseAgreementList: React.PropTypes.array,
- isReadOnlyMode: React.PropTypes.bool.isRequired,
- isDisplayModal: React.PropTypes.bool,
- isModalInEditMode: React.PropTypes.bool,
- onAddLicenseAgreementClick: React.PropTypes.func,
- onEditLicenseAgreementClick: React.PropTypes.func,
- onDeleteLicenseAgreement: React.PropTypes.func,
+ vendorName: PropTypes.string,
+ licenseModelId: PropTypes.string.isRequired,
+ licenseAgreementList: PropTypes.array,
+ isReadOnlyMode: PropTypes.bool.isRequired,
+ isDisplayModal: PropTypes.bool,
+ isModalInEditMode: PropTypes.bool,
+ onAddLicenseAgreementClick: PropTypes.func,
+ onEditLicenseAgreementClick: PropTypes.func,
+ onDeleteLicenseAgreement: PropTypes.func,
};
static defaultProps = {
@@ -49,7 +50,7 @@
const {localFilter} = this.state;
return (
- <div className='license-agreement-list-editor'>
+ <div className='license-model-list-editor license-agreement-list-editor'>
<ListEditorView
title={i18n('License Agreements')}
plusButtonTitle={i18n('Add License Agreement')}
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsActionHelper.js
index f22080a..4d86815 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsActionHelper.js
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsActionHelper.js
@@ -16,9 +16,9 @@
import RestAPIUtil from 'nfvo-utils/RestAPIUtil.js';
import Configuration from 'sdc-app/config/Configuration.js';
import {actionTypes as licenseKeyGroupsConstants} from './LicenseKeyGroupsConstants.js';
-import LicenseModelActionHelper from 'sdc-app/onboarding/licenseModel/LicenseModelActionHelper.js';
import {actionTypes as limitEditorActions} from 'sdc-app/onboarding/licenseModel/limits/LimitEditorConstants.js';
import {default as getValue, getStrValue} from 'nfvo-utils/getValue.js';
+import ItemsHelper from 'sdc-app/common/helpers/ItemsHelper.js';
function baseUrl(licenseModelId, version) {
const restPrefix = Configuration.get('restPrefix');
@@ -128,6 +128,7 @@
type: licenseKeyGroupsConstants.EDIT_LICENSE_KEY_GROUP,
licenseKeyGroup
});
+ ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id});
});
}
else {
@@ -140,6 +141,7 @@
id: response.value
}
});
+ ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id});
});
}
@@ -152,6 +154,7 @@
type: licenseKeyGroupsConstants.DELETE_LICENSE_KEY_GROUP,
licenseKeyGroupId
});
+ ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id});
});
},
@@ -169,12 +172,6 @@
});
},
- switchVersion(dispatch, {licenseModelId, version}) {
- LicenseModelActionHelper.fetchLicenseModelById(dispatch, {licenseModelId, version}).then(() => {
- this.fetchLicenseKeyGroupsList(dispatch, {licenseModelId, version});
- });
- },
-
fetchLimits(dispatch, {licenseModelId, version, licenseKeyGroup}) {
return fetchLimitsList(licenseModelId, licenseKeyGroup.id, version).then(response => {
@@ -193,12 +190,14 @@
type: limitEditorActions.CLOSE
});
this.fetchLimits(dispatch, {licenseModelId, version, licenseKeyGroup});
+ ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id});
});
},
deleteLimit(dispatch, {licenseModelId, version, licenseKeyGroup, limit}) {
return deleteLimit(licenseModelId,licenseKeyGroup.id, version, limit.id).then(() => {
this.fetchLimits(dispatch, {licenseModelId, version, licenseKeyGroup});
+ ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id});
});
}
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsEditorView.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsEditorView.jsx
index 70fb43e..87c947e 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsEditorView.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsEditorView.jsx
@@ -14,6 +14,7 @@
* permissions and limitations under the License.
*/
import React from 'react';
+import PropTypes from 'prop-types';
import i18n from 'nfvo-utils/i18n/i18n.js';
import Validator from 'nfvo-utils/Validator.js';
@@ -36,26 +37,26 @@
import LicenseKeyGroupsLimits from './LicenseKeyGroupsLimits.js';
import {limitType, NEW_LIMIT_TEMP_ID} from '../limits/LimitEditorConstants.js';
- const LicenseKeyGroupPropType = React.PropTypes.shape({
- id: React.PropTypes.string,
- name: React.PropTypes.string,
- description: React.PropTypes.string,
- increments: React.PropTypes.string,
- operationalScope: React.PropTypes.shape({
- choices: React.PropTypes.array,
- other: React.PropTypes.string
+ const LicenseKeyGroupPropType = PropTypes.shape({
+ id: PropTypes.string,
+ name: PropTypes.string,
+ description: PropTypes.string,
+ increments: PropTypes.string,
+ operationalScope: PropTypes.shape({
+ choices: PropTypes.array,
+ other: PropTypes.string
}),
- type: React.PropTypes.string,
- thresholdUnits: React.PropTypes.string,
- thresholdValue: React.PropTypes.number,
- startDate: React.PropTypes.string,
- expiryDate: React.PropTypes.string
+ type: PropTypes.string,
+ thresholdUnits: PropTypes.string,
+ thresholdValue: PropTypes.number,
+ startDate: PropTypes.string,
+ expiryDate: PropTypes.string
});
const LicenseKeyGroupFormContent = ({data, onDataChanged, genericFieldInfo, validateName, validateStartDate, thresholdValueValidation}) => {
let {name, description, increments, operationalScope, type, thresholdUnits, thresholdValue, startDate, expiryDate} = data;
return (
- <GridSection>
+ <GridSection hasLostColSet>
<GridItem colSpan={2}>
<Input
onChange={name => onDataChanged({name}, LKG_FORM_NAME, {name: validateName})}
@@ -67,7 +68,7 @@
isRequired={true}
type='text'/>
</GridItem>
- <GridItem colSpan={2}>
+ <GridItem colSpan={2} lastColInRow>
<InputOptions
onInputChange={()=>{}}
isMultiSelect={true}
@@ -95,7 +96,7 @@
type='textarea'
overlayPos='bottom' />
</GridItem>
- <GridItem colSpan={2}>
+ <GridItem colSpan={2} lastColInRow>
<Input
isRequired={true}
onChange={e => { const selectedIndex = e.target.selectedIndex;
@@ -108,6 +109,7 @@
errorText={genericFieldInfo.type.errorText}
groupClassName='bootstrap-input-options'
className='input-options-select'
+ overlayPos='bottom'
type='select' >
{
licenseKeyGroupOptionsInputValues.TYPE.map(type =>
@@ -167,7 +169,7 @@
errorText={genericFieldInfo.startDate.errorText}
selectsStart/>
</GridItem>
- <GridItem>
+ <GridItem lastColInRow>
<Input
type='date'
label={i18n('Expiry Date')}
@@ -199,18 +201,18 @@
static propTypes = {
data: LicenseKeyGroupPropType,
previousData: LicenseKeyGroupPropType,
- LKGNames: React.PropTypes.object,
- isReadOnlyMode: React.PropTypes.bool,
- onDataChanged: React.PropTypes.func.isRequired,
- onSubmit: React.PropTypes.func.isRequired,
- onCancel: React.PropTypes.func.isRequired
+ LKGNames: PropTypes.object,
+ isReadOnlyMode: PropTypes.bool,
+ onDataChanged: PropTypes.func.isRequired,
+ onSubmit: PropTypes.func.isRequired,
+ onCancel: PropTypes.func.isRequired
};
static defaultProps = {
data: {}
};
- componentDidUpdate(prevProps) {
+ componentDidUpdate(prevProps) {
if (this.props.formReady && this.props.formReady !== prevProps.formReady) { // if form validation succeeded -> continue with submit
this.submit();
}
@@ -229,8 +231,8 @@
return (
<div className='license-keygroup-editor'>
<Tabs
- type='menu'
- activeTab={selectedTab}
+ type='menu'
+ activeTab={selectedTab}
onTabClick={(tabIndex)=>{
if (tabIndex === tabIds.ADD_LIMIT_BUTTON) {
this.onAddLimit();
@@ -239,7 +241,7 @@
onCloseLimitEditor();
this.setState({selectedLimit: ''});
}
- }}
+ }}
invalidTabs={[]}>
<Tab tabId={tabIds.GENERAL} data-test-id='general-tab' title={i18n('General')}>
{ genericFieldInfo &&
@@ -292,10 +294,10 @@
{i18n('Add Limit')}
</Button>
:
- <div></div> // Render empty div to not break tabs
+ <div></div> // Render empty div to not break tabs
}
</Tabs>
-
+
<GridSection className='license-model-modal-buttons license-key-group-editor-buttons'>
{!this.state.selectedLimit &&
<Button btnType='default' disabled={!this.props.isFormValid || isReadOnlyMode} onClick={() => this.submit()} type='reset'>
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsLimits.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsLimits.js
index 0e20a6a..bd8f21a 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsLimits.js
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsLimits.js
@@ -21,10 +21,10 @@
import LicenseKeyGroupsActionHelper from './LicenseKeyGroupsActionHelper.js';
-const mapStateToProps = ({licenseModel: {licenseKeyGroup: {licenseKeyGroupsEditor: {data}}, limitEditor}, currentScreen}) => {
+const mapStateToProps = ({licenseModel: {licenseKeyGroup: {licenseKeyGroupsEditor: {data}}, limitEditor}, currentScreen}) => {
let {props: {licenseModelId, version}} = currentScreen;
return {
- parent: data,
+ parent: data,
limitEditor,
licenseModelId,
version
@@ -39,14 +39,14 @@
limit,
licenseKeyGroup,
licenseModelId,
- version}),
+ version}),
onDelete: ({limit, parent, licenseModelId, version, onCloseLimitEditor, selectedLimit}) => dispatch({
type: globalModalActionTypes.GLOBAL_MODAL_WARNING,
data:{
- msg: i18n(`Are you sure you want to delete ${limit.name}?`),
+ msg: i18n('Are you sure you want to delete {name}?', {name: limit.name}),
confirmationButtonText: i18n('Delete'),
title: i18n('Delete'),
- onConfirmed: ()=> LicenseKeyGroupsActionHelper.deleteLimit(dispatch, {limit, licenseKeyGroup: parent, licenseModelId, version}).then(() =>
+ onConfirmed: ()=> LicenseKeyGroupsActionHelper.deleteLimit(dispatch, {limit, licenseKeyGroup: parent, licenseModelId, version}).then(() =>
selectedLimit === limit.id && onCloseLimitEditor()
)
}
@@ -54,4 +54,4 @@
};
};
-export default connect(mapStateToProps, mapActionsToProps)(Limits);
\ No newline at end of file
+export default connect(mapStateToProps, mapActionsToProps)(Limits);
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsListEditor.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsListEditor.js
index c1d9373..00c2092 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsListEditor.js
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsListEditor.js
@@ -15,21 +15,20 @@
*/
import {connect} from 'react-redux';
import i18n from 'nfvo-utils/i18n/i18n.js';
+
+import {actionTypes as globalMoadlActions} from 'nfvo-components/modal/GlobalModalConstants.js';
+
import LicenseKeyGroupsActionHelper from './LicenseKeyGroupsActionHelper.js';
import LicenseKeyGroupsListEditorView, {generateConfirmationMsg} from './LicenseKeyGroupsListEditorView.jsx';
-import VersionControllerUtils from 'nfvo-components/panel/versionController/VersionControllerUtils.js';
-import {actionTypes as globalMoadlActions} from 'nfvo-components/modal/GlobalModalConstants.js';
const mapStateToProps = ({licenseModel: {licenseKeyGroup, licenseModelEditor}}) => {
let {licenseKeyGroupsList} = licenseKeyGroup;
let {data} = licenseKeyGroup.licenseKeyGroupsEditor;
let {vendorName} = licenseModelEditor.data;
- let isReadOnlyMode = VersionControllerUtils.isReadOnly(licenseModelEditor.data);
return {
vendorName,
licenseKeyGroupsList,
- isReadOnlyMode,
isDisplayModal: Boolean(data),
isModalInEditMode: Boolean(data && data.id)
};
@@ -45,11 +44,10 @@
msg: generateConfirmationMsg(licenseKeyGroup),
confirmationButtonText: i18n('Delete'),
title: i18n('Delete'),
- onConfirmed: ()=>LicenseKeyGroupsActionHelper.deleteLicenseKeyGroup(dispatch, {licenseModelId, licenseKeyGroupId:licenseKeyGroup.id, version})
+ onConfirmed: () => LicenseKeyGroupsActionHelper.deleteLicenseKeyGroup(dispatch, {licenseModelId, licenseKeyGroupId:licenseKeyGroup.id, version})
}
})
};
};
export default connect(mapStateToProps, mapActionsToProps)(LicenseKeyGroupsListEditorView);
-
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsListEditorView.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsListEditorView.jsx
index 1a7f2b0..5a98b7f 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsListEditorView.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsListEditorView.jsx
@@ -14,7 +14,7 @@
* permissions and limitations under the License.
*/
import React from 'react';
-
+import PropTypes from 'prop-types';
import i18n from 'nfvo-utils/i18n/i18n.js';
import Modal from 'nfvo-components/modal/Modal.jsx';
import ListEditorView from 'nfvo-components/listEditor/ListEditorView.jsx';
@@ -26,15 +26,15 @@
class LicenseKeyGroupsListEditorView extends React.Component {
static propTypes = {
- vendorName: React.PropTypes.string,
- licenseModelId: React.PropTypes.string.isRequired,
- licenseKeyGroupsList: React.PropTypes.array,
- isReadOnlyMode: React.PropTypes.bool.isRequired,
- isDisplayModal: React.PropTypes.bool,
- isModalInEditMode: React.PropTypes.bool,
- onAddLicenseKeyGroupClick: React.PropTypes.func,
- onEditLicenseKeyGroupClick: React.PropTypes.func,
- onDeleteLicenseKeyGroupClick: React.PropTypes.func
+ vendorName: PropTypes.string,
+ licenseModelId: PropTypes.string.isRequired,
+ licenseKeyGroupsList: PropTypes.array,
+ isReadOnlyMode: PropTypes.bool.isRequired,
+ isDisplayModal: PropTypes.bool,
+ isModalInEditMode: PropTypes.bool,
+ onAddLicenseKeyGroupClick: PropTypes.func,
+ onEditLicenseKeyGroupClick: PropTypes.func,
+ onDeleteLicenseKeyGroupClick: PropTypes.func
};
static defaultProps = {
@@ -51,7 +51,7 @@
const {localFilter} = this.state;
return (
- <div className='license-key-groups-list-editor'>
+ <div className='license-model-list-editor license-key-groups-list-editor'>
<ListEditorView
title={i18n('License Key Groups')}
plusButtonTitle={i18n('Add License Key Group')}
@@ -122,26 +122,24 @@
}
getOperationalScopes(operationalScope) {
-
- if(operationalScope.choices && operationalScope.choices.toString() === i18n(optionInputOther.OTHER)) {
+
+ if (operationalScope.choices && operationalScope.choices.toString() === i18n(optionInputOther.OTHER)) {
return operationalScope.other;
- }
- else if (operationalScope.choices) {
+ } else if (operationalScope.choices) {
let allOpScopes = '';
for (let opScope of operationalScope.choices) {
allOpScopes += allOpScopes === '' ? InputOptions.getTitleByName(optionsInputValues, opScope) : `, ${InputOptions.getTitleByName(optionsInputValues, opScope)}`;
}
return allOpScopes;
- }
- else {
+ } else {
return '';
- }
+ }
}
extractValue(item) {
if (item === undefined) {
return '';
- } //TODO fix it later
+ } //TODO fix it sooner rather than later
return item ? item.choice === optionInputOther.OTHER ? item.other : InputOptions.getTitleByName(optionsInputValues, item.choice) : '';
}
@@ -151,7 +149,7 @@
export function generateConfirmationMsg(licenseKeyGroupToDelete) {
let name = licenseKeyGroupToDelete ? licenseKeyGroupToDelete.name : '';
- let msg = i18n(`Are you sure you want to delete "${name}"?`);
+ let msg = i18n('Are you sure you want to delete "{name}"?', {name: name});
let subMsg = licenseKeyGroupToDelete.referencingFeatureGroups
&& licenseKeyGroupToDelete.referencingFeatureGroups.length > 0 ?
i18n('This license key group is associated with one or more feature groups') :
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditor.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditor.jsx
index 110e513..54f057e 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditor.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/limits/LimitEditor.jsx
@@ -1,4 +1,5 @@
import React from 'react';
+import PropTypes from 'prop-types';
import i18n from 'nfvo-utils/i18n/i18n.js';
import Form from 'nfvo-components/input/validation/Form.jsx';
import Input from 'nfvo-components/input/validation/Input.jsx';
@@ -10,35 +11,35 @@
import {other as optionInputOther} from 'nfvo-components/input/validation/InputOptions.jsx';
import InputOptions from 'nfvo-components/input/validation/InputOptions.jsx';
-const LimitPropType = React.PropTypes.shape({
- id: React.PropTypes.string,
- name: React.PropTypes.string,
- description: React.PropTypes.string,
- metric: React.PropTypes.shape({
- choice: React.PropTypes.string,
- other: React.PropTypes.string
+const LimitPropType = PropTypes.shape({
+ id: PropTypes.string,
+ name: PropTypes.string,
+ description: PropTypes.string,
+ metric: PropTypes.shape({
+ choice: PropTypes.string,
+ other: PropTypes.string
}),
- value: React.PropTypes.string,
- aggregationFunction: React.PropTypes.string,
- time: React.PropTypes.string,
- unit: React.PropTypes.shape({
- choice: React.PropTypes.string,
- other: React.PropTypes.string
+ value: PropTypes.string,
+ aggregationFunction: PropTypes.string,
+ time: PropTypes.string,
+ unit: PropTypes.shape({
+ choice: PropTypes.string,
+ other: PropTypes.string
})
});
class LimitEditor extends React.Component {
static propTypes = {
data: LimitPropType,
- limitsNames: React.PropTypes.object,
- isReadOnlyMode: React.PropTypes.bool,
- isFormValid: React.PropTypes.bool,
- formReady: React.PropTypes.bool,
- genericFieldInfo: React.PropTypes.object.isRequired,
- onDataChanged: React.PropTypes.func.isRequired,
- onSubmit: React.PropTypes.func.isRequired,
- onValidateForm: React.PropTypes.func.isRequired,
- onCancel: React.PropTypes.func.isRequired
+ limitsNames: PropTypes.object,
+ isReadOnlyMode: PropTypes.bool,
+ isFormValid: PropTypes.bool,
+ formReady: PropTypes.bool,
+ genericFieldInfo: PropTypes.object.isRequired,
+ onDataChanged: PropTypes.func.isRequired,
+ onSubmit: PropTypes.func.isRequired,
+ onValidateForm: PropTypes.func.isRequired,
+ onCancel: PropTypes.func.isRequired
};
componentDidUpdate(prevProps) {
@@ -67,7 +68,7 @@
labledButtons={false}
isReadOnlyMode={isReadOnlyMode}
className='limit-editor-form'>
- <GridSection className='limit-editor-form-grid-section'>
+ <GridSection className='limit-editor-form-grid-section' hasLastColSet>
<GridItem colSpan={2}>
<Input
onChange={name => onDataChanged({name}, LIMITS_FORM_NAME, {name: () => this.validateName(name)})}
@@ -79,7 +80,7 @@
isRequired={true}
type='text'/>
</GridItem>
- <GridItem colSpan={2}>
+ <GridItem colSpan={2} lastColInRow>
<Input
onChange={description => onDataChanged({description}, LIMITS_FORM_NAME)}
label={i18n('Description')}
@@ -120,7 +121,7 @@
isRequired={true}
type='text'/>
</GridItem>
- <GridItem>
+ <GridItem lastColInRow>
<InputOptions
onInputChange={()=>{}}
isMultiSelect={false}
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/LicenseModelOverview.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/LicenseModelOverview.js
index 9d714ec..54941aa 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/LicenseModelOverview.js
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/LicenseModelOverview.js
@@ -15,12 +15,20 @@
*/
import {connect} from 'react-redux';
import LicenseModelActionHelper from 'sdc-app/onboarding/licenseModel/LicenseModelActionHelper.js';
-import VersionControllerUtils from 'nfvo-components/panel/versionController/VersionControllerUtils.js';
import LicenseModelOverviewView from './LicenseModelOverviewView.jsx';
import {overviewEditorHeaders, selectedButton} from './LicenseModelOverviewConstants.js';
import licenseModelOverviewActionHelper from './licenseModelOverviewActionHelper.js';
-export const mapStateToProps = ({licenseModel: {licenseModelEditor, entitlementPool, licenseAgreement, featureGroup, licenseKeyGroup, licenseModelOverview}}) => {
+export const mapStateToProps = ({
+ licenseModel: {
+ licenseModelEditor,
+ entitlementPool,
+ licenseAgreement,
+ featureGroup,
+ licenseKeyGroup,
+ licenseModelOverview
+ }
+}) => {
let modalHeader, licensingDataList;
let isDisplayModal = false;
@@ -128,6 +136,7 @@
modalHeader = overviewEditorHeaders.LICENSE_KEY_GROUP;
isDisplayModal = true;
}
+
let orphanDataList = [
...featureGroup.featureGroupsList.reduce(checkFG, []),
...entitlementPool.entitlementPoolsList.reduce(checkEP, []),
@@ -140,8 +149,8 @@
if (selectedTab === null) {
selectedTab = (licensingDataList.length) ? selectedButton.VLM_LIST_VIEW : selectedButton.NOT_IN_USE;
}
+
return {
- isReadOnlyMode: VersionControllerUtils.isReadOnly(licenseModelEditor.data),
isDisplayModal,
modalHeader,
licenseModelId: licenseModelEditor.data.id,
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/LicenseModelOverviewView.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/LicenseModelOverviewView.jsx
index 77289a3..39109af 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/LicenseModelOverviewView.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/LicenseModelOverviewView.jsx
@@ -14,6 +14,7 @@
* permissions and limitations under the License.
*/
import React from 'react';
+import PropTypes from 'prop-types';
import i18n from 'nfvo-utils/i18n/i18n.js';
import Modal from 'nfvo-components/modal/Modal.jsx';
import classNames from 'classnames';
@@ -47,25 +48,25 @@
class LicenseModelOverviewView extends React.Component {
static propTypes = {
- isDisplayModal: React.PropTypes.bool,
- isReadOnlyMode: React.PropTypes.bool,
- licenseModelId: React.PropTypes.string,
- licensingDataList: React.PropTypes.array,
- orphanDataList: React.PropTypes.array,
- modalHeader: React.PropTypes.string,
- selectedTab: React.PropTypes.string,
- onTabSelect: React.PropTypes.func,
- onCallVCAction: React.PropTypes.func,
- onClose: React.PropTypes.func
+ isDisplayModal: PropTypes.bool,
+ isReadOnlyMode: PropTypes.bool,
+ licenseModelId: PropTypes.string,
+ licensingDataList: PropTypes.array,
+ orphanDataList: PropTypes.array,
+ modalHeader: PropTypes.string,
+ selectedTab: PropTypes.string,
+ onTabSelect: PropTypes.func,
+ onCallVCAction: PropTypes.func,
+ onClose: PropTypes.func
};
render() {
- let {isDisplayModal, modalHeader, licensingDataList, selectedTab, onTabSelect, orphanDataList} = this.props;
+ let {isDisplayModal, modalHeader, licensingDataList, selectedTab, onTabSelect, orphanDataList, isReadOnlyMode} = this.props;
let selectedInUse = selectedTab !== selectedButton.NOT_IN_USE;
let dataList = selectedInUse ? licensingDataList : orphanDataList;
return(
<div className='license-model-overview'>
- <SummaryView/>
+ <SummaryView isReadOnlyMode={isReadOnlyMode}/>
<div className={classNames('overview-list-section ', !selectedInUse ? 'overview-list-orphans' : '' )}>
<div className='vlm-list-tab-panel'>
<ListButtons onTabSelect={onTabSelect}
@@ -91,16 +92,16 @@
}
renderModalBody(modalHeader) {
- let {licenseModelId, version} = this.props;
+ let {licenseModelId, version, isReadOnlyMode} = this.props;
switch (modalHeader) {
case overviewEditorHeaders.ENTITLEMENT_POOL:
- return <EntitlementPoolsEditor version={version} licenseModelId={licenseModelId} isReadOnlyMode={false}/>;
+ return <EntitlementPoolsEditor version={version} licenseModelId={licenseModelId} isReadOnlyMode={isReadOnlyMode}/>;
case overviewEditorHeaders.LICENSE_AGREEMENT:
- return <LicenseAgreementEditor version={version} licenseModelId={licenseModelId} isReadOnlyMode={false}/>;
+ return <LicenseAgreementEditor version={version} licenseModelId={licenseModelId} isReadOnlyMode={isReadOnlyMode}/>;
case overviewEditorHeaders.FEATURE_GROUP:
- return <FeatureGroupEditor version={version} licenseModelId={licenseModelId} isReadOnlyMode={false}/>;
+ return <FeatureGroupEditor version={version} licenseModelId={licenseModelId} isReadOnlyMode={isReadOnlyMode}/>;
case overviewEditorHeaders.LICENSE_KEY_GROUP:
- return <LicenseKeyGroupsEditor version={version} licenseModelId={licenseModelId} isReadOnlyMode={false}/>;
+ return <LicenseKeyGroupsEditor version={version} licenseModelId={licenseModelId} isReadOnlyMode={isReadOnlyMode}/>;
}
}
}
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/SummaryView.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/SummaryView.jsx
index 6fcdb47..4053f14 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/SummaryView.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/SummaryView.jsx
@@ -13,21 +13,24 @@
* or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
-import React from 'react';
+import React, {Component} from 'react';
import i18n from 'nfvo-utils/i18n/i18n.js';
import {default as VendorDataView} from './summary/VendorDataView.js';
import {default as SummaryCountList} from './summary/SummaryCountList.js';
-function SummaryView() {
- return(
- <div className='overview-top-section'>
- <div className='overview-title'>{i18n('overview')}</div>
- <div className='license-model-overview-top'>
- <VendorDataView/>
- <SummaryCountList/>
+class SummaryView extends Component {
+ render() {
+ const {isReadOnlyMode} = this.props;
+ return(
+ <div className='overview-top-section'>
+ <div className='page-title'>{i18n('overview')}</div>
+ <div className='license-model-overview-top'>
+ <VendorDataView isReadOnlyMode={isReadOnlyMode}/>
+ <SummaryCountList isReadOnlyMode={isReadOnlyMode}/>
+ </div>
</div>
- </div>
- );
+ );
+ }
}
export default SummaryView;
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/VLMListView.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/VLMListView.jsx
index ec05e37..012bd6e 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/VLMListView.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/VLMListView.jsx
@@ -14,6 +14,7 @@
* permissions and limitations under the License.
*/
import React, {Component} from 'react';
+import PropTypes from 'prop-types';
import {Collapse} from 'react-bootstrap';
import LicenseAgreement from './listItems/LicenseAgreement.jsx';
import EntitlementPool from './listItems/EntitlementPool.jsx';
@@ -24,8 +25,8 @@
class VLMListView extends Component {
static propTypes = {
- licensingDataList: React.PropTypes.array,
- showInUse: React.PropTypes.bool
+ licensingDataList: PropTypes.array,
+ showInUse: PropTypes.bool
};
state = {
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/listItems/listItemsComponents/AdditionalDataCol.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/listItems/listItemsComponents/AdditionalDataCol.jsx
index 5b5daaf..ffc0991 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/listItems/listItemsComponents/AdditionalDataCol.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/listItems/listItemsComponents/AdditionalDataCol.jsx
@@ -14,6 +14,7 @@
* permissions and limitations under the License.
*/
import React from 'react';
+import PropTypes from 'prop-types';
function AdditionalDataCol({children}) {
return (
@@ -27,9 +28,9 @@
}
AdditionalDataCol.propTypes = {
- children: React.PropTypes.oneOfType([
- React.PropTypes.arrayOf(React.PropTypes.node),
- React.PropTypes.node
+ children: PropTypes.oneOfType([
+ PropTypes.arrayOf(PropTypes.node),
+ PropTypes.node
])
};
@@ -43,9 +44,9 @@
}
AdditionalDataElement.propTypes = {
- name: React.PropTypes.string,
- value: React.PropTypes.string,
- className: React.PropTypes.string
+ name: PropTypes.string,
+ value: PropTypes.string,
+ className: PropTypes.string
};
export {AdditionalDataCol, AdditionalDataElement};
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/listItems/listItemsComponents/ArrowCol.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/listItems/listItemsComponents/ArrowCol.jsx
index a5eb9d2..29aec64 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/listItems/listItemsComponents/ArrowCol.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/listItems/listItemsComponents/ArrowCol.jsx
@@ -14,6 +14,7 @@
* permissions and limitations under the License.
*/
import React from 'react';
+import PropTypes from 'prop-types';
import classNames from 'classnames';
function ArrowCol ({isCollapsed, length}) {
@@ -28,8 +29,8 @@
}
ArrowCol.propTypes = {
- isCollapsed: React.PropTypes.bool,
- length: React.PropTypes.number
+ isCollapsed: PropTypes.bool,
+ length: PropTypes.number
};
export default ArrowCol;
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/listItems/listItemsComponents/ItemInfo.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/listItems/listItemsComponents/ItemInfo.jsx
index 655a0dd..95ae123 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/listItems/listItemsComponents/ItemInfo.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/listItems/listItemsComponents/ItemInfo.jsx
@@ -14,6 +14,7 @@
* permissions and limitations under the License.
*/
import React from 'react';
+import PropTypes from 'prop-types';
function ItemInfo({name, description, children}) {
return (
@@ -28,11 +29,11 @@
}
ItemInfo.propTypes = {
- name: React.PropTypes.string,
- description: React.PropTypes.string,
- children: React.PropTypes.oneOfType([
- React.PropTypes.arrayOf(React.PropTypes.node),
- React.PropTypes.node
+ name: PropTypes.string,
+ description: PropTypes.string,
+ children: PropTypes.oneOfType([
+ PropTypes.arrayOf(PropTypes.node),
+ PropTypes.node
])
};
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/LicenseModelDescriptionEdit.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/LicenseModelDescriptionEdit.jsx
index f4d6d4d..af759f1 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/LicenseModelDescriptionEdit.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/LicenseModelDescriptionEdit.jsx
@@ -14,22 +14,23 @@
* permissions and limitations under the License.
*/
import React from 'react';
-import Input from 'nfvo-components/input/validation/Input.jsx';
import i18n from 'nfvo-utils/i18n/i18n.js';
+import Input from 'nfvo-components/input/validation/Input.jsx';
class LicenseModelDescriptionEdit extends React.Component {
render() {
//TODO check if buttons
let {onDataChanged, description, genericFieldInfo} = this.props;
- let saveButtonClassName = (genericFieldInfo.description.isValid) ? 'description-save' : 'description-save disabled';
+ let {isValid, errorText} = genericFieldInfo.description;
+ let saveButtonClassName = isValid ? 'description-save' : 'description-save disabled';
return(
<div className='vendor-description-edit'>
<Input
onChange={description => onDataChanged({description})}
value={description}
- isValid={genericFieldInfo.description.isValid}
- errorText={genericFieldInfo.description.errorText}
+ isValid={isValid}
+ errorText={errorText}
className='description-edit-textarea'
type='textarea'/>
<div className='buttons-row'>
@@ -50,7 +51,7 @@
let {onSubmit, data, description} = this.props;
onSubmit({
...data,
- description: description
+ description: description.trim()
});
}
}
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/ListButtons.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/ListButtons.jsx
index f02c82d..3fcac3c 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/ListButtons.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/ListButtons.jsx
@@ -14,6 +14,7 @@
* permissions and limitations under the License.
*/
import React from 'react';
+import PropTypes from 'prop-types';
import {selectedButton} from '../LicenseModelOverviewConstants.js';
import Tabs from 'sdc-ui/lib/react/Tabs.js';
import Tab from 'sdc-ui/lib/react/Tab.js';
@@ -43,8 +44,8 @@
}
ListButtons.propTypes = {
- onTabSelect: React.PropTypes.func,
- selectedInUse: React.PropTypes.bool
+ onTabSelect: PropTypes.func,
+ selectedInUse: PropTypes.bool
};
export default ListButtons;
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/SummaryCountItem.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/SummaryCountItem.jsx
index 6ec84e1..50c547e 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/SummaryCountItem.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/SummaryCountItem.jsx
@@ -24,7 +24,8 @@
<span className='item-name' onClick={onNavigate}>{name}</span>
<span className='item-count' onClick={onNavigate} data-test-id={'vlm-summary-vendor-counter-' + name.toLowerCase().replace(/\s/g,'-')}>({counter})</span>
</div>
- <SVGIcon name='plusCircle' disabled={isReadOnlyMode} color='secondary' onClick={onAdd} data-test-id={'vlm-summary-vendor-add-btn-' + name.toLowerCase().replace(/\s/g,'-')}/>
+ <SVGIcon name='plusCircle' disabled={isReadOnlyMode} className={isReadOnlyMode ? 'disabled' : ''}
+ color='secondary' onClick={onAdd} data-test-id={'vlm-summary-vendor-add-btn-' + name.toLowerCase().replace(/\s/g,'-')}/>
</div>
);
}
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/SummaryCountList.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/SummaryCountList.js
index c69a092..15b6649 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/SummaryCountList.js
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/SummaryCountList.js
@@ -16,9 +16,9 @@
import React from 'react';
import {connect} from 'react-redux';
-import VersionControllerUtils from 'nfvo-components/panel/versionController/VersionControllerUtils.js';
+import ScreensHelper from 'sdc-app/common/helpers/ScreensHelper.js';
+import {enums, screenTypes} from 'sdc-app/onboarding/OnboardingConstants.js';
-import OnboardingActionHelper from '../../../OnboardingActionHelper.js';
import EntitlementPoolsActionHelper from '../../entitlementPools/EntitlementPoolsActionHelper.js';
import LicenseAgreementActionHelper from '../../licenseAgreement/LicenseAgreementActionHelper.js';
import LicenseKeyGroupsActionHelper from '../../licenseKeyGroups/LicenseKeyGroupsActionHelper.js';
@@ -27,27 +27,32 @@
import {overviewItems} from '../LicenseModelOverviewConstants.js';
import SummaryCountItem from './SummaryCountItem.jsx';
-export const mapStateToProps = ({licenseModel: {licenseModelEditor, licenseAgreement: {licenseAgreementList},
- featureGroup: {featureGroupsList}, entitlementPool: {entitlementPoolsList}, licenseKeyGroup: {licenseKeyGroupsList}}}) => {
+export const mapStateToProps = ({
+ licenseModel: {
+ licenseModelEditor,
+ licenseAgreement: {licenseAgreementList},
+ featureGroup: {featureGroupsList},
+ entitlementPool: {entitlementPoolsList},
+ licenseKeyGroup: {licenseKeyGroupsList}
+ }
+}) => {
let {vendorName, description, id, version} = licenseModelEditor.data;
-
- let isReadOnlyMode = VersionControllerUtils.isReadOnly(licenseModelEditor.data);
-
let counts = [
{name: overviewItems.LICENSE_AGREEMENTS, count: licenseAgreementList.length},
{name: overviewItems.FEATURE_GROUPS, count: featureGroupsList.length},
{name: overviewItems.ENTITLEMENT_POOLS, count: entitlementPoolsList.length},
{name: overviewItems.LICENSE_KEY_GROUPS, count: licenseKeyGroupsList.length},
];
+
return {
vendorName,
licenseModelId: id,
description,
counts,
- isReadOnlyMode,
version
};
+
};
const mapActionsToProps = (dispatch) => {
@@ -71,22 +76,27 @@
}
},
onNavigateClick: ({name, licenseModelId, version}) => {
+ let screenToNavigate;
switch (name) {
case overviewItems.ENTITLEMENT_POOLS:
- OnboardingActionHelper.navigateToEntitlementPools(dispatch, {licenseModelId, version});
+ screenToNavigate = enums.SCREEN.ENTITLEMENT_POOLS;
break;
case overviewItems.FEATURE_GROUPS:
- OnboardingActionHelper.navigateToFeatureGroups(dispatch, {licenseModelId, version});
+ screenToNavigate = enums.SCREEN.FEATURE_GROUPS;
break;
case overviewItems.LICENSE_AGREEMENTS:
- OnboardingActionHelper.navigateToLicenseAgreements(dispatch, {licenseModelId, version});
+ screenToNavigate = enums.SCREEN.LICENSE_AGREEMENTS;
break;
case overviewItems.LICENSE_KEY_GROUPS:
- OnboardingActionHelper.navigateToLicenseKeyGroups(dispatch, {licenseModelId, version});
+ screenToNavigate = enums.SCREEN.LICENSE_KEY_GROUPS;
break;
default:
break;
}
+ ScreensHelper.loadScreen(dispatch, {
+ screen: screenToNavigate, screenType: screenTypes.LICENSE_MODEL,
+ props: {licenseModelId, version}
+ });
}
};
};
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/VendorDataView.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/VendorDataView.js
index 532ca32..616355d 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/VendorDataView.js
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/VendorDataView.js
@@ -23,17 +23,19 @@
import licenseModelOverviewActionHelper from '../licenseModelOverviewActionHelper.js';
import LicenseModelActionHelper from '../../LicenseModelActionHelper.js';
import LicenseModelDescriptionEdit from './LicenseModelDescriptionEdit.jsx';
-import VersionControllerUtils from 'nfvo-components/panel/versionController/VersionControllerUtils.js';
import {VLM_DESCRIPTION_FORM} from '../LicenseModelOverviewConstants.js';
-export const mapStateToProps = ({licenseModel: {licenseModelEditor: {data}, licenseModelOverview: {descriptionEditor: {data: descriptionData = {}, genericFieldInfo} }}}) => {
+export const mapStateToProps = ({
+ licenseModel: {
+ licenseModelEditor: {data},
+ licenseModelOverview: {descriptionEditor: {data: descriptionData = {}, genericFieldInfo}}
+ }
+}) => {
let {description} = descriptionData;
- let isReadOnlyMode = VersionControllerUtils.isReadOnly(data);
return {
data,
description,
- genericFieldInfo,
- isReadOnlyMode
+ genericFieldInfo
};
};