fix artifact not updating with versioning
[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
17 import React from 'react';
18 import { I18n } from 'react-redux-i18n';
19 import { Button } from 'sdc-ui/lib/react';
20 import PropTypes from 'prop-types';
21 import SvgButton from 'features/version/versionController/views/SvgButton';
22 import CompositionUpdate from 'features/version/composition/CompositionUpdate';
23
24 const ActionButtons = props => {
25     const {
26         onSaveClick,
27         certifyDisabled,
28         onCertifyClick,
29         isCompositionUpdating,
30         toggleCompositionUpdate,
31         onUndoClick,
32         saveDisabled
33     } = props;
34
35     return (
36         <div className="save-submit-cancel-container">
37             <div className="action-buttons">
38                 <div className="select-action-buttons">
39                     <div className={'separator vc-separator'} />
40                     <SvgButton
41                         dataTestId="vc-save-btn"
42                         name="version-controller-save"
43                         tooltipText={I18n.t('buttons.saveBtn')}
44                         disabled={saveDisabled}
45                         onClick={onSaveClick}
46                     />
47
48                     <div className={'separator vc-separator'} />
49
50                     <SvgButton
51                         dataTestId="vc-undo-btn"
52                         name="version-controller-undo"
53                         tooltipText={I18n.t('buttons.undoBtn')}
54                         disabled={certifyDisabled}
55                         onClick={onUndoClick}
56                     />
57
58                     <div className={'separator vc-separator'} />
59
60                     <Button
61                         className="certifyBtn"
62                         btnType="primary"
63                         disabled={certifyDisabled}
64                         onClick={() => toggleCompositionUpdate(true)}>
65                         {I18n.t('buttons.certifyBtn')}
66                     </Button>
67
68                     {isCompositionUpdating && (
69                         <CompositionUpdate
70                             certifyBack={() => {
71                                 toggleCompositionUpdate(false);
72                                 onCertifyClick();
73                             }}
74                         />
75                     )}
76                 </div>
77             </div>
78         </div>
79     );
80 };
81
82 ActionButtons.propTypes = {
83     onSaveClick: PropTypes.func,
84     certifyDisabled: PropTypes.bool,
85     onCertifyClick: PropTypes.func,
86     onUndoClick: PropTypes.func,
87     saveDisabled: PropTypes.bool,
88     isCompositionUpdating: PropTypes.bool,
89     toggleCompositionUpdate: PropTypes.func
90 };
91
92 export default ActionButtons;