diff options
author | Einav Weiss Keidar <einavw@amdocs.com> | 2018-08-13 16:19:46 +0300 |
---|---|---|
committer | Avi Gaffa <avi.gaffa@amdocs.com> | 2019-02-11 13:50:22 +0000 |
commit | 1801b24389baa8e3f7298ff2c41e2512b19c1290 (patch) | |
tree | d3d2a15f53aa28698280d609548298d177f9280d /openecomp-ui/src/sdc-app/onboarding/licenseModel | |
parent | af8e36eb7f43803bd9cf40e9b46a0c0c8f47c781 (diff) |
react 16 upgrade
Issue-ID: SDC-1762
Change-Id: I7701f12fc63bb09f8c985c7c893b984701dcbfab
Signed-off-by: Einav Keidar <einavw@amdocs.com>
Diffstat (limited to 'openecomp-ui/src/sdc-app/onboarding/licenseModel')
23 files changed, 312 insertions, 337 deletions
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/components/ModalButtons.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/components/ModalButtons.jsx index 8f3347e65d..4fbbd1a8f0 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/components/ModalButtons.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/components/ModalButtons.jsx @@ -18,7 +18,6 @@ import React from 'react'; import PropTypes from 'prop-types'; import i18n from 'nfvo-utils/i18n/i18n.js'; import Button from 'sdc-ui/lib/react/Button.js'; -import GridSection from 'nfvo-components/grid/GridSection.jsx'; const ModalButtons = ({ isFormValid, @@ -28,7 +27,7 @@ const ModalButtons = ({ onCancel, className }) => ( - <GridSection className={`license-model-modal-buttons ${className}`}> + <div className={`${className}`}> {!selectedLimit && ( <Button btnType="primary" @@ -44,11 +43,11 @@ const ModalButtons = ({ type="reset"> {i18n('Cancel')} </Button> - </GridSection> + </div> ); ModalButtons.propTypes = { - isFormValid: PropTypes.func, + isFormValid: PropTypes.bool, isReadOnlyMode: PropTypes.bool, onSubmit: PropTypes.func, selectedLimit: PropTypes.string, diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/components/UuId.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/components/UuId.jsx index 2edfdaede5..66d50ca33f 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/components/UuId.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/components/UuId.jsx @@ -21,7 +21,7 @@ import i18n from 'nfvo-utils/i18n/i18n.js'; const UuidElement = ({ title, value }) => ( <div className="uuid-container"> <div className="uuid-title">{title}</div> - <div className="uuid-value" selectable> + <div className="uuid-value" selectable="true"> {value} </div> </div> 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 8c5d966938..be1a42c8a3 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/creation/LicenseModelCreationView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/creation/LicenseModelCreationView.jsx @@ -4,9 +4,9 @@ * 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. @@ -41,7 +41,7 @@ class LicenseModelCreationView extends React.Component { let { data = {}, onDataChanged, genericFieldInfo } = this.props; let { vendorName, description } = data; return ( - <div> + <div className="license-model-modal"> {genericFieldInfo && ( <Form ref="validationForm" @@ -52,6 +52,8 @@ class LicenseModelCreationView extends React.Component { labledButtons={true} isValid={this.props.isFormValid} formReady={this.props.formReady} + btnClassName="sdc-modal__footer" + className="license-model-form" onValidateForm={() => this.validate()}> <Input value={vendorName} @@ -70,7 +72,6 @@ class LicenseModelCreationView extends React.Component { errorText={genericFieldInfo.vendorName.errorText} type="text" isRequired={true} - className="field-section" /> <Input isRequired={true} @@ -87,7 +88,7 @@ class LicenseModelCreationView extends React.Component { isValid={genericFieldInfo.description.isValid} errorText={genericFieldInfo.description.errorText} type="textarea" - className="field-section" + groupClassName="no-bottom-margin" /> </Form> )} 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 ef705d67e4..dec7d9c3b8 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsActionHelper.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsActionHelper.js @@ -20,6 +20,12 @@ import { actionTypes as entitlementPoolsActionTypes } from './EntitlementPoolsCo 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'; +import i18n from 'nfvo-utils/i18n/i18n.js'; +import { + actionTypes as modalActionTypes, + modalSizes +} from 'nfvo-components/modal/GlobalModalConstants.js'; +import { modalContentMapper } from 'sdc-app/common/modal/ModalContentMapper.js'; function baseUrl(licenseModelId, version) { const restPrefix = Configuration.get('restPrefix'); @@ -137,9 +143,9 @@ const EntitlementPoolsActionHelper = { openEntitlementPoolsEditor( dispatch, - { entitlementPool, licenseModelId, version } = {} + { entitlementPool, licenseModelId, version, isReadOnlyMode } = {} ) { - if (licenseModelId && version) { + if (licenseModelId && version && entitlementPool) { this.fetchLimits(dispatch, { licenseModelId, version, @@ -150,6 +156,22 @@ const EntitlementPoolsActionHelper = { type: entitlementPoolsActionTypes.entitlementPoolsEditor.OPEN, entitlementPool }); + dispatch({ + type: modalActionTypes.GLOBAL_MODAL_SHOW, + data: { + modalComponentName: modalContentMapper.EP_EDITOR, + modalComponentProps: { + version, + licenseModelId, + isReadOnlyMode, + size: modalSizes.LARGE + }, + title: + licenseModelId && version && entitlementPool + ? i18n('Edit Entitlement Pool') + : i18n('Create New Entitlement Pool') + } + }); }, async deleteEntitlementPool( @@ -181,6 +203,9 @@ const EntitlementPoolsActionHelper = { dispatch({ type: entitlementPoolsActionTypes.entitlementPoolsEditor.CLOSE }); + dispatch({ + type: modalActionTypes.GLOBAL_MODAL_CLOSE + }); }, async saveEntitlementPool( 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 d5ca81cfac..d0e91e382b 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsEditorView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsEditorView.jsx @@ -46,12 +46,27 @@ const EntitlementPoolPropType = PropTypes.shape({ name: PropTypes.string, description: PropTypes.string, thresholdUnits: PropTypes.string, - thresholdValue: PropTypes.string, + thresholdValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), increments: PropTypes.string, startDate: PropTypes.string, expiryDate: PropTypes.string }); +const TabButton = props => { + const { onClick, disabled, className } = props; + const dataTestId = props['data-test-id']; + return ( + <div + className={className} + onClick={disabled ? undefined : onClick} + data-test-id={dataTestId} + role="tab" + disabled={disabled}> + {props.children} + </div> + ); +}; + class EntitlementPoolsEditorView extends React.Component { static propTypes = { data: EntitlementPoolPropType, @@ -95,7 +110,7 @@ class EntitlementPoolsEditorView extends React.Component { const isTabsDisabled = !data.id || !this.props.isFormValid; return ( - <div> + <div className="entitlement-pools-modal license-model-modal"> <Tabs type="menu" activeTab={selectedTab} @@ -191,23 +206,29 @@ class EntitlementPoolsEditorView extends React.Component { )} </Tab> {selectedTab !== tabIds.GENERAL ? ( - <Button + <TabButton + tabId={tabIds.ADD_LIMIT_BUTTON} disabled={ - this.state.selectedLimit || isReadOnlyMode + !!this.state.selectedLimit || isReadOnlyMode } - className="add-limit-button" - tabId={tabIds.ADD_LIMIT_BUTTON} - btnType="link" - iconName="plus"> - {i18n('Add Limit')} - </Button> + data-test-id="add-limits-tab" + className="add-limit-button"> + <Button + disabled={ + !!this.state.selectedLimit || isReadOnlyMode + } + btnType="link" + iconName="plus"> + {i18n('Add Limit')} + </Button> + </TabButton> ) : ( - <div key="empty_ep_tab_key" /> + <TabButton key="empty_ep_tab_key" /> ) // Render empty div to not break tabs } </Tabs> <ModalButtons - className="entitlement-pools-editor-buttons" + className="sdc-modal__footer" selectedLimit={this.state.selectedLimit} isFormValid={this.props.isFormValid} isReadOnlyMode={isReadOnlyMode} 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 4679b9ec81..93e78a753b 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsListEditor.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsListEditor.js @@ -27,7 +27,6 @@ const mapStateToProps = ({ licenseModel: { entitlementPool, licenseModelEditor } }) => { const { entitlementPoolsList } = entitlementPool; - const { data } = entitlementPool.entitlementPoolEditor; const { vendorName } = licenseModelEditor.data; return { @@ -35,21 +34,27 @@ const mapStateToProps = ({ entitlementPoolsList: sortByStringProperty( entitlementPoolsList, SORTING_PROPERTY_NAME - ), - isDisplayModal: Boolean(data), - isModalInEditMode: Boolean(data && data.id) + ) }; }; -const mapActionsToProps = (dispatch, { licenseModelId, version }) => { +const mapActionsToProps = ( + dispatch, + { licenseModelId, version, isReadOnlyMode } +) => { return { onAddEntitlementPoolClick: () => - EntitlementPoolsActionHelper.openEntitlementPoolsEditor(dispatch), + EntitlementPoolsActionHelper.openEntitlementPoolsEditor(dispatch, { + licenseModelId, + version, + isReadOnlyMode + }), onEditEntitlementPoolClick: entitlementPool => EntitlementPoolsActionHelper.openEntitlementPoolsEditor(dispatch, { entitlementPool, licenseModelId, - version + version, + isReadOnlyMode }), onDeleteEntitlementPool: entitlementPool => dispatch({ 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 0648d6632d..2592687298 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsListEditorView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsListEditorView.jsx @@ -17,11 +17,9 @@ 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'; import ListEditorItemView from 'nfvo-components/listEditor/ListEditorItemView.jsx'; -import EntitlementPoolsEditor from './EntitlementPoolsEditor.js'; import { extractUnits } from './EntitlementPoolsConstants'; class EntitlementPoolsListEditorView extends React.Component { @@ -46,14 +44,7 @@ class EntitlementPoolsListEditorView extends React.Component { }; render() { - let { - licenseModelId, - isReadOnlyMode, - isDisplayModal, - isModalInEditMode, - version - } = this.props; - let { onAddEntitlementPoolClick } = this.props; + let { isReadOnlyMode, onAddEntitlementPoolClick } = this.props; const { localFilter } = this.state; return ( @@ -72,28 +63,6 @@ class EntitlementPoolsListEditorView extends React.Component { ) )} </ListEditorView> - <Modal - show={isDisplayModal} - bsSize="large" - animation={true} - className="onborading-modal license-model-modal entitlement-pools-modal"> - <Modal.Header> - <Modal.Title>{`${ - isModalInEditMode - ? i18n('Edit Entitlement Pool') - : i18n('Create New Entitlement Pool') - }`}</Modal.Title> - </Modal.Header> - <Modal.Body> - {isDisplayModal && ( - <EntitlementPoolsEditor - version={version} - licenseModelId={licenseModelId} - isReadOnlyMode={isReadOnlyMode} - /> - )} - </Modal.Body> - </Modal> </div> ); } diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/components/FormContent.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/components/FormContent.jsx index 531b6b73b2..b734a88d67 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/components/FormContent.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/components/FormContent.jsx @@ -161,11 +161,13 @@ export const EntitlementPoolsFormContent = ({ data-test-id="create-ep-manufacturerReferenceNumber-value" value={manufacturerReferenceNumber} type="text" + groupClassName="no-bottom-margin" /> </GridItem> <GridItem colSpan={2} lastColInRow> <div className="date-section"> <Input + groupClassName="no-bottom-margin" type="date" label={i18n('Start Date')} value={startDate} @@ -188,6 +190,7 @@ export const EntitlementPoolsFormContent = ({ selectsStart /> <Input + groupClassName="no-bottom-margin" type="date" label={i18n('Expiry Date')} value={expiryDate} 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 d80eb9a0ab..2a9af15984 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupEditorView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupEditorView.jsx @@ -85,7 +85,7 @@ const GeneralTab = ({ </GridItem> <GridItem colSpan={4}> <Input - groupClassName="field-section" + groupClassName="field-section no-bottom-margin" onChange={partNumber => onDataChanged({ partNumber }, FG_EDITOR_FORM) } @@ -203,7 +203,7 @@ class FeatureGroupEditorView extends React.Component { licenseKeyGroupsList } = this.props; return ( - <div> + <div className="license-model-modal feature-group-modal"> {genericFieldInfo && ( <Form ref="validationForm" @@ -218,6 +218,7 @@ class FeatureGroupEditorView extends React.Component { labledButtons={true} isReadOnlyMode={isReadOnlyMode} name="feature-group-validation-form" + btnClassName="sdc-modal__footer" className="license-model-form feature-group-form"> <Tabs activeTab={onTabSelect ? selectedTab : undefined} 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 8d41b97cf0..fe4eb58b4c 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupListEditor.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupListEditor.js @@ -26,16 +26,12 @@ import { SORTING_PROPERTY_NAME } from 'sdc-app/onboarding/licenseModel/LicenseMo export const mapStateToProps = ({ licenseModel: { featureGroup, licenseModelEditor } }) => { - const { featureGroupEditor: { data }, featureGroupsList } = featureGroup; + const { featureGroupsList } = featureGroup; const { vendorName, version } = licenseModelEditor.data; return { vendorName, version, - featureGroupsModal: { - show: Boolean(data), - editMode: Boolean(data && data.id) - }, featureGroupsList: sortByStringProperty( featureGroupsList, SORTING_PROPERTY_NAME @@ -63,13 +59,19 @@ const mapActionsToProps = (dispatch, { licenseModelId }) => { onAddFeatureGroupClick: actualVersion => FeatureGroupsActionHelper.openFeatureGroupsEditor(dispatch, { licenseModelId, - version: actualVersion + version: actualVersion, + isReadOnlyMode: false }), - onEditFeatureGroupClick: (featureGroup, actualVersion) => + onEditFeatureGroupClick: ( + featureGroup, + actualVersion, + isReadOnlyMode + ) => FeatureGroupsActionHelper.openFeatureGroupsEditor(dispatch, { featureGroup, licenseModelId, - version: actualVersion + version: actualVersion, + isReadOnlyMode }) }; }; 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 92468a3b86..63964435f2 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupListEditorView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupListEditorView.jsx @@ -17,20 +17,13 @@ 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'; import ListEditorItemView from 'nfvo-components/listEditor/ListEditorItemView.jsx'; -import FeatureGroupEditor from './FeatureGroupEditor.js'; - class FeatureGroupListEditorView extends React.Component { static propTypes = { vendorName: PropTypes.string, licenseModelId: PropTypes.string.isRequired, - featureGroupsModal: PropTypes.shape({ - show: PropTypes.bool, - editMode: PropTypes.bool - }), isReadOnlyMode: PropTypes.bool.isRequired, onAddFeatureGroupClick: PropTypes.func, onEditFeatureGroupClick: PropTypes.func, @@ -40,11 +33,7 @@ class FeatureGroupListEditorView extends React.Component { }; static defaultProps = { - featureGroupsList: [], - featureGroupsModal: { - show: false, - editMode: false - } + featureGroupsList: [] }; state = { @@ -52,13 +41,7 @@ class FeatureGroupListEditorView extends React.Component { }; render() { - let { - licenseModelId, - featureGroupsModal, - isReadOnlyMode, - onAddFeatureGroupClick, - version - } = this.props; + let { isReadOnlyMode, onAddFeatureGroupClick, version } = this.props; const { localFilter } = this.state; return ( <div className="license-model-list-editor feature-groups-list-editor"> @@ -77,28 +60,6 @@ class FeatureGroupListEditorView extends React.Component { ) )} </ListEditorView> - {featureGroupsModal.show && ( - <Modal - show={featureGroupsModal.show} - bsSize="large" - animation={true} - className="onborading-modal license-model-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> ); } @@ -114,7 +75,9 @@ class FeatureGroupListEditorView extends React.Component { <ListEditorItemView key={listItem.id} onDelete={() => this.deleteFeatureGroupItem(listItem, version)} - onSelect={() => this.editFeatureGroupItem(listItem, version)} + onSelect={() => + this.editFeatureGroupItem(listItem, version, isReadOnlyMode) + } className="list-editor-item-view" isReadOnlyMode={isReadOnlyMode}> <div className="list-editor-item-view-field"> 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 22e21a613a..c6479a7481 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsActionHelper.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsActionHelper.js @@ -1,17 +1,17 @@ -/*! - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. +/* + * Copyright © 2016-2018 European Support Limited * * 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. + * 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'; @@ -19,6 +19,12 @@ import { actionTypes as featureGroupsActionConstants } from './FeatureGroupsCons 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'; +import { + actionTypes as modalActionTypes, + modalSizes +} from 'nfvo-components/modal/GlobalModalConstants.js'; +import { modalContentMapper } from 'sdc-app/common/modal/ModalContentMapper.js'; +import i18n from 'nfvo-utils/i18n/i18n.js'; function baseUrl(licenseModelId, version) { const restPrefix = Configuration.get('restPrefix'); @@ -189,7 +195,7 @@ export default { openFeatureGroupsEditor( dispatch, - { featureGroup, licenseModelId, version } + { featureGroup, licenseModelId, version, isReadOnlyMode } ) { return Promise.all([ EntitlementPoolsActionHelper.fetchEntitlementPoolsList(dispatch, { @@ -205,6 +211,26 @@ export default { type: featureGroupsActionConstants.featureGroupsEditor.OPEN, featureGroup }); + dispatch({ + type: featureGroupsActionConstants.featureGroupsEditor.OPEN, + featureGroup + }); + dispatch({ + type: modalActionTypes.GLOBAL_MODAL_SHOW, + data: { + modalComponentName: modalContentMapper.FG_EDITOR, + modalComponentProps: { + version, + licenseModelId, + isReadOnlyMode, + size: modalSizes.LARGE + }, + title: + licenseModelId && version && featureGroup + ? i18n('Edit Feature Group') + : i18n('Create New Feature Group') + } + }); }); }, @@ -212,5 +238,8 @@ export default { dispatch({ type: featureGroupsActionConstants.featureGroupsEditor.CLOSE }); + dispatch({ + type: modalActionTypes.GLOBAL_MODAL_CLOSE + }); } }; 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 feceba5726..036aaaa686 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementActionHelper.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementActionHelper.js @@ -1,23 +1,29 @@ -/*! - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. +/* + * Copyright © 2016-2018 European Support Limited * * 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. + * 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 licenseAgreementActionTypes } from './LicenseAgreementConstants.js'; import FeatureGroupsActionHelper from 'sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsActionHelper.js'; import ItemsHelper from 'sdc-app/common/helpers/ItemsHelper.js'; +import { + actionTypes as modalActionTypes, + modalSizes +} from 'nfvo-components/modal/GlobalModalConstants.js'; +import { modalContentMapper } from 'sdc-app/common/modal/ModalContentMapper.js'; +import i18n from 'nfvo-utils/i18n/i18n.js'; function baseUrl(licenseModelId, version) { const restPrefix = Configuration.get('restPrefix'); @@ -103,7 +109,7 @@ export default { openLicenseAgreementEditor( dispatch, - { licenseModelId, licenseAgreement, version } + { licenseModelId, licenseAgreement, version, isReadOnlyMode } ) { FeatureGroupsActionHelper.fetchFeatureGroupsList(dispatch, { licenseModelId, @@ -113,12 +119,31 @@ export default { type: licenseAgreementActionTypes.licenseAgreementEditor.OPEN, licenseAgreement }); + dispatch({ + type: modalActionTypes.GLOBAL_MODAL_SHOW, + data: { + modalComponentName: modalContentMapper.LA_EDITOR, + modalComponentProps: { + version, + licenseModelId, + isReadOnlyMode, + size: modalSizes.LARGE + }, + title: + licenseModelId && version && licenseAgreement + ? i18n('Edit License Agreement') + : i18n('Create New License Agreement') + } + }); }, closeLicenseAgreementEditor(dispatch) { dispatch({ type: licenseAgreementActionTypes.licenseAgreementEditor.CLOSE }); + dispatch({ + type: modalActionTypes.GLOBAL_MODAL_CLOSE + }); }, async saveLicenseAgreement( 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 b2ebc1e436..b54c0806ef 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementEditorView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementEditorView.jsx @@ -1,17 +1,17 @@ -/*! - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. +/* + * Copyright © 2016-2018 European Support Limited * * 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. + * 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 PropTypes from 'prop-types'; @@ -77,7 +77,12 @@ const GeneralTabContent = ({ isMultiSelect={false} onEnumChange={licenseTerm => onDataChanged( - { licenseTerm: { choice: licenseTerm, other: '' } }, + { + licenseTerm: { + choice: licenseTerm, + other: '' + } + }, LA_EDITOR_FORM ) } @@ -163,7 +168,7 @@ class LicenseAgreementEditorView extends React.Component { genericFieldInfo } = this.props; return ( - <div> + <div className="license-model-modal license-agreement-modal"> {genericFieldInfo && ( <Form ref="validationForm" @@ -177,7 +182,8 @@ class LicenseAgreementEditorView extends React.Component { onValidateForm={() => this.props.onValidateForm(LA_EDITOR_FORM) } - className="license-model-form license-agreement-form"> + className="license-model-form license-agreement-form" + btnClassName="sdc-modal__footer"> <Tabs activeTab={onTabSelect ? selectedTab : undefined} onTabClick={onTabSelect} 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 fcb83b4279..6151ad75f2 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementListEditor.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementListEditor.js @@ -25,7 +25,6 @@ const mapStateToProps = ({ licenseModel: { licenseAgreement, licenseModelEditor } }) => { let { licenseAgreementList } = licenseAgreement; - let { data } = licenseAgreement.licenseAgreementEditor; let { vendorName, version } = licenseModelEditor.data; return { @@ -34,9 +33,7 @@ const mapStateToProps = ({ licenseAgreementList: sortByStringProperty( licenseAgreementList, SORTING_PROPERTY_NAME - ), - isDisplayModal: Boolean(data), - isModalInEditMode: Boolean(data && data.id) + ) }; }; @@ -45,13 +42,19 @@ const mapActionsToProps = (dispatch, { licenseModelId }) => { onAddLicenseAgreementClick: version => LicenseAgreementActionHelper.openLicenseAgreementEditor(dispatch, { licenseModelId, - version + version, + isReadOnlyMode: false }), - onEditLicenseAgreementClick: (licenseAgreement, version) => + onEditLicenseAgreementClick: ( + licenseAgreement, + version, + isReadOnlyMode + ) => LicenseAgreementActionHelper.openLicenseAgreementEditor(dispatch, { licenseModelId, licenseAgreement, - version + version, + isReadOnlyMode }), onDeleteLicenseAgreement: (licenseAgreement, version) => dispatch({ 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 acec1e0ddb..b6ef7cf072 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementListEditorView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementListEditorView.jsx @@ -1,26 +1,24 @@ -/*! - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. +/* + * Copyright © 2016-2018 European Support Limited * * 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. + * 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 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'; import ListEditorItemView from 'nfvo-components/listEditor/ListEditorItemView.jsx'; -import LicenseAgreementEditor from './LicenseAgreementEditor.js'; import { extractValue } from './LicenseAgreementConstants'; class LicenseAgreementListEditorView extends React.Component { @@ -45,13 +43,7 @@ class LicenseAgreementListEditorView extends React.Component { }; render() { - const { - licenseModelId, - isReadOnlyMode, - isDisplayModal, - isModalInEditMode, - version - } = this.props; + const { isReadOnlyMode, version } = this.props; const { onAddLicenseAgreementClick } = this.props; const { localFilter } = this.state; @@ -72,28 +64,6 @@ class LicenseAgreementListEditorView extends React.Component { ) )} </ListEditorView> - <Modal - show={isDisplayModal} - bsSize="large" - animation={true} - className="onborading-modal license-model-modal license-agreement-modal"> - <Modal.Header> - <Modal.Title>{`${ - isModalInEditMode - ? i18n('Edit License Agreement') - : i18n('Create New License Agreement') - }`}</Modal.Title> - </Modal.Header> - <Modal.Body> - {isDisplayModal && ( - <LicenseAgreementEditor - version={version} - licenseModelId={licenseModelId} - isReadOnlyMode={isReadOnlyMode} - /> - )} - </Modal.Body> - </Modal> </div> ); } @@ -133,7 +103,11 @@ class LicenseAgreementListEditorView extends React.Component { <ListEditorItemView key={id} onSelect={() => - onEditLicenseAgreementClick(licenseAgreement, version) + onEditLicenseAgreementClick( + licenseAgreement, + version, + isReadOnlyMode + ) } onDelete={() => onDeleteLicenseAgreement(licenseAgreement, version) 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 53276ca49b..c9f0505ad1 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsActionHelper.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsActionHelper.js @@ -19,6 +19,12 @@ import { actionTypes as licenseKeyGroupsConstants } from './LicenseKeyGroupsCons 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'; +import i18n from 'nfvo-utils/i18n/i18n.js'; +import { + actionTypes as modalActionTypes, + modalSizes +} from 'nfvo-components/modal/GlobalModalConstants.js'; +import { modalContentMapper } from 'sdc-app/common/modal/ModalContentMapper.js'; function baseUrl(licenseModelId, version) { const restPrefix = Configuration.get('restPrefix'); @@ -131,9 +137,9 @@ export default { openLicenseKeyGroupsEditor( dispatch, - { licenseKeyGroup, licenseModelId, version } = {} + { licenseKeyGroup, licenseModelId, version, isReadOnlyMode } = {} ) { - if (licenseModelId && version) { + if (licenseModelId && version && licenseKeyGroup) { this.fetchLimits(dispatch, { licenseModelId, version, @@ -144,12 +150,31 @@ export default { type: licenseKeyGroupsConstants.licenseKeyGroupsEditor.OPEN, licenseKeyGroup }); + dispatch({ + type: modalActionTypes.GLOBAL_MODAL_SHOW, + data: { + modalComponentName: modalContentMapper.LKG_EDITOR, + modalComponentProps: { + version, + licenseModelId, + isReadOnlyMode, + size: modalSizes.LARGE + }, + title: + licenseModelId && version && licenseKeyGroup + ? i18n('Edit License Key Group') + : i18n('Create New License Key Group') + } + }); }, closeLicenseKeyGroupEditor(dispatch) { dispatch({ type: licenseKeyGroupsConstants.licenseKeyGroupsEditor.CLOSE }); + dispatch({ + type: modalActionTypes.GLOBAL_MODAL_CLOSE + }); }, async saveLicenseKeyGroup( 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 8f21722ca6..219f2dcd1e 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsEditorView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsEditorView.jsx @@ -39,6 +39,21 @@ import { import LicenseKeyGroupFormContent from './components/FormContent.jsx'; import ModalButtons from 'sdc-app/onboarding/licenseModel/components/ModalButtons.jsx'; +const TabButton = props => { + const { onClick, disabled, className } = props; + const dataTestId = props['data-test-id']; + return ( + <div + className={className} + onClick={disabled ? undefined : onClick} + data-test-id={dataTestId} + role="tab" + disabled={disabled}> + {props.children} + </div> + ); +}; + const LicenseKeyGroupPropType = PropTypes.shape({ id: PropTypes.string, name: PropTypes.string, @@ -94,7 +109,7 @@ class LicenseKeyGroupsEditorView extends React.Component { let { selectedTab } = this.state; const isTabsDisabled = !data.id || !this.props.isFormValid; return ( - <div className="license-keygroup-editor"> + <div className="license-keygroup-editor license-model-modal license-key-groups-modal"> <Tabs type="menu" activeTab={selectedTab} @@ -187,23 +202,29 @@ class LicenseKeyGroupsEditorView extends React.Component { )} </Tab> {selectedTab !== tabIds.GENERAL ? ( - <Button - className="add-limit-button" + <TabButton tabId={tabIds.ADD_LIMIT_BUTTON} - btnType="link" - iconName="plus" disabled={ - this.state.selectedLimit || isReadOnlyMode - }> - {i18n('Add Limit')} - </Button> + !!this.state.selectedLimit || isReadOnlyMode + } + data-test-id="add-limits-tab" + className="add-limit-button"> + <Button + btnType="link" + iconName="plus" + disabled={ + !!this.state.selectedLimit || isReadOnlyMode + }> + {i18n('Add Limit')} + </Button> + </TabButton> ) : ( - <div key="empty_lm_tab_key" /> + <TabButton key="empty_lm_tab_key" /> ) // Render empty div to not break tabs } </Tabs> <ModalButtons - className="license-key-group-editor-buttons" + className="sdc-modal__footer" selectedLimit={this.state.selectedLimit} isFormValid={this.props.isFormValid} isReadOnlyMode={isReadOnlyMode} 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 514e9b85ec..47d3979064 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsListEditor.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsListEditor.js @@ -29,7 +29,6 @@ const mapStateToProps = ({ licenseModel: { licenseKeyGroup, licenseModelEditor } }) => { let { licenseKeyGroupsList } = licenseKeyGroup; - let { data } = licenseKeyGroup.licenseKeyGroupsEditor; let { vendorName } = licenseModelEditor.data; return { @@ -37,21 +36,24 @@ const mapStateToProps = ({ licenseKeyGroupsList: sortByStringProperty( licenseKeyGroupsList, SORTING_PROPERTY_NAME - ), - isDisplayModal: Boolean(data), - isModalInEditMode: Boolean(data && data.id) + ) }; }; const mapActionsToProps = (dispatch, { licenseModelId, version }) => { return { onAddLicenseKeyGroupClick: () => - LicenseKeyGroupsActionHelper.openLicenseKeyGroupsEditor(dispatch), - onEditLicenseKeyGroupClick: licenseKeyGroup => + LicenseKeyGroupsActionHelper.openLicenseKeyGroupsEditor(dispatch, { + isReadOnlyMode: false, + version, + licenseModelId + }), + onEditLicenseKeyGroupClick: (licenseKeyGroup, isReadOnlyMode) => LicenseKeyGroupsActionHelper.openLicenseKeyGroupsEditor(dispatch, { licenseKeyGroup, licenseModelId, - version + version, + isReadOnlyMode }), onDeleteLicenseKeyGroupClick: licenseKeyGroup => dispatch({ 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 09bab1c097..2394ec8335 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsListEditorView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsListEditorView.jsx @@ -16,11 +16,9 @@ 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'; import ListEditorItemView from 'nfvo-components/listEditor/ListEditorItemView.jsx'; -import LicenseKeyGroupsEditor from './LicenseKeyGroupsEditor.js'; import InputOptions, { other as optionInputOther } from 'nfvo-components/input/validation/InputOptions.jsx'; @@ -32,8 +30,6 @@ class LicenseKeyGroupsListEditorView extends React.Component { 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 @@ -48,13 +44,7 @@ class LicenseKeyGroupsListEditorView extends React.Component { }; render() { - let { - licenseModelId, - isReadOnlyMode, - isDisplayModal, - isModalInEditMode, - version - } = this.props; + let { isReadOnlyMode } = this.props; let { onAddLicenseKeyGroupClick } = this.props; const { localFilter } = this.state; @@ -74,28 +64,6 @@ class LicenseKeyGroupsListEditorView extends React.Component { ) )} </ListEditorView> - <Modal - show={isDisplayModal} - bsSize="large" - animation={true} - className="onborading-modal license-model-modal license-key-groups-modal"> - <Modal.Header> - <Modal.Title>{`${ - isModalInEditMode - ? i18n('Edit License Key Group') - : i18n('Create New License Key Group') - }`}</Modal.Title> - </Modal.Header> - <Modal.Body> - {isDisplayModal && ( - <LicenseKeyGroupsEditor - version={version} - licenseModelId={licenseModelId} - isReadOnlyMode={isReadOnlyMode} - /> - )} - </Modal.Body> - </Modal> </div> ); } @@ -134,7 +102,9 @@ class LicenseKeyGroupsListEditorView extends React.Component { return ( <ListEditorItemView key={id} - onSelect={() => onEditLicenseKeyGroupClick(licenseKeyGroup)} + onSelect={() => + onEditLicenseKeyGroupClick(licenseKeyGroup, isReadOnlyMode) + } onDelete={() => onDeleteLicenseKeyGroupClick(licenseKeyGroup)} className="list-editor-item-view" isReadOnlyMode={isReadOnlyMode}> diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/components/FormContent.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/components/FormContent.jsx index 4d19ed39ce..c2c62b1402 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/components/FormContent.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/components/FormContent.jsx @@ -211,6 +211,7 @@ const LicenseKeyGroupFormContent = ({ value={manufacturerReferenceNumber} data-test-id="create-ep-mrn" type="text" + groupClassName="no-bottom-margin" /> </GridItem> @@ -223,6 +224,7 @@ const LicenseKeyGroupFormContent = ({ value={increments} data-test-id="create-ep-increments" type="text" + groupClassName="no-bottom-margin" /> </GridItem> {id && versionUUID && <UuId id={id} versionUUID={versionUUID} />} 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 6899360597..c2d6f8e4d6 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/LicenseModelOverviewView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/LicenseModelOverviewView.jsx @@ -1,52 +1,28 @@ -/*! - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. +/* + * Copyright © 2016-2018 European Support Limited * * 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. + * 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 PropTypes from 'prop-types'; -import i18n from 'nfvo-utils/i18n/i18n.js'; -import Modal from 'nfvo-components/modal/Modal.jsx'; import classNames from 'classnames'; -import EntitlementPoolsEditor from '../entitlementPools/EntitlementPoolsEditor.js'; -import FeatureGroupEditor from '../featureGroups/FeatureGroupEditor.js'; -import LicenseAgreementEditor from '../licenseAgreement/LicenseAgreementEditor.js'; -import LicenseKeyGroupsEditor from '../licenseKeyGroups/LicenseKeyGroupsEditor.js'; -import { - overviewEditorHeaders, - selectedButton -} from './LicenseModelOverviewConstants.js'; +import { selectedButton } from './LicenseModelOverviewConstants.js'; import SummaryView from './SummaryView.jsx'; import VLMListView from './VLMListView.jsx'; import ListButtons from './summary/ListButtons.jsx'; -const setModalClassName = modalHeader => { - switch (modalHeader) { - case overviewEditorHeaders.ENTITLEMENT_POOL: - return 'entitlement-pools-modal'; - case overviewEditorHeaders.LICENSE_AGREEMENT: - return 'license-agreement-modal'; - case overviewEditorHeaders.FEATURE_GROUP: - return 'feature-group-modal'; - case overviewEditorHeaders.LICENSE_KEY_GROUP: - return 'license-key-groups-modal'; - default: - return ''; - } -}; - class LicenseModelOverviewView extends React.Component { static propTypes = { isDisplayModal: PropTypes.bool, @@ -63,8 +39,6 @@ class LicenseModelOverviewView extends React.Component { render() { let { - isDisplayModal, - modalHeader, licensingDataList, selectedTab, onTabSelect, @@ -94,66 +68,9 @@ class LicenseModelOverviewView extends React.Component { showInUse={selectedInUse} /> </div> - {isDisplayModal && ( - <Modal - show={isDisplayModal} - bsSize="large" - animation={true} - className={classNames( - 'onborading-modal license-model-modal', - setModalClassName(modalHeader) - )}> - <Modal.Header> - <Modal.Title>{`${i18n('Create New ')}${i18n( - modalHeader - )}`}</Modal.Title> - </Modal.Header> - <Modal.Body> - {this.renderModalBody(modalHeader)} - </Modal.Body> - </Modal> - )} </div> ); } - - renderModalBody(modalHeader) { - let { licenseModelId, version, isReadOnlyMode } = this.props; - switch (modalHeader) { - case overviewEditorHeaders.ENTITLEMENT_POOL: - return ( - <EntitlementPoolsEditor - version={version} - licenseModelId={licenseModelId} - isReadOnlyMode={isReadOnlyMode} - /> - ); - case overviewEditorHeaders.LICENSE_AGREEMENT: - return ( - <LicenseAgreementEditor - version={version} - licenseModelId={licenseModelId} - isReadOnlyMode={isReadOnlyMode} - /> - ); - case overviewEditorHeaders.FEATURE_GROUP: - return ( - <FeatureGroupEditor - version={version} - licenseModelId={licenseModelId} - isReadOnlyMode={isReadOnlyMode} - /> - ); - case overviewEditorHeaders.LICENSE_KEY_GROUP: - return ( - <LicenseKeyGroupsEditor - version={version} - licenseModelId={licenseModelId} - isReadOnlyMode={isReadOnlyMode} - /> - ); - } - } } export default LicenseModelOverviewView; 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 711bb7a374..6ce42a51bf 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 @@ -1,17 +1,17 @@ -/*! - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. +/* + * Copyright © 2016-2018 European Support Limited * * 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. + * 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 { connect } from 'react-redux'; @@ -68,7 +68,12 @@ const mapActionsToProps = dispatch => { switch (name) { case overviewItems.ENTITLEMENT_POOLS: EntitlementPoolsActionHelper.openEntitlementPoolsEditor( - dispatch + dispatch, + { + licenseModelId, + version, + isReadOnlyMode: false + } ); break; case overviewItems.FEATURE_GROUPS: @@ -76,7 +81,8 @@ const mapActionsToProps = dispatch => { dispatch, { licenseModelId, - version + version, + isReadOnlyMode: false } ); break; @@ -85,13 +91,19 @@ const mapActionsToProps = dispatch => { dispatch, { licenseModelId, - version + version, + isReadOnlyMode: false } ); break; case overviewItems.LICENSE_KEY_GROUPS: LicenseKeyGroupsActionHelper.openLicenseKeyGroupsEditor( - dispatch + dispatch, + { + licenseModelId, + version, + isReadOnlyMode: false + } ); break; default: |