From 1801b24389baa8e3f7298ff2c41e2512b19c1290 Mon Sep 17 00:00:00 2001 From: Einav Weiss Keidar Date: Mon, 13 Aug 2018 16:19:46 +0300 Subject: react 16 upgrade Issue-ID: SDC-1762 Change-Id: I7701f12fc63bb09f8c985c7c893b984701dcbfab Signed-off-by: Einav Keidar --- .../licenseModel/components/ModalButtons.jsx | 7 +- .../onboarding/licenseModel/components/UuId.jsx | 2 +- .../creation/LicenseModelCreationView.jsx | 11 +-- .../EntitlementPoolsActionHelper.js | 29 ++++++- .../EntitlementPoolsEditorView.jsx | 45 +++++++--- .../entitlementPools/EntitlementPoolsListEditor.js | 19 +++-- .../EntitlementPoolsListEditorView.jsx | 33 +------- .../entitlementPools/components/FormContent.jsx | 3 + .../featureGroups/FeatureGroupEditorView.jsx | 5 +- .../featureGroups/FeatureGroupListEditor.js | 18 ++-- .../featureGroups/FeatureGroupListEditorView.jsx | 47 ++--------- .../featureGroups/FeatureGroupsActionHelper.js | 43 ++++++++-- .../LicenseAgreementActionHelper.js | 39 +++++++-- .../LicenseAgreementEditorView.jsx | 24 ++++-- .../licenseAgreement/LicenseAgreementListEditor.js | 17 ++-- .../LicenseAgreementListEditorView.jsx | 50 +++-------- .../LicenseKeyGroupsActionHelper.js | 29 ++++++- .../LicenseKeyGroupsEditorView.jsx | 43 +++++++--- .../licenseKeyGroups/LicenseKeyGroupsListEditor.js | 16 ++-- .../LicenseKeyGroupsListEditorView.jsx | 38 +-------- .../licenseKeyGroups/components/FormContent.jsx | 2 + .../overview/LicenseModelOverviewView.jsx | 97 ++-------------------- .../overview/summary/SummaryCountList.js | 32 ++++--- 23 files changed, 312 insertions(+), 337 deletions(-) (limited to 'openecomp-ui/src/sdc-app/onboarding/licenseModel') 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 }) => ( - +
{!selectedLimit && ( - +
); 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 }) => (
{title}
-
+
{value}
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 ( -
+
{genericFieldInfo && (
this.validate()}>
)} 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 ( +
+ {props.children} +
+ ); +}; + 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 ( -
+
{selectedTab !== tabIds.GENERAL ? ( - + data-test-id="add-limits-tab" + className="add-limit-button"> + + ) : ( -
+ ) // Render empty div to not break tabs } { 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 { ) )} - - - {`${ - isModalInEditMode - ? i18n('Edit Entitlement Pool') - : i18n('Create New Entitlement Pool') - }`} - - - {isDisplayModal && ( - - )} - -
); } 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" />
onDataChanged({ partNumber }, FG_EDITOR_FORM) } @@ -203,7 +203,7 @@ class FeatureGroupEditorView extends React.Component { licenseKeyGroupsList } = this.props; return ( -
+
{genericFieldInfo && (
{ - 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 (
@@ -77,28 +60,6 @@ class FeatureGroupListEditorView extends React.Component { ) )} - {featureGroupsModal.show && ( - - - {`${ - featureGroupsModal.editMode - ? i18n('Edit Feature Group') - : i18n('Create New Feature Group') - }`} - - - - - - )}
); } @@ -114,7 +75,9 @@ class FeatureGroupListEditorView extends React.Component { this.deleteFeatureGroupItem(listItem, version)} - onSelect={() => this.editFeatureGroupItem(listItem, version)} + onSelect={() => + this.editFeatureGroupItem(listItem, version, isReadOnlyMode) + } className="list-editor-item-view" isReadOnlyMode={isReadOnlyMode}>
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 ( -
+
{genericFieldInfo && ( this.props.onValidateForm(LA_EDITOR_FORM) } - className="license-model-form license-agreement-form"> + className="license-model-form license-agreement-form" + btnClassName="sdc-modal__footer"> { 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 { ) )} - - - {`${ - isModalInEditMode - ? i18n('Edit License Agreement') - : i18n('Create New License Agreement') - }`} - - - {isDisplayModal && ( - - )} - -
); } @@ -133,7 +103,11 @@ class LicenseAgreementListEditorView extends React.Component { - 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 ( +
+ {props.children} +
+ ); +}; + 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 ( -
+
{selectedTab !== tabIds.GENERAL ? ( - + !!this.state.selectedLimit || isReadOnlyMode + } + data-test-id="add-limits-tab" + className="add-limit-button"> + + ) : ( -
+ ) // Render empty div to not break tabs } { 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 { ) )} - - - {`${ - isModalInEditMode - ? i18n('Edit License Key Group') - : i18n('Create New License Key Group') - }`} - - - {isDisplayModal && ( - - )} - -
); } @@ -134,7 +102,9 @@ class LicenseKeyGroupsListEditorView extends React.Component { return ( 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" /> @@ -223,6 +224,7 @@ const LicenseKeyGroupFormContent = ({ value={increments} data-test-id="create-ep-increments" type="text" + groupClassName="no-bottom-margin" /> {id && 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} />
- {isDisplayModal && ( - - - {`${i18n('Create New ')}${i18n( - modalHeader - )}`} - - - {this.renderModalBody(modalHeader)} - - - )}
); } - - renderModalBody(modalHeader) { - let { licenseModelId, version, isReadOnlyMode } = this.props; - switch (modalHeader) { - case overviewEditorHeaders.ENTITLEMENT_POOL: - return ( - - ); - case overviewEditorHeaders.LICENSE_AGREEMENT: - return ( - - ); - case overviewEditorHeaders.FEATURE_GROUP: - return ( - - ); - case overviewEditorHeaders.LICENSE_KEY_GROUP: - return ( - - ); - } - } } 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: -- cgit 1.2.3-korg