disable undo and empty name validation
[sdc/sdc-workflow-designer.git] / workflow-designer-ui / src / main / frontend / src / features / version / versionController / views / ActionButtons.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 import React from 'react';
17 import { I18n } from 'react-redux-i18n';
18 import { Button } from 'sdc-ui/lib/react';
19 import PropTypes from 'prop-types';
20 import SvgButton from 'features/version/versionController/views/SvgButton';
21
22 const Separator = () => <div className="vc-separator" />;
23
24 const ActionButtons = props => {
25     const {
26         onSaveClick,
27         certifyDisabled,
28         onCertifyClick,
29         onUndoClick,
30         saveDisabled
31     } = props;
32     return (
33         <div className="save-submit-cancel-container">
34             <div className="action-buttons">
35                 <div className="select-action-buttons">
36                     <Separator />
37                     <SvgButton
38                         dataTestId="vc-save-btn"
39                         name="version-controller-save"
40                         tooltipText={I18n.t('buttons.saveBtn')}
41                         disabled={saveDisabled}
42                         onClick={onSaveClick}
43                     />
44                     <Separator />
45                     <SvgButton
46                         dataTestId="vc-undo-btn"
47                         name="version-controller-undo"
48                         tooltipText={I18n.t('buttons.undoBtn')}
49                         disabled={certifyDisabled}
50                         onClick={onUndoClick}
51                     />
52                     <Separator />
53                     <Button
54                         className="certifyBtn"
55                         btnType="primary"
56                         disabled={certifyDisabled}
57                         onClick={onCertifyClick}>
58                         {I18n.t('buttons.certifyBtn')}
59                     </Button>
60                 </div>
61             </div>
62         </div>
63     );
64 };
65
66 ActionButtons.propTypes = {
67     onSaveClick: PropTypes.func,
68     certifyDisabled: PropTypes.bool,
69     onCertifyClick: PropTypes.func,
70     onUndoClick: PropTypes.func,
71     saveDisabled: PropTypes.bool
72 };
73
74 export default ActionButtons;