disable undo and empty name validation
[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     getWorkflowId,
26     getWorkflowName
27 } from 'features/workflow/workflowSelectors';
28 import {
29     saveParamsAction,
30     certifyVersionAction
31 } from 'features/version/versionController/versionControllerConstants';
32 import { workflowVersionFetchRequestedAction } from '../versionConstants';
33 import { getIsCertified } from 'features/version/general/generalSelectors';
34 import { getIOErrors } from 'features/version/inputOutput/inputOutputSelectors';
35
36 function mapStateToProps(state) {
37     return {
38         workflowName: getWorkflowName(state),
39         workflowId: getWorkflowId(state),
40         versionsList: getSortedVersions(state),
41         savedParams: getSavedObjParams(state),
42         getIOErrors: getIOErrors(state),
43         isCertifyDisable: getIsCertified(state),
44         currentWorkflowVersion: state.currentVersion.general
45     };
46 }
47
48 function mapDispatchToProps(dispatch) {
49     return {
50         getVersions: () => dispatch(getVersions),
51         saveParamsToServer: params => dispatch(saveParamsAction(params)),
52         certifyVersion: payload => dispatch(certifyVersionAction(payload)),
53         changeVersion: payload =>
54             dispatch(workflowVersionFetchRequestedAction(payload))
55     };
56 }
57
58 export default connect(mapStateToProps, mapDispatchToProps)(
59     VersionControllerView
60 );