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 sortByStringProperty from 'nfvo-utils/sortByStringProperty.js';
18 import FeatureGroupsActionHelper from './FeatureGroupsActionHelper.js';
19 import FeatureGroupListEditorView, {
20 generateConfirmationMsg
21 } from './FeatureGroupListEditorView.jsx';
22 import i18n from 'nfvo-utils/i18n/i18n.js';
23 import { actionTypes as globalMoadlActions } from 'nfvo-components/modal/GlobalModalConstants.js';
24 import { SORTING_PROPERTY_NAME } from 'sdc-app/onboarding/licenseModel/LicenseModelConstants.js';
26 export const mapStateToProps = ({
27 licenseModel: { featureGroup, licenseModelEditor }
29 const { featureGroupsList } = featureGroup;
30 const { vendorName, version } = licenseModelEditor.data;
35 featureGroupsList: sortByStringProperty(
42 const mapActionsToProps = (dispatch, { licenseModelId }) => {
44 onDeleteFeatureGroupClick: (featureGroup, version) =>
46 type: globalMoadlActions.GLOBAL_MODAL_WARNING,
48 msg: generateConfirmationMsg(featureGroup),
49 confirmationButtonText: i18n('Delete'),
50 title: i18n('Delete'),
52 FeatureGroupsActionHelper.deleteFeatureGroup(dispatch, {
53 featureGroupId: featureGroup.id,
59 onAddFeatureGroupClick: actualVersion =>
60 FeatureGroupsActionHelper.openFeatureGroupsEditor(dispatch, {
62 version: actualVersion,
65 onEditFeatureGroupClick: (
70 FeatureGroupsActionHelper.openFeatureGroupsEditor(dispatch, {
73 version: actualVersion,
79 export default connect(mapStateToProps, mapActionsToProps)(
80 FeatureGroupListEditorView