summaryrefslogtreecommitdiffstats
path: root/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools
diff options
context:
space:
mode:
authortalig <talig@amdocs.com>2017-12-20 14:30:43 +0200
committerVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>2017-12-21 11:12:33 +0000
commit8e9c0653dd6c6862123c9609ae34e1206d86456e (patch)
tree5eeef00ec0677133baa439ca8d7ffd7aca4804b6 /openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools
parent785ebcc95de3e064e843bec04ba7a209d854fc7c (diff)
Add collaboration feature
Issue-ID: SDC-767 Change-Id: I14fb4c1f54086ed03a56a7ff7fab9ecd40381795 Signed-off-by: talig <talig@amdocs.com>
Diffstat (limited to 'openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools')
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsActionHelper.js12
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsEditorView.jsx81
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsLimits.js10
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsListEditor.js14
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsListEditorView.jsx23
5 files changed, 67 insertions, 73 deletions
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 ce4327d810..09a6e8228c 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 @@ export default {
type: entitlementPoolsActionTypes.DELETE_ENTITLEMENT_POOL,
entitlementPoolId
});
+ ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id});
});
},
@@ -147,6 +148,7 @@ export default {
type: entitlementPoolsActionTypes.EDIT_ENTITLEMENT_POOL,
entitlementPool
});
+ ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id});
});
}
else {
@@ -159,6 +161,7 @@ export default {
id: response.value
}
});
+ ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id});
});
}
},
@@ -176,11 +179,6 @@ export default {
});
},
- switchVersion(dispatch, {licenseModelId, version}) {
- LicenseModelActionHelper.fetchLicenseModelById(dispatch, {licenseModelId, version}).then(() => {
- this.fetchEntitlementPoolsList(dispatch, {licenseModelId, version});
- });
- },
fetchLimits(dispatch, {licenseModelId, version, entitlementPool}) {
@@ -200,12 +198,14 @@ export default {
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 8473c1a2be..154174cf6c 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 Tab from 'sdc-ui/lib/react/Tab.js';
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 @@ const EntitlementPoolsFormContent = ({data, genericFieldInfo, onDataChanged, val
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 @@ const EntitlementPoolsFormContent = ({data, genericFieldInfo, onDataChanged, val
data-test-id='create-ep-name'
type='text'/>
</GridItem>
- <GridItem colSpan={2}>
+ <GridItem colSpan={2} lastColInRow>
<InputOptions
onInputChange={()=>{}}
isMultiSelect={true}
@@ -94,7 +95,7 @@ const EntitlementPoolsFormContent = ({data, genericFieldInfo, onDataChanged, val
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 @@ const EntitlementPoolsFormContent = ({data, genericFieldInfo, onDataChanged, val
)}
isValid={genericFieldInfo.startDate.isValid}
errorText={genericFieldInfo.startDate.errorText}
- selectsStart/>
+ selectsStart/>
<Input
type='date'
label={i18n('Expiry Date')}
@@ -167,8 +168,8 @@ const EntitlementPoolsFormContent = ({data, genericFieldInfo, onDataChanged, val
isValid={genericFieldInfo.expiryDate.isValid}
errorText={genericFieldInfo.expiryDate.errorText}
selectsEnd/>
- </div>
- </GridItem>
+ </div>
+ </GridItem>
</GridSection>
);
};
@@ -178,18 +179,18 @@ class EntitlementPoolsEditorView extends React.Component {
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 @@ class EntitlementPoolsEditorView extends React.Component {
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 @@ class EntitlementPoolsEditorView extends React.Component {
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 @@ class EntitlementPoolsEditorView extends React.Component {
}
</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 @@ class EntitlementPoolsEditorView extends React.Component {
{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 @@ class EntitlementPoolsEditorView extends React.Component {
<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 @@ class EntitlementPoolsEditorView extends React.Component {
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 1eb6eebff8..8300594098 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 Limits from 'sdc-app/onboarding/licenseModel/limits/Limits.jsx';
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 @@ const mapActionsToProps = (dispatch) => {
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 @@ const mapActionsToProps = (dispatch) => {
};
};
-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 fa21109541..f1dc1f8542 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 @@ const mapActionsToProps = (dispatch, {licenseModelId, version}) => {
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 c730d669c7..cc0cda1992 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 @@ import {extractUnits} from './EntitlementPoolsConstants';
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 @@ class EntitlementPoolsListEditorView extends React.Component {
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 default EntitlementPoolsListEditorView;
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 ?