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';
19 import SoftwareProductComponentsActionHelper from 'sdc-app/onboarding/softwareProduct/components/SoftwareProductComponentsActionHelper.js';
20 import SoftwareProductComponentsNetworkListView from './SoftwareProductComponentsNetworkListView.jsx';
21 import SoftwareProductComponentsNetworkActionHelper from './SoftwareProductComponentsNetworkActionHelper.js';
22 import { COMPONENTS_QUESTIONNAIRE } from 'sdc-app/onboarding/softwareProduct/components/SoftwareProductComponentsConstants.js';
23 import ValidationHelper from 'sdc-app/common/helpers/ValidationHelper.js';
24 import { actionTypes as GlobalModalActions } from 'nfvo-components/modal/GlobalModalConstants.js';
25 import NICCreationActionHelper from './NICCreation/NICCreationActionHelper.js';
26 import { onboardingMethod as onboardingMethodTypes } from '../../SoftwareProductConstants.js';
28 export const mapStateToProps = ({ softwareProduct }) => {
30 softwareProductEditor: {
31 data: currentSoftwareProduct = {},
34 softwareProductComponents
37 network: { nicList = [] },
44 } = softwareProductComponents;
45 let { version, onboardingMethod } = currentSoftwareProduct;
46 let isManual = onboardingMethod === onboardingMethodTypes.MANUAL;
60 const mapActionsToProps = (
62 { softwareProductId, componentId, version }
65 onQDataChanged: deltaData =>
66 ValidationHelper.qDataChanged(dispatch, {
68 qName: COMPONENTS_QUESTIONNAIRE
71 NICCreationActionHelper.open(dispatch, {
78 type: GlobalModalActions.GLOBAL_MODAL_WARNING,
80 msg: i18n('Are you sure you want to delete "{name}"?', {
84 SoftwareProductComponentsNetworkActionHelper.deleteNIC(
95 onEditNicClick: (nic, isReadOnlyMode) => {
97 SoftwareProductComponentsNetworkActionHelper.loadNICData({
103 SoftwareProductComponentsNetworkActionHelper.loadNICQuestionnaire(
112 ]).then(([{ data }]) =>
113 SoftwareProductComponentsNetworkActionHelper.openNICEditor(
126 onSubmit: ({ qdata }) => {
127 return SoftwareProductComponentsActionHelper.updateSoftwareProductComponentQuestionnaire(
132 vspComponentId: componentId,
140 export default connect(mapStateToProps, mapActionsToProps, null, {
142 })(SoftwareProductComponentsNetworkListView);