fix artifact not updating with versioning
[sdc/sdc-workflow-designer.git] / workflow-designer-ui / src / main / frontend / src / features / version / versionController / VersionController.js
1 /*
2 * Copyright © 2018 European Support Limited
3 *
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
7 *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 */
16
17 import { connect } from 'react-redux';
18 import { getSavedObjParams } from 'features/version/versionController/versionControllerSelectors';
19 import VersionControllerView from 'features/version/versionController/VersionControllerView';
20 import {
21     getVersions,
22     getSortedVersions
23 } from 'features/workflow/overview/overviewSelectors';
24 import {
25     isWorkflowArchive,
26     getWorkflowId,
27     getWorkflowName
28 } from 'features/workflow/workflowSelectors';
29 import {
30     saveParamsAction,
31     certifyVersionAction
32 } from 'features/version/versionController/versionControllerConstants';
33 import {
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';
42
43 function mapStateToProps(state) {
44     return {
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)
55     };
56 }
57
58 function mapDispatchToProps(dispatch) {
59     return {
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))
67     };
68 }
69
70 export default connect(
71     mapStateToProps,
72     mapDispatchToProps
73 )(VersionControllerView);