2 * Copyright © 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.
17 import { connect } from 'react-redux';
18 import { getSavedObjParams } from 'features/version/versionController/versionControllerSelectors';
19 import VersionControllerView from 'features/version/versionController/VersionControllerView';
23 } from 'features/workflow/overview/overviewSelectors';
28 } from 'features/workflow/workflowSelectors';
32 } from 'features/version/versionController/versionControllerConstants';
34 workflowVersionFetchRequestedAction,
35 toggleCompositionUpdate,
36 getIsCompositionUpdating
37 } from 'features/version/versionConstants';
38 import { getIsCertified } from 'features/version/general/generalSelectors';
39 import { getIOErrors } from 'features/version/inputOutput/inputOutputSelectors';
40 import { getCompositionHasErrors } from 'features/version/composition/compositionSelectors';
41 import { pluginContextSelector } from 'wfapp/pluginContext/pluginContextSelector';
43 function mapStateToProps(state) {
45 workflowName: getWorkflowName(state),
46 workflowId: getWorkflowId(state),
47 versionsList: getSortedVersions(state),
48 savedParams: getSavedObjParams(state),
49 hasErrors: getIOErrors(state) || getCompositionHasErrors(state),
50 isCertifyDisable: getIsCertified(state),
51 isArchive: isWorkflowArchive(state),
52 currentWorkflowVersion: state.currentVersion.general,
53 pluginContext: pluginContextSelector(state),
54 isCompositionUpdating: getIsCompositionUpdating(state)
58 function mapDispatchToProps(dispatch) {
60 getVersions: () => dispatch(getVersions),
61 saveParamsToServer: params => dispatch(saveParamsAction(params)),
62 certifyVersion: payload => dispatch(certifyVersionAction(payload)),
63 changeVersion: payload =>
64 dispatch(workflowVersionFetchRequestedAction(payload)),
65 toggleCompositionUpdate: payload =>
66 dispatch(toggleCompositionUpdate(payload))
70 export default connect(
73 )(VersionControllerView);