Fix name convention issue
[sdc/sdc-workflow-designer.git] / sdc-workflow-designer-ui / src / main / frontend / src / features / workflow / overview / views / WorkflowDetails.jsx
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, { Component } from 'react';
17 import { I18n } from 'react-redux-i18n';
18 import { Input, Button } from 'onap-ui-react';
19 import PropTypes from 'prop-types';
20
21 import Description from 'shared/components/Description';
22
23 class WorkflowDetails extends Component {
24     handleSubmitForm = e => {
25         e.preventDefault();
26         const { description } = this.props;
27         this.props.updateWorkflow(description);
28     };
29
30     render() {
31         const {
32             name,
33             description,
34             workflowDetailsChanged,
35             isArchive
36         } = this.props;
37         return (
38             <div className="workflow-details">
39                 <form onSubmit={this.handleSubmitForm}>
40                     <Input
41                         name="workflowName"
42                         value={name || ''}
43                         type="text"
44                         label={I18n.t('workflow.general.name')}
45                         isRequired
46                         disabled
47                     />
48                     <Description
49                         disabled={isArchive}
50                         description={description}
51                         onDataChange={workflowDetailsChanged}
52                     />
53                     <div className="save-description">
54                         <Button disabled={isArchive} btnType="primary">
55                             {I18n.t('buttons.saveBtn')}
56                         </Button>
57                     </div>
58                 </form>
59             </div>
60         );
61     }
62 }
63
64 WorkflowDetails.propTypes = {
65     name: PropTypes.string,
66     created: PropTypes.string,
67     modified: PropTypes.string,
68     description: PropTypes.string,
69     defaultDescription: PropTypes.string,
70     updateWorkflow: PropTypes.func,
71     workflowDetailsChanged: PropTypes.func,
72     isArchive: PropTypes.bool
73 };
74
75 export default WorkflowDetails;