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 { actionTypes as modalActionTypes } from 'nfvo-components/modal/GlobalModalConstants.js';
20 import SoftwareProductProcessesActionHelper from './SoftwareProductProcessesActionHelper.js';
21 import SoftwareProductProcessesView from './SoftwareProductProcessesView.jsx';
23 export const mapStateToProps = ({ softwareProduct }) => {
25 softwareProductEditor: { data: currentSoftwareProduct = {} },
26 softwareProductProcesses: { processesList, processesEditor }
28 let { data } = processesEditor;
31 currentSoftwareProduct,
33 isDisplayEditor: Boolean(data),
34 isModalInEditMode: Boolean(data && data.id)
38 const mapActionsToProps = (dispatch, { softwareProductId, version }) => {
41 SoftwareProductProcessesActionHelper.openEditor(dispatch, {
46 onEditProcess: (process, isReadOnlyMode) =>
47 SoftwareProductProcessesActionHelper.openEditor(dispatch, {
53 onDeleteProcess: process =>
55 type: modalActionTypes.GLOBAL_MODAL_WARNING,
57 msg: i18n('Are you sure you want to delete "{name}"?', {
60 confirmationButtonText: i18n('Delete'),
61 title: i18n('Delete'),
63 SoftwareProductProcessesActionHelper.deleteProcess(
76 export default connect(mapStateToProps, mapActionsToProps, null, {
78 })(SoftwareProductProcessesView);