2 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
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
13 * or implied. See the License for the specific language governing
14 * permissions and 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, {
74 modalClassName: 'network-nic-modal-create',
79 type: GlobalModalActions.GLOBAL_MODAL_WARNING,
81 msg: i18n('Are you sure you want to delete "{name}"?', {
85 SoftwareProductComponentsNetworkActionHelper.deleteNIC(
96 onEditNicClick: (nic, isReadOnlyMode) => {
98 SoftwareProductComponentsNetworkActionHelper.loadNICData({
104 SoftwareProductComponentsNetworkActionHelper.loadNICQuestionnaire(
113 ]).then(([{ data }]) =>
114 SoftwareProductComponentsNetworkActionHelper.openNICEditor(
122 modalClassName: 'network-nic-modal-edit',
128 onSubmit: ({ qdata }) => {
129 return SoftwareProductComponentsActionHelper.updateSoftwareProductComponentQuestionnaire(
134 vspComponentId: componentId,
142 export default connect(mapStateToProps, mapActionsToProps, null, {
144 })(SoftwareProductComponentsNetworkListView);