2 * Copyright © 2016-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 React from 'react';
18 import { connect } from 'react-redux';
19 import i18n from 'nfvo-utils/i18n/i18n.js';
20 import Form from 'nfvo-components/input/validation/Form.jsx';
21 import Input from 'nfvo-components/input/validation/Input.jsx';
22 import { actionTypes as modalActionTypes } from 'nfvo-components/modal/GlobalModalConstants.js';
23 import keyMirror from 'nfvo-utils/KeyMirror.js';
25 export const CommitModalType = keyMirror({
30 export const mapActionToProps = dispatch => {
34 type: modalActionTypes.GLOBAL_MODAL_CLOSE
39 class CommitCommentModal extends React.Component {
45 const { onCommit, onClose, type } = this.props;
46 const [commitButtonText, descriptionText] =
47 type === CommitModalType.COMMIT
48 ? [i18n('Commit'), i18n('You are about to commit your version')]
50 i18n('Commit & Submit'),
51 i18n('You must commit your changes before the submit')
59 onCommit(this.state.comment);
63 submitButtonText={commitButtonText}
66 btnClassName="sdc-modal__footer"
67 className="comment-commit-form">
68 <div className="commit-modal-text">{descriptionText}</div>
70 data-test-id="commit-comment-text"
71 onChange={comment => this.setState({ comment: comment })}
72 label={i18n('Enter Commit Comment:')}
73 value={this.state.comment}
75 groupClassName="no-bottom-margin"
82 export default connect(null, mapActionToProps)(CommitCommentModal);