summaryrefslogtreecommitdiffstats
path: root/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups
diff options
context:
space:
mode:
authorAviZi <avi.ziv@amdocs.com>2017-06-09 02:39:56 +0300
committerAviZi <avi.ziv@amdocs.com>2017-06-09 02:39:56 +0300
commit280f8015d06af1f41a3ef12e8300801c7a5e0d54 (patch)
tree9c1d3978c04cd28068f02073038c936bb49ca9e0 /openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups
parentfd3821dad11780d33c5373d74c957c442489945e (diff)
[SDC-29] Amdocs OnBoard 1707 initial commit.
Change-Id: Ie4d12a3f574008b792899b368a0902a8b46b5370 Signed-off-by: AviZi <avi.ziv@amdocs.com>
Diffstat (limited to 'openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups')
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupEditor.js74
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupEditorView.jsx413
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupListEditor.js50
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupListEditorView.jsx86
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsActionHelper.js118
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsConfirmationModal.jsx48
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsConstants.js44
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsEditorReducer.js52
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsListReducer.js21
9 files changed, 361 insertions, 545 deletions
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupEditor.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupEditor.js
index c2b269bcf9..c6249c98ca 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupEditor.js
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupEditor.js
@@ -1,66 +1,78 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
+/*!
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
*/
-
import {connect} from 'react-redux';
import FeatureGroupsActionHelper from './FeatureGroupsActionHelper.js';
import FeatureGroupEditorView from './FeatureGroupEditorView.jsx';
+import ValidationHelper from 'sdc-app/common/helpers/ValidationHelper.js';
-const mapStateToProps = ({licenseModel: {featureGroup, entitlementPool, licenseKeyGroup}}) => {
-
+export const mapStateToProps = ({licenseModel: {featureGroup, entitlementPool, licenseKeyGroup}}) => {
+ let {entitlementPoolsList = []} = entitlementPool;
+ let {licenseKeyGroupsList = []} = licenseKeyGroup;
const {featureGroupEditor} = featureGroup;
+ let {data, selectedTab, genericFieldInfo, formReady} = featureGroupEditor;
+ const featureGroupId = data ? data.id : null;
+ const list = featureGroup.featureGroupsList;
- let {data, selectedTab, selectedEntitlementPoolsButtonTab, selectedLicenseKeyGroupsButtonTab} = featureGroupEditor;
+ let previousData, FGNames = {}, isFormValid = true, invalidTabs = [];
- let previousData;
- const featureGroupId = data ? data.id : null;
if (featureGroupId) {
- previousData = featureGroup.featureGroupsList.find(featureGroup => featureGroup.id === featureGroupId);
+ previousData = list.find(featureGroup => featureGroup.id === featureGroupId);
+ }
+
+ for (let i = 0; i < list.length; i++) {
+ FGNames[list[i].name] = list[i].id;
+ }
+
+ for (let field in genericFieldInfo) {
+ if (!genericFieldInfo[field].isValid) {
+ isFormValid = false;
+ let tabId = genericFieldInfo[field].tabId;
+ if (invalidTabs.indexOf(tabId) === -1) {
+ invalidTabs[invalidTabs.length] = genericFieldInfo[field].tabId;
+ }
+ }
}
- let {entitlementPoolsList = []} = entitlementPool;
- let {licenseKeyGroupsList = []} = licenseKeyGroup;
return {
data,
previousData,
selectedTab,
- selectedEntitlementPoolsButtonTab,
- selectedLicenseKeyGroupsButtonTab,
entitlementPoolsList,
- licenseKeyGroupsList
+ licenseKeyGroupsList,
+ isFormValid,
+ formReady,
+ genericFieldInfo,
+ invalidTabs,
+ FGNames
};
};
-const mapActionsToProps = (dispatch, {licenseModelId}) => {
+const mapActionsToProps = (dispatch, {licenseModelId, version}) => {
return {
+ onDataChanged: (deltaData, formName, customValidations) => ValidationHelper.dataChanged(dispatch, {deltaData, formName, customValidations}),
onTabSelect: tab => FeatureGroupsActionHelper.selectEntitlementPoolsEditorTab(dispatch, {tab}),
- onEntitlementPoolsButtonTabSelect: buttonTab => FeatureGroupsActionHelper.selectFeatureGroupsEditorEntitlementPoolsButtonTab(dispatch, {buttonTab}),
- onLicenseKeyGroupsButtonTabSelect: buttonTab => FeatureGroupsActionHelper.selectFeatureGroupsEditorLicenseKeyGroupsButtonTab(dispatch, {buttonTab}),
- onDataChanged: deltaData => FeatureGroupsActionHelper.featureGroupsEditorDataChanged(dispatch, {deltaData}),
onSubmit: (previousFeatureGroup, featureGroup) => {
FeatureGroupsActionHelper.closeFeatureGroupsEditor(dispatch);
- FeatureGroupsActionHelper.saveFeatureGroup(dispatch, {licenseModelId, previousFeatureGroup, featureGroup});
- }
+ FeatureGroupsActionHelper.saveFeatureGroup(dispatch, {licenseModelId, previousFeatureGroup, featureGroup, version});
+ },
+ onCancel: () => FeatureGroupsActionHelper.closeFeatureGroupsEditor(dispatch),
+ onValidateForm: (formName) => ValidationHelper.validateForm(dispatch, formName)
};
};
export default connect(mapStateToProps, mapActionsToProps)(FeatureGroupEditorView);
-
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 6fecd16b71..5ae22cba95 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupEditorView.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupEditorView.jsx
@@ -1,27 +1,125 @@
+/*!
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
import React from 'react';
-import ValidationTabs from 'nfvo-components/input/validation/ValidationTabs.jsx';
-import ValidationTab from 'nfvo-components/input/validation/ValidationTab.jsx';
-import ButtonGroup from 'react-bootstrap/lib/ButtonGroup.js';
-import Button from 'react-bootstrap/lib/Button.js';
-
-import ValidationForm from 'nfvo-components/input/validation/ValidationForm.jsx';
+import Tabs from 'nfvo-components/input/validation/Tabs.jsx';
+import Tab from 'react-bootstrap/lib/Tab.js';
+import GridSection from 'nfvo-components/grid/GridSection.jsx';
+import GridItem from 'nfvo-components/grid/GridItem.jsx';
+import Form from 'nfvo-components/input/validation/Form.jsx';
import DualListboxView from 'nfvo-components/input/dualListbox/DualListboxView.jsx';
-import ValidationInput from 'nfvo-components/input/validation/ValidationInput.jsx';
-import ListEditorView from 'nfvo-components/listEditor/ListEditorView.jsx';
-import ListEditorViewItem from 'nfvo-components/listEditor/ListEditorItemView.jsx';
+import Input from 'nfvo-components/input/validation/Input.jsx';
import i18n from 'nfvo-utils/i18n/i18n.js';
+import Validator from 'nfvo-utils/Validator.js';
-import {state as FeatureGroupStateConstants} from './FeatureGroupsConstants.js';
+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,
- entitlementPoolsIds: React.PropTypes.array(React.PropTypes.string),
- licenseKeyGroupsIds: React.PropTypes.array(React.PropTypes.string)
+ entitlementPoolsIds: React.PropTypes.arrayOf(React.PropTypes.string),
+ licenseKeyGroupsIds: React.PropTypes.arrayOf(React.PropTypes.string)
});
+const GeneralTab = ({data = {}, onDataChanged, genericFieldInfo, validateName}) => {
+ let {name, description, partNumber} = data;
+ return (
+ <GridSection>
+ <GridItem colSpan={2}>
+ <Input
+ groupClassName='field-section'
+ onChange={name => onDataChanged({name}, FG_EDITOR_FORM, {name: validateName})}
+ label={i18n('Name')}
+ data-test-id='create-fg-name'
+ value={name}
+ name='feature-group-name'
+ type='text'
+ isRequired={true}
+ isValid={genericFieldInfo.name.isValid}
+ errorText={genericFieldInfo.name.errorText} />
+ <Input
+ groupClassName='field-section'
+ className='description-field'
+ onChange={description => onDataChanged({description}, FG_EDITOR_FORM)}
+ data-test-id='create-fg-description'
+ label={i18n('Description')}
+ value={description}
+ name='feature-group-description'
+ type='textarea'
+ isRequired={true}
+ isValid={genericFieldInfo.description.isValid}
+ errorText={genericFieldInfo.description.errorText} />
+ <Input
+ groupClassName='field-section'
+ onChange={partNumber => onDataChanged({partNumber}, FG_EDITOR_FORM)}
+ label={i18n('Part Number')}
+ data-test-id='create-fg-part-number'
+ value={partNumber}
+ isRequired={true}
+ type='text'
+ isValid={genericFieldInfo.partNumber.isValid}
+ errorText={genericFieldInfo.partNumber.errorText} />
+ </GridItem>
+ </GridSection>
+ );
+};
+
+const EntitlementPoolsTab = ({entitlementPoolsList, data, onDataChanged, isReadOnlyMode}) => {
+ const dualBoxFilterTitle = {
+ left: i18n('Available Entitlement Pools'),
+ right: i18n('Selected Entitlement Pools')
+ };
+ if (entitlementPoolsList.length > 0) {
+ return (
+ <DualListboxView
+ isReadOnlyMode={isReadOnlyMode}
+ filterTitle={dualBoxFilterTitle}
+ selectedValuesList={data.entitlementPoolsIds}
+ availableList={entitlementPoolsList}
+ onChange={ selectedValuesList => onDataChanged( { entitlementPoolsIds: selectedValuesList }, FG_EDITOR_FORM )}/>
+ );
+ } else {
+ return (
+ <p>{i18n('There is no available entitlement pools')}</p>
+ );
+ }
+};
+
+const LKGTab = ({licenseKeyGroupsList, data, onDataChanged, isReadOnlyMode}) => {
+ const dualBoxFilterTitle = {
+ left: i18n('Available License Key Groups'),
+ right: i18n('Selected License Key Groups')
+ };
+ if (licenseKeyGroupsList.length > 0) {
+ return (
+ <DualListboxView
+ isReadOnlyMode={isReadOnlyMode}
+ filterTitle={dualBoxFilterTitle}
+ selectedValuesList={data.licenseKeyGroupsIds}
+ availableList={licenseKeyGroupsList}
+ onChange={ selectedValuesList => onDataChanged( { licenseKeyGroupsIds: selectedValuesList }, FG_EDITOR_FORM )}/>
+ );
+ } else {
+ return (
+ <p>{i18n('There is no available licsense key groups')}</p>
+ );
+ }
+};
+
class FeatureGroupEditorView extends React.Component {
@@ -29,6 +127,7 @@ class FeatureGroupEditorView extends React.Component {
data: FeatureGroupsPropType,
previousData: FeatureGroupsPropType,
isReadOnlyMode: React.PropTypes.bool,
+ FGNames: React.PropTypes.object,
onSubmit: React.PropTypes.func,
onCancel: React.PropTypes.func,
@@ -36,11 +135,6 @@ class FeatureGroupEditorView extends React.Component {
selectedTab: React.PropTypes.number,
onTabSelect: React.PropTypes.func,
- selectedEntitlementPoolsButtonTab: React.PropTypes.number,
- selectedLicenseKeyGroupsButtonTab: React.PropTypes.number,
- onEntitlementPoolsButtonTabSelect: React.PropTypes.func,
- onLicenseKeyGroupsButtonTabSelect: React.PropTypes.func,
-
entitlementPoolsList: DualListboxView.propTypes.availableList,
licenseKeyGroupsList: DualListboxView.propTypes.availableList
};
@@ -49,8 +143,6 @@ class FeatureGroupEditorView extends React.Component {
static defaultProps = {
data: {},
selectedTab: FeatureGroupStateConstants.SELECTED_FEATURE_GROUP_TAB.GENERAL,
- selectedEntitlementPoolsButtonTab: FeatureGroupStateConstants.SELECTED_ENTITLEMENT_POOLS_BUTTONTAB.ASSOCIATED_ENTITLEMENT_POOLS,
- selectedLicenseKeyGroupsButtonTab: FeatureGroupStateConstants.SELECTED_LICENSE_KEY_GROUPS_BUTTONTAB.ASSOCIATED_LICENSE_KEY_GROUPS
};
state = {
@@ -60,24 +152,39 @@ class FeatureGroupEditorView extends React.Component {
render() {
- let {selectedTab, onTabSelect, isReadOnlyMode} = this.props;
+ let {selectedTab, onTabSelect, isReadOnlyMode, invalidTabs, data, onDataChanged, genericFieldInfo, entitlementPoolsList, licenseKeyGroupsList} = this.props;
return (
- <ValidationForm
+ <div>
+ { genericFieldInfo && <Form
ref='validationForm'
hasButtons={true}
onSubmit={ () => this.submit() }
+ isValid={this.props.isFormValid}
+ formReady={this.props.formReady}
+ onValidateForm={() => this.props.onValidateForm(FG_EDITOR_FORM) }
onReset={ () => this.props.onCancel() }
labledButtons={true}
isReadOnlyMode={isReadOnlyMode}
name='feature-group-validation-form'
className='feature-group-form'>
- <ValidationTabs activeKey={onTabSelect ? selectedTab : undefined} onSelect={onTabSelect}>
- {this.renderGeneralTab()}
- {this.renderEntitlementPoolsTab()}
- {this.renderLicenseKeyGroupsTab()}
- </ValidationTabs>
-
- </ValidationForm>
+ <Tabs activeKey={onTabSelect ? selectedTab : undefined} onSelect={onTabSelect} invalidTabs={invalidTabs} id='vlmFGValTabs' >
+ <Tab eventKey={FeatureGroupStateConstants.SELECTED_FEATURE_GROUP_TAB.GENERAL} title={i18n('General')} >
+ <GeneralTab data={data} onDataChanged={onDataChanged} genericFieldInfo={genericFieldInfo} validateName={(value)=> this.validateName(value)}/>
+ </Tab>
+ <Tab
+ eventKey={FeatureGroupStateConstants.SELECTED_FEATURE_GROUP_TAB.ENTITLEMENT_POOLS}
+ title={i18n('Entitlement Pools')} >
+ <EntitlementPoolsTab isReadOnlyMode={isReadOnlyMode} data={data} onDataChanged={onDataChanged} entitlementPoolsList={entitlementPoolsList} />
+ </Tab>
+ <Tab
+ eventKey={FeatureGroupStateConstants.SELECTED_FEATURE_GROUP_TAB.LICENSE_KEY_GROUPS}
+ title={i18n('License Key Groups')} >
+ <LKGTab isReadOnlyMode={isReadOnlyMode} data={data} onDataChanged={onDataChanged} licenseKeyGroupsList={licenseKeyGroupsList} />
+ </Tab>
+ </Tabs>
+
+ </Form> }
+ </div>
);
}
@@ -86,254 +193,14 @@ class FeatureGroupEditorView extends React.Component {
this.props.onSubmit(previousFeatureGroup, featureGroup);
}
- renderGeneralTab() {
- let {data = {}, onDataChanged} = this.props;
- let {name, description, partNumber} = data;
- return (
- <ValidationTab eventKey={FeatureGroupStateConstants.SELECTED_FEATURE_GROUP_TAB.GENERAL} title={i18n('General')}>
- <div>
- <ValidationInput
- groupClassName='field-section'
- onChange={name => onDataChanged({name})}
- ref='name'
- label={i18n('Name')}
- value={name}
- name='feature-group-name'
- validations={{maxLength: 120, required: true}}
- type='text'/>
- <ValidationInput
- groupClassName='field-section'
- className='description-field'
- onChange={description => onDataChanged({description})}
- ref='description'
- label={i18n('Description')}
- value={description}
- name='feature-group-description'
- validations={{maxLength: 1000, required: true}}
- type='textarea'/>
- <ValidationInput
- groupClassName='field-section'
- onChange={partNumber => onDataChanged({partNumber})}
- label={i18n('Part Number')}
- value={partNumber}
- validations={{required: true}}
- type='text'/>
- </div>
- </ValidationTab>
- );
- }
-
- renderEntitlementPoolsTab() {
- let {selectedEntitlementPoolsButtonTab, onEntitlementPoolsButtonTabSelect, entitlementPoolsList} = this.props;
- if (entitlementPoolsList.length > 0) {
- return (
- <ValidationTab
- eventKey={FeatureGroupStateConstants.SELECTED_FEATURE_GROUP_TAB.ENTITLEMENT_POOLS}
- title={i18n('Entitlement Pools')}>
- <ButtonGroup>
- {
- this.renderButtonsTab(
- FeatureGroupStateConstants.SELECTED_ENTITLEMENT_POOLS_BUTTONTAB.ASSOCIATED_ENTITLEMENT_POOLS,
- selectedEntitlementPoolsButtonTab,
- i18n('Associated Entitlement Pools'),
- onEntitlementPoolsButtonTabSelect
- )
- }
- {
- this.renderButtonsTab(
- FeatureGroupStateConstants.SELECTED_ENTITLEMENT_POOLS_BUTTONTAB.AVAILABLE_ENTITLEMENT_POOLS,
- selectedEntitlementPoolsButtonTab,
- i18n('Available Entitlement Pools'),
- onEntitlementPoolsButtonTabSelect
- )
- }
- </ButtonGroup>
- {this.renderEntitlementPoolsButtonTabContent(selectedEntitlementPoolsButtonTab)}
- </ValidationTab>
- );
- } else {
- return (
- <ValidationTab
- eventKey={FeatureGroupStateConstants.SELECTED_FEATURE_GROUP_TAB.ENTITLEMENT_POOLS}
- title={i18n('Entitlement Pools')}>
- <p>{i18n('There is no available entitlement pools.')}</p>
- </ValidationTab>
- );
- }
- }
-
- renderLicenseKeyGroupsTab() {
- let {selectedLicenseKeyGroupsButtonTab, onLicenseKeyGroupsButtonTabSelect, licenseKeyGroupsList} = this.props;
- if (licenseKeyGroupsList.length > 0) {
- return (
- <ValidationTab
- eventKey={FeatureGroupStateConstants.SELECTED_FEATURE_GROUP_TAB.LICENCE_KEY_GROUPS}
- title={i18n('License Key Groups')}>
- <ButtonGroup>
- {
- this.renderButtonsTab(
- FeatureGroupStateConstants.SELECTED_LICENSE_KEY_GROUPS_BUTTONTAB.ASSOCIATED_LICENSE_KEY_GROUPS,
- selectedLicenseKeyGroupsButtonTab,
- i18n('Associated License Key Groups'),
- onLicenseKeyGroupsButtonTabSelect
- )
- }
- {
- this.renderButtonsTab(
- FeatureGroupStateConstants.SELECTED_LICENSE_KEY_GROUPS_BUTTONTAB.AVAILABLE_LICENSE_KEY_GROUPS,
- selectedLicenseKeyGroupsButtonTab,
- i18n('Available License Key Groups'),
- onLicenseKeyGroupsButtonTabSelect
- )
- }
- </ButtonGroup>
- {this.renderLicenseKeyGroupsTabContent(selectedLicenseKeyGroupsButtonTab)}
- </ValidationTab>
- );
- } else {
- return (
- <ValidationTab
- eventKey={FeatureGroupStateConstants.SELECTED_FEATURE_GROUP_TAB.LICENCE_KEY_GROUPS}
- title={i18n('License Key Groups')}>
- <p>{i18n('There is no available license key groups')}</p>
- </ValidationTab>);
- }
- }
-
- renderButtonsTab(buttonTab, selectedButtonTab, title, onClick) {
- const isSelected = buttonTab === selectedButtonTab;
- return (
- <Button
- className='button-tab'
- active={isSelected}
- onClick={() => !isSelected && onClick(buttonTab)}>
- { title }
- </Button>
- );
- }
-
- renderEntitlementPoolsButtonTabContent(selectedFeatureGroupsButtonTab) {
- const {entitlementPoolsList = [], data: {entitlementPoolsIds = []}} = this.props;
- let dualBoxTitle = {
- left: i18n('Available Entitlement Pools'),
- right: i18n('Selected Entitlement Pools')
- };
-
- if (entitlementPoolsList.length) {
- const {localEntitlementPoolsListFilter} = this.state;
- let selectedEntitlementPools = entitlementPoolsIds.map(entitlementPoolId => entitlementPoolsList.find(entitlementPool => entitlementPool.id === entitlementPoolId));
-
- switch (selectedFeatureGroupsButtonTab) {
- case FeatureGroupStateConstants.SELECTED_ENTITLEMENT_POOLS_BUTTONTAB.ASSOCIATED_ENTITLEMENT_POOLS:
- if (selectedEntitlementPools.length) {
- return (
- <ListEditorView
- className='thinner-list'
- filterValue={localEntitlementPoolsListFilter}
- onFilter={localEntitlementPoolsListFilter => this.setState({localEntitlementPoolsListFilter})}>
- {this.filterAssociatedItems(selectedEntitlementPools, localEntitlementPoolsListFilter)
- .map(entitlementPool => this.renderAssociatedListItem(entitlementPool
- , FeatureGroupStateConstants.SELECTED_FEATURE_GROUP_TAB.ENTITLEMENT_POOLS))}
- </ListEditorView>
- );
- }
- else {
- return (
- <div>
- <br/>{i18n('There are currently no entitlement pools associated with this feature group. Click "Available Entitlement Pools" to associate.')}
- </div>
- );
- }
- case FeatureGroupStateConstants.SELECTED_ENTITLEMENT_POOLS_BUTTONTAB.AVAILABLE_ENTITLEMENT_POOLS:
- return (
- <DualListboxView
- filterTitle={dualBoxTitle}
- selectedValuesList={entitlementPoolsIds}
- availableList={entitlementPoolsList}
- onChange={ selectedValuesList => this.props.onDataChanged( { entitlementPoolsIds: selectedValuesList } )}/>
- );
- }
- }
- }
-
- renderLicenseKeyGroupsTabContent(selectedFeatureGroupsButtonTab) {
- const {licenseKeyGroupsList = [], data: {licenseKeyGroupsIds = []}} = this.props;
- let dualBoxFilterTitle = {
- left: i18n('Available License Key Groups'),
- right: i18n('Selected License Key Groups')
- };
-
- if (licenseKeyGroupsList.length) {
- const {localLicenseKeyGroupsListFilter} = this.state;
- let selectedLicenseKeyGroups = licenseKeyGroupsIds.map(licenseKeyGroupId => licenseKeyGroupsList.find(licenseKeyGroup => licenseKeyGroup.id === licenseKeyGroupId));
-
- switch (selectedFeatureGroupsButtonTab) {
- case FeatureGroupStateConstants.SELECTED_LICENSE_KEY_GROUPS_BUTTONTAB.ASSOCIATED_LICENSE_KEY_GROUPS:
- if (selectedLicenseKeyGroups.length) {
- return (
- <ListEditorView
- className='thinner-list'
- filterValue={localLicenseKeyGroupsListFilter}
- onFilter={localLicenseKeyGroupsListFilter => this.setState({localLicenseKeyGroupsListFilter})}>
- {this.filterAssociatedItems(selectedLicenseKeyGroups, localLicenseKeyGroupsListFilter)
- .map(licenseKeyGroup => this.renderAssociatedListItem(licenseKeyGroup
- , FeatureGroupStateConstants.SELECTED_FEATURE_GROUP_TAB.LICENCE_KEY_GROUPS))}
- </ListEditorView>
- );
- } else {
- return (
- <div className='no-items-msg'>
- {i18n('There are currently no license key groups associated with this feature group. Click "Available License Key Groups" to associate.')}
- </div>
- );
- }
- case FeatureGroupStateConstants.SELECTED_LICENSE_KEY_GROUPS_BUTTONTAB.AVAILABLE_LICENSE_KEY_GROUPS:
- return (
- <DualListboxView
- filterTitle={dualBoxFilterTitle}
- selectedValuesList={this.props.data.licenseKeyGroupsIds}
- availableList={this.props.licenseKeyGroupsList}
- onChange={ selectedValuesList => this.props.onDataChanged( { licenseKeyGroupsIds: selectedValuesList } )}/>
- );
- }
- }
- }
-
-
- renderAssociatedListItem(listItem, itemType) {
- let {isReadOnlyMode} = this.props;
- return (
- <ListEditorViewItem
- key={listItem.id}
- onDelete={() => this.deleteAssociatedItem(listItem.id, itemType)}
- isReadOnlyMode={isReadOnlyMode}>
- <div className='name'>{listItem.name}</div>
- <div className='description'>{listItem.description}</div>
- </ListEditorViewItem>
- );
- }
-
- filterAssociatedItems(list, localList) {
- if (localList) {
- const filter = new RegExp(escape(localList), 'i');
- return list.filter(({name = '', description = ''}) => name.match(filter) || description.match(filter));
- }
- else {
- return list;
- }
- }
-
- deleteAssociatedItem(id, type) {
- const {data: {licenseKeyGroupsIds = [], entitlementPoolsIds = []}} = this.props;
- if (type === FeatureGroupStateConstants.SELECTED_FEATURE_GROUP_TAB.LICENCE_KEY_GROUPS) {
- this.props.onDataChanged({licenseKeyGroupsIds: licenseKeyGroupsIds.filter(listId => listId !== id)});
- } else {
- this.props.onDataChanged({entitlementPoolsIds: entitlementPoolsIds.filter(listId => listId !== id)});
- }
+ validateName(value) {
+ const {data: {id}, FGNames} = this.props;
+ const isExists = Validator.isItemNameAlreadyExistsInList({itemId: id, itemName: value, list: FGNames});
+ return !isExists ? {isValid: true, errorText: ''} :
+ {isValid: false, errorText: i18n('Feature group by the name \'' + value + '\' already exists. Feature group name must be unique')};
}
}
export default FeatureGroupEditorView;
-
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 9ea5a31490..83473a30bb 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupListEditor.js
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupListEditor.js
@@ -1,35 +1,33 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
+/*!
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
*/
-
import {connect} from 'react-redux';
+
import FeatureGroupsActionHelper from './FeatureGroupsActionHelper.js';
-import FeatureGroupListEditorView from './FeatureGroupListEditorView.jsx';
+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';
-const mapStateToProps = ({licenseModel: {featureGroup, licenseModelEditor}}) => {
+export const mapStateToProps = ({licenseModel: {featureGroup, licenseModelEditor}}) => {
const {featureGroupEditor: {data}, featureGroupsList} = featureGroup;
- let {vendorName} = licenseModelEditor.data;
+ let {vendorName, version} = licenseModelEditor.data;
let isReadOnlyMode = VersionControllerUtils.isReadOnly(licenseModelEditor.data);
-
return {
vendorName,
+ version,
featureGroupsModal: {
show: Boolean(data),
editMode: Boolean(data && data.id)
@@ -42,13 +40,19 @@ const mapStateToProps = ({licenseModel: {featureGroup, licenseModelEditor}}) =>
const mapActionsToProps = (dispatch, {licenseModelId}) => {
return {
- onDeleteFeatureGroupClick: (featureGroup) => FeatureGroupsActionHelper.openDeleteFeatureGroupConfirm(dispatch, {licenseModelId, featureGroup}),
- onCancelFeatureGroupsEditor: () => FeatureGroupsActionHelper.closeFeatureGroupsEditor(dispatch),
-
- onAddFeatureGroupClick: () => FeatureGroupsActionHelper.openFeatureGroupsEditor(dispatch, {licenseModelId}),
- onEditFeatureGroupClick: featureGroup => FeatureGroupsActionHelper.openFeatureGroupsEditor(dispatch, {
+ onDeleteFeatureGroupClick: (featureGroup, version) => dispatch({
+ type: globalMoadlActions.GLOBAL_MODAL_WARNING,
+ data:{
+ msg: generateConfirmationMsg(featureGroup),
+ title: i18n('Warning'),
+ onConfirmed: ()=>FeatureGroupsActionHelper.deleteFeatureGroup(dispatch, {featureGroupId: featureGroup.id, licenseModelId, version})
+ }
+ }),
+ onAddFeatureGroupClick: (actualVersion) => FeatureGroupsActionHelper.openFeatureGroupsEditor(dispatch, {licenseModelId, version: actualVersion}),
+ onEditFeatureGroupClick: (featureGroup, actualVersion) => FeatureGroupsActionHelper.openFeatureGroupsEditor(dispatch, {
featureGroup,
- licenseModelId
+ licenseModelId,
+ version: actualVersion
})
};
};
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 d998f9216f..bc0f5c71c0 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupListEditorView.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupListEditorView.jsx
@@ -1,3 +1,18 @@
+/*!
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
import React from 'react';
import i18n from 'nfvo-utils/i18n/i18n.js';
@@ -6,7 +21,6 @@ import ListEditorView from 'nfvo-components/listEditor/ListEditorView.jsx';
import ListEditorItemView from 'nfvo-components/listEditor/ListEditorItemView.jsx';
import FeatureGroupEditor from './FeatureGroupEditor.js';
-import FeatureGroupsConfirmationModal from './FeatureGroupsConfirmationModal.jsx';
class FeatureGroupListEditorView extends React.Component {
static propTypes = {
@@ -37,46 +51,45 @@ class FeatureGroupListEditorView extends React.Component {
};
render() {
- let {vendorName, licenseModelId, featureGroupsModal, isReadOnlyMode, onAddFeatureGroupClick} = this.props;
+ let {vendorName, licenseModelId, featureGroupsModal, isReadOnlyMode, onAddFeatureGroupClick, version} = this.props;
const {localFilter} = this.state;
-
return (
<div className='feature-groups-list-editor'>
<ListEditorView
- title={i18n('Feature Groups for {vendorName} License Model', {vendorName})}
+ title={i18n('Feature Groups', {vendorName})}
plusButtonTitle={i18n('Add Feature Group')}
filterValue={localFilter}
- onFilter={filter => this.setState({localFilter: filter})}
- onAdd={() => onAddFeatureGroupClick()}
+ onFilter={value => this.setState({localFilter: value})}
+ onAdd={() => onAddFeatureGroupClick(version)}
isReadOnlyMode={isReadOnlyMode}>
- {this.filterList().map(listItem => this.renderFeatureGroupListItem(listItem, isReadOnlyMode))}
+ {this.filterList().map(listItem => this.renderFeatureGroupListItem(listItem, isReadOnlyMode, version))}
</ListEditorView>
- <Modal show={featureGroupsModal.show} bsSize='large' animation={true} className='feature-group-modal'>
- <Modal.Header>
- <Modal.Title>{`${featureGroupsModal.editMode ? i18n('Edit Feature Group') : i18n('Create New Feature Group')}`}</Modal.Title>
- </Modal.Header>
- <Modal.Body>
- <FeatureGroupEditor
- onCancel={() => this.closeFeatureGroupsEditor()}
- licenseModelId={licenseModelId}
- isReadOnlyMode={isReadOnlyMode}/>
- </Modal.Body>
- </Modal>
-
- <FeatureGroupsConfirmationModal licenseModelId={licenseModelId}/>
+ {featureGroupsModal.show && <Modal show={featureGroupsModal.show} bsSize='large' animation={true}
+ className='onborading-modal feature-group-modal'>
+ <Modal.Header>
+ <Modal.Title>{`${featureGroupsModal.editMode ? i18n('Edit Feature Group') : i18n('Create New Feature Group')}`}</Modal.Title>
+ </Modal.Header>
+ <Modal.Body>
+ <FeatureGroupEditor
+ version={version}
+ licenseModelId={licenseModelId}
+ isReadOnlyMode={isReadOnlyMode}/>
+ </Modal.Body>
+ </Modal>
+ }
</div>
);
}
- renderFeatureGroupListItem(listItem, isReadOnlyMode) {
+ renderFeatureGroupListItem(listItem, isReadOnlyMode, version) {
let {name, description, entitlementPoolsIds = [], licenseKeyGroupsIds = []} = listItem;
return (
<ListEditorItemView
key={listItem.id}
- onDelete={() => this.deleteFeatureGroupItem(listItem)}
- onSelect={() => this.editFeatureGroupItem(listItem)}
+ onDelete={() => this.deleteFeatureGroupItem(listItem, version)}
+ onSelect={() => this.editFeatureGroupItem(listItem, version)}
className='list-editor-item-view'
isReadOnlyMode={isReadOnlyMode}>
<div className='list-editor-item-view-field'>
@@ -120,17 +133,28 @@ class FeatureGroupListEditorView extends React.Component {
}
}
- closeFeatureGroupsEditor() {
- this.props.onCancelFeatureGroupsEditor();
- }
-
- editFeatureGroupItem(featureGroup) {
- this.props.onEditFeatureGroupClick(featureGroup);
+ editFeatureGroupItem(featureGroup, version) {
+ this.props.onEditFeatureGroupClick(featureGroup, version);
}
- deleteFeatureGroupItem(featureGroup) {
- this.props.onDeleteFeatureGroupClick(featureGroup);
+ deleteFeatureGroupItem(featureGroup, version) {
+ this.props.onDeleteFeatureGroupClick(featureGroup, version);
}
}
export default FeatureGroupListEditorView;
+
+export function generateConfirmationMsg(featureGroupToDelete) {
+ let name = featureGroupToDelete ? featureGroupToDelete.name : '';
+ let msg = i18n('Are you sure you want to delete "{name}"?', {name});
+ let subMsg = featureGroupToDelete.referencingLicenseAgreements
+ && featureGroupToDelete.referencingLicenseAgreements.length > 0 ?
+ i18n('This feature group is associated with one ore more license agreements') :
+ '';
+ return (
+ <div>
+ <p>{msg}</p>
+ <p>{subMsg}</p>
+ </div>
+ );
+}
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 3776c01263..a2015787a6 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsActionHelper.js
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsActionHelper.js
@@ -1,23 +1,18 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
+/*!
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
*/
-
import RestAPIUtil from 'nfvo-utils/RestAPIUtil.js';
import Configuration from 'sdc-app/config/Configuration.js';
import {actionTypes as featureGroupsActionConstants} from './FeatureGroupsConstants.js';
@@ -25,22 +20,22 @@ import LicenseModelActionHelper from 'sdc-app/onboarding/licenseModel/LicenseMod
import EntitlementPoolsActionHelper from 'sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsActionHelper.js';
import LicenseKeyGroupsActionHelper from 'sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsActionHelper.js';
-function baseUrl(licenseModelId) {
+function baseUrl(licenseModelId, version) {
const restPrefix = Configuration.get('restPrefix');
- return `${restPrefix}/v1.0/vendor-license-models/${licenseModelId}/feature-groups`;
+ const {id: versionId} = version;
+ return `${restPrefix}/v1.0/vendor-license-models/${licenseModelId}/versions/${versionId}/feature-groups`;
}
function fetchFeatureGroupsList(licenseModelId, version) {
- let versionQuery = version ? `?version=${version}` : '';
- return RestAPIUtil.fetch(`${baseUrl(licenseModelId)}${versionQuery}`);
+ return RestAPIUtil.fetch(`${baseUrl(licenseModelId, version)}`);
}
-function deleteFeatureGroup(licenseModelId, featureGroupId) {
- return RestAPIUtil.destroy(`${baseUrl(licenseModelId)}/${featureGroupId}`);
+function deleteFeatureGroup(licenseModelId, featureGroupId, version) {
+ return RestAPIUtil.destroy(`${baseUrl(licenseModelId, version)}/${featureGroupId}`);
}
-function addFeatureGroup(licenseModelId, featureGroup) {
- return RestAPIUtil.create(baseUrl(licenseModelId), {
+function addFeatureGroup(licenseModelId, featureGroup, version) {
+ return RestAPIUtil.post(baseUrl(licenseModelId, version), {
name: featureGroup.name,
description: featureGroup.description,
partNumber: featureGroup.partNumber,
@@ -49,13 +44,13 @@ function addFeatureGroup(licenseModelId, featureGroup) {
});
}
-function updateFeatureGroup(licenseModelId, previousFeatureGroup, featureGroup) {
+function updateFeatureGroup(licenseModelId, previousFeatureGroup, featureGroup, version) {
const {licenseKeyGroupsIds = []} = featureGroup;
const {licenseKeyGroupsIds: prevLicenseKeyGroupsIds = []} = previousFeatureGroup;
const {entitlementPoolsIds = []} = featureGroup;
const {entitlementPoolsIds: prevEntitlementPoolsIds = []} = previousFeatureGroup;
- return RestAPIUtil.save(`${baseUrl(licenseModelId)}/${featureGroup.id}`, {
+ return RestAPIUtil.put(`${baseUrl(licenseModelId, version)}/${featureGroup.id}`, {
name: featureGroup.name,
description: featureGroup.description,
partNumber: featureGroup.partNumber,
@@ -75,28 +70,37 @@ export default {
}));
},
- deleteFeatureGroup(dispatch, {licenseModelId, featureGroupId}) {
- return deleteFeatureGroup(licenseModelId, featureGroupId).then(() => dispatch({
+ deleteFeatureGroup(dispatch, {licenseModelId, featureGroupId, version}) {
+ return deleteFeatureGroup(licenseModelId, featureGroupId, version).then(() => dispatch({
type: featureGroupsActionConstants.DELETE_FEATURE_GROUPS,
featureGroupId
}));
},
- saveFeatureGroup(dispatch, {licenseModelId, previousFeatureGroup, featureGroup}) {
+ saveFeatureGroup(dispatch, {licenseModelId, previousFeatureGroup, featureGroup, version}) {
if (previousFeatureGroup) {
- return updateFeatureGroup(licenseModelId, previousFeatureGroup, featureGroup).then(() => dispatch({
- type: featureGroupsActionConstants.EDIT_FEATURE_GROUPS,
- featureGroup
- }));
+ return updateFeatureGroup(licenseModelId, previousFeatureGroup, featureGroup, version).then(() =>{
+ dispatch({
+ type: featureGroupsActionConstants.EDIT_FEATURE_GROUPS,
+ featureGroup
+ });
+ EntitlementPoolsActionHelper.fetchEntitlementPoolsList(dispatch, {licenseModelId, version});
+ LicenseKeyGroupsActionHelper.fetchLicenseKeyGroupsList(dispatch, {licenseModelId, version});
+ });
}
else {
- return addFeatureGroup(licenseModelId, featureGroup).then(response => dispatch({
- type: featureGroupsActionConstants.ADD_FEATURE_GROUPS,
- featureGroup: {
- ...featureGroup,
- id: response.value
- }
- }));
+ return addFeatureGroup(licenseModelId, featureGroup, version).then(response => {
+ dispatch({
+ type: featureGroupsActionConstants.ADD_FEATURE_GROUPS,
+ featureGroup: {
+ ...featureGroup,
+ id: response.value,
+ referencingLicenseAgreements: []
+ }
+ });
+ EntitlementPoolsActionHelper.fetchEntitlementPoolsList(dispatch, {licenseModelId, version});
+ LicenseKeyGroupsActionHelper.fetchLicenseKeyGroupsList(dispatch, {licenseModelId, version});
+ });
}
},
@@ -107,23 +111,9 @@ export default {
});
},
- selectFeatureGroupsEditorEntitlementPoolsButtonTab(dispatch, {buttonTab}) {
- dispatch({
- type: featureGroupsActionConstants.featureGroupsEditor.SELECTED_ENTITLEMENT_POOLS_BUTTONTAB,
- buttonTab
- });
- },
-
- selectFeatureGroupsEditorLicenseKeyGroupsButtonTab(dispatch, {buttonTab}) {
- dispatch({
- type: featureGroupsActionConstants.featureGroupsEditor.SELECTED_LICENSE_KEY_GROUPS_BUTTONTAB,
- buttonTab
- });
- },
-
- openFeatureGroupsEditor(dispatch, {featureGroup, licenseModelId}) {
- EntitlementPoolsActionHelper.fetchEntitlementPoolsList(dispatch, {licenseModelId});
- LicenseKeyGroupsActionHelper.fetchLicenseKeyGroupsList(dispatch, {licenseModelId});
+ openFeatureGroupsEditor(dispatch, {featureGroup, licenseModelId, version}) {
+ EntitlementPoolsActionHelper.fetchEntitlementPoolsList(dispatch, {licenseModelId, version});
+ LicenseKeyGroupsActionHelper.fetchLicenseKeyGroupsList(dispatch, {licenseModelId, version});
dispatch({
type: featureGroupsActionConstants.featureGroupsEditor.OPEN,
featureGroup
@@ -136,26 +126,6 @@ export default {
});
},
- featureGroupsEditorDataChanged(dispatch, {deltaData}) {
- dispatch({
- type: featureGroupsActionConstants.featureGroupsEditor.DATA_CHANGED,
- deltaData
- });
- },
-
- hideDeleteConfirm(dispatch) {
- dispatch({
- type: featureGroupsActionConstants.FEATURE_GROUPS_DELETE_CONFIRM,
- featureGroupToDelete: false
- });
- },
-
- openDeleteFeatureGroupConfirm(dispatch, {featureGroup}) {
- dispatch({
- type: featureGroupsActionConstants.FEATURE_GROUPS_DELETE_CONFIRM,
- featureGroupToDelete: featureGroup
- });
- },
switchVersion(dispatch, {licenseModelId, version}) {
LicenseModelActionHelper.fetchLicenseModelById(dispatch, {licenseModelId, version}).then(() => {
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsConfirmationModal.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsConfirmationModal.jsx
deleted file mode 100644
index 142ec3c4c8..0000000000
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsConfirmationModal.jsx
+++ /dev/null
@@ -1,48 +0,0 @@
-import React from 'react';
-import {connect} from 'react-redux';
-import ConfirmationModalView from 'nfvo-components/confirmations/ConfirmationModalView.jsx';
-import FeatureGroupsActionHelper from './FeatureGroupsActionHelper.js';
-import i18n from 'nfvo-utils/i18n/i18n.js';
-
-function renderMsg(featureGroupToDelete) {
- let name = featureGroupToDelete ? featureGroupToDelete.name : '';
- let msg = i18n('Are you sure you want to delete "{name}"?', {name});
- let subMsg = featureGroupToDelete
- && featureGroupToDelete.referencingLicenseAgreements
- && featureGroupToDelete.referencingLicenseAgreements.length > 0 ?
- i18n('This feature group is associated with one ore more license agreements') :
- '';
- return (
- <div>
- <p>{msg}</p>
- <p>{subMsg}</p>
- </div>
- );
-};
-
-const mapStateToProps = ({licenseModel: {featureGroup}}, {licenseModelId}) => {
- let {featureGroupToDelete} = featureGroup;
- const show = featureGroupToDelete !== false;
- return {
- show,
- title: 'Warning!',
- type: 'warning',
- msg: renderMsg(featureGroupToDelete),
- confirmationDetails: {featureGroupToDelete, licenseModelId}
- };
-};
-
-const mapActionsToProps = (dispatch) => {
- return {
- onConfirmed: ({featureGroupToDelete, licenseModelId}) => {
- FeatureGroupsActionHelper.deleteFeatureGroup(dispatch, {featureGroupId: featureGroupToDelete.id, licenseModelId});
- FeatureGroupsActionHelper.hideDeleteConfirm(dispatch);
- },
- onDeclined: () => {
- FeatureGroupsActionHelper.hideDeleteConfirm(dispatch);
- }
- };
-};
-
-export default connect(mapStateToProps, mapActionsToProps)(ConfirmationModalView);
-
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsConstants.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsConstants.js
index e02c54595d..4c5a94f239 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsConstants.js
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsConstants.js
@@ -1,23 +1,18 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
+/*!
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
*/
-
import keyMirror from 'nfvo-utils/KeyMirror.js';
export const actionTypes = keyMirror({
@@ -25,8 +20,6 @@ export const actionTypes = keyMirror({
ADD_FEATURE_GROUPS: null,
EDIT_FEATURE_GROUPS: null,
DELETE_FEATURE_GROUPS: null,
- FEATURE_GROUPS_DELETE_CONFIRM: null,
-
ENTITLEMENT_POOLS_LIST_LOADED: null,
@@ -34,27 +27,16 @@ export const actionTypes = keyMirror({
OPEN: null,
CLOSE: null,
DATA_CHANGED: null,
- SELECT_TAB: null,
- SELECTED_ENTITLEMENT_POOLS_BUTTONTAB: null,
- SELECTED_LICENSE_KEY_GROUPS_BUTTONTAB: null
+ SELECT_TAB: null
}
});
+export const FG_EDITOR_FORM = 'FG_EDITOR_FORM';
+
export const state = keyMirror({
SELECTED_FEATURE_GROUP_TAB: {
GENERAL: 1,
ENTITLEMENT_POOLS: 2,
- LICENCE_KEY_GROUPS: 3
- },
- SELECTED_ENTITLEMENT_POOLS_BUTTONTAB: {
- ASSOCIATED_ENTITLEMENT_POOLS: 1,
- AVAILABLE_ENTITLEMENT_POOLS: 2
- },
- SELECTED_LICENSE_KEY_GROUPS_BUTTONTAB: {
- ASSOCIATED_LICENSE_KEY_GROUPS: 1,
- AVAILABLE_LICENSE_KEY_GROUPS: 2
- },
+ LICENSE_KEY_GROUPS: 3
+ }
});
-
-
-
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsEditorReducer.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsEditorReducer.js
index 576a5358e6..001bd20d44 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsEditorReducer.js
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsEditorReducer.js
@@ -1,24 +1,20 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
+/*!
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
*/
-import {actionTypes} from './FeatureGroupsConstants.js';
+import {actionTypes, FG_EDITOR_FORM, state as FeatureGroupStateConstants} from './FeatureGroupsConstants.js';
@@ -27,14 +23,28 @@ export default (state = {}, action) => {
case actionTypes.featureGroupsEditor.OPEN:
return {
...state,
- data: action.featureGroup || {}
- };
- case actionTypes.featureGroupsEditor.DATA_CHANGED:
- return {
- ...state,
- data: {
- ...state.data,
- ...action.deltaData
+ data: action.featureGroup || {},
+ formReady: null,
+ formName: FG_EDITOR_FORM,
+ genericFieldInfo: {
+ 'description': {
+ isValid: true,
+ errorText: '',
+ validations: [{type: 'required', data: true}, {type: 'maxLength', data: 1000}],
+ tabId: FeatureGroupStateConstants.SELECTED_FEATURE_GROUP_TAB.GENERAL
+ },
+ 'partNumber': {
+ isValid: true,
+ errorText: '',
+ validations: [{type: 'required', data: true}],
+ tabId: FeatureGroupStateConstants.SELECTED_FEATURE_GROUP_TAB.GENERAL
+ },
+ 'name': {
+ isValid: true,
+ errorText: '',
+ validations: [{type: 'required', data: true}, {type: 'maxLength', data: 120}],
+ tabId: FeatureGroupStateConstants.SELECTED_FEATURE_GROUP_TAB.GENERAL
+ }
}
};
case actionTypes.featureGroupsEditor.CLOSE:
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsListReducer.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsListReducer.js
index 5cf3248919..3b5f1c55e4 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsListReducer.js
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsListReducer.js
@@ -1,23 +1,18 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
+/*!
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
*/
-
import {actionTypes} from './FeatureGroupsConstants.js';
export default (state = [], action) => {
switch (action.type) {