2 * Copyright © 2016-2018 European Support Limited
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 import { connect } from 'react-redux';
17 import i18n from 'nfvo-utils/i18n/i18n.js';
18 import sortByStringProperty from 'nfvo-utils/sortByStringProperty.js';
19 import LicenseAgreementActionHelper from './LicenseAgreementActionHelper.js';
20 import LicenseAgreementListEditorView from './LicenseAgreementListEditorView.jsx';
21 import { actionTypes as globalMoadlActions } from 'nfvo-components/modal/GlobalModalConstants.js';
22 import { SORTING_PROPERTY_NAME } from 'sdc-app/onboarding/licenseModel/LicenseModelConstants.js';
24 const mapStateToProps = ({
25 licenseModel: { licenseAgreement, licenseModelEditor }
27 let { licenseAgreementList } = licenseAgreement;
28 let { vendorName, version } = licenseModelEditor.data;
33 licenseAgreementList: sortByStringProperty(
40 const mapActionsToProps = (dispatch, { licenseModelId }) => {
42 onAddLicenseAgreementClick: version =>
43 LicenseAgreementActionHelper.openLicenseAgreementEditor(dispatch, {
48 onEditLicenseAgreementClick: (
53 LicenseAgreementActionHelper.openLicenseAgreementEditor(dispatch, {
59 onDeleteLicenseAgreement: (licenseAgreement, version) =>
61 type: globalMoadlActions.GLOBAL_MODAL_WARNING,
63 msg: i18n('Are you sure you want to delete "{name}"?', {
64 name: licenseAgreement.name
66 confirmationButtonText: i18n('Delete'),
67 title: i18n('Delete'),
69 LicenseAgreementActionHelper.deleteLicenseAgreement(
73 licenseAgreementId: licenseAgreement.id,
82 export default connect(mapStateToProps, mapActionsToProps)(
83 LicenseAgreementListEditorView