aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups
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/licenseKeyGroups
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/licenseKeyGroups')
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsActionHelper.js13
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsEditorView.jsx58
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsLimits.js12
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsListEditor.js10
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsListEditorView.jsx38
5 files changed, 64 insertions, 67 deletions
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 f22080a75c..4d86815276 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 @@ export default {
type: licenseKeyGroupsConstants.EDIT_LICENSE_KEY_GROUP,
licenseKeyGroup
});
+ ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id});
});
}
else {
@@ -140,6 +141,7 @@ export default {
id: response.value
}
});
+ ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id});
});
}
@@ -152,6 +154,7 @@ export default {
type: licenseKeyGroupsConstants.DELETE_LICENSE_KEY_GROUP,
licenseKeyGroupId
});
+ ItemsHelper.checkItemStatus(dispatch, {itemId: licenseModelId, versionId: version.id});
});
},
@@ -169,12 +172,6 @@ export default {
});
},
- 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 @@ export default {
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 70fb43ee88..87c947eb02 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 {DATE_FORMAT} from 'sdc-app/onboarding/OnboardingConstants.js';
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 @@ const LicenseKeyGroupFormContent = ({data, onDataChanged, genericFieldInfo, vali
isRequired={true}
type='text'/>
</GridItem>
- <GridItem colSpan={2}>
+ <GridItem colSpan={2} lastColInRow>
<InputOptions
onInputChange={()=>{}}
isMultiSelect={true}
@@ -95,7 +96,7 @@ const LicenseKeyGroupFormContent = ({data, onDataChanged, genericFieldInfo, vali
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 @@ const LicenseKeyGroupFormContent = ({data, onDataChanged, genericFieldInfo, vali
errorText={genericFieldInfo.type.errorText}
groupClassName='bootstrap-input-options'
className='input-options-select'
+ overlayPos='bottom'
type='select' >
{
licenseKeyGroupOptionsInputValues.TYPE.map(type =>
@@ -167,7 +169,7 @@ const LicenseKeyGroupFormContent = ({data, onDataChanged, genericFieldInfo, vali
errorText={genericFieldInfo.startDate.errorText}
selectsStart/>
</GridItem>
- <GridItem>
+ <GridItem lastColInRow>
<Input
type='date'
label={i18n('Expiry Date')}
@@ -199,18 +201,18 @@ class LicenseKeyGroupsEditorView extends React.Component {
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 @@ class LicenseKeyGroupsEditorView extends React.Component {
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 @@ class LicenseKeyGroupsEditorView extends React.Component {
onCloseLimitEditor();
this.setState({selectedLimit: ''});
}
- }}
+ }}
invalidTabs={[]}>
<Tab tabId={tabIds.GENERAL} data-test-id='general-tab' title={i18n('General')}>
{ genericFieldInfo &&
@@ -292,10 +294,10 @@ class LicenseKeyGroupsEditorView 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 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 0e20a6a486..bd8f21a7c5 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 Limits from 'sdc-app/onboarding/licenseModel/limits/Limits.jsx';
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 @@ const mapActionsToProps = (dispatch) => {
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 @@ 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/licenseKeyGroups/LicenseKeyGroupsListEditor.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsListEditor.js
index c1d937394a..00c2092b83 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 @@ const mapActionsToProps = (dispatch, {licenseModelId, version}) => {
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 1a7f2b0b5b..5a98b7f575 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 @@ import {optionsInputValues} from './LicenseKeyGroupsConstants';
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 @@ class LicenseKeyGroupsListEditorView extends React.Component {
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 @@ class LicenseKeyGroupsListEditorView extends React.Component {
}
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 default LicenseKeyGroupsListEditorView;
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') :