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 HeatSetupView from './HeatSetupView.jsx';
18 import HeatSetupActionHelper from './HeatSetupActionHelper.js';
22 function baseExists(modules) {
23 for (let i in modules) {
24 if (modules[i].isBase) {
31 export const mapStateToProps = ({
33 softwareProductAttachments: { heatSetup, heatSetupCache }
42 let isBaseExist = baseExists(modules);
54 export const mapActionsToProps = (dispatch, {}) => {
56 onModuleRename: (oldName, newName) =>
57 HeatSetupActionHelper.renameModule(dispatch, { oldName, newName }),
58 onModuleAdd: () => HeatSetupActionHelper.addModule(dispatch, !BASE),
59 onBaseAdd: () => HeatSetupActionHelper.addModule(dispatch, BASE),
60 onModuleDelete: moduleName =>
61 HeatSetupActionHelper.deleteModule(dispatch, moduleName),
62 onModuleFileTypeChange: ({ module, value, type }) =>
63 HeatSetupActionHelper.changeModuleFileType(dispatch, {
68 onToggleVolFilesDisplay: ({ module, value }) => {
69 HeatSetupActionHelper.toggleVolFilesDisplay(dispatch, {
74 onArtifactListChange: artifacts =>
75 HeatSetupActionHelper.changeArtifactList(dispatch, artifacts),
76 onAddAllUnassigned: () =>
77 HeatSetupActionHelper.addAllUnassignedFilesToArtifacts(dispatch)
81 export default connect(mapStateToProps, mapActionsToProps, null, {