diff options
Diffstat (limited to 'openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement')
4 files changed, 69 insertions, 61 deletions
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) |