8fa2bffb27fb5276570f2cd6f4e31291b3f0f420
[sdc.git] /
1 /*!
2  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
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
13  * or implied. See the License for the specific language governing
14  * permissions and limitations under the License.
15  */
16 import React from 'react';
17 import PropTypes from 'prop-types';
18 import i18n from 'nfvo-utils/i18n/i18n.js';
19 import Modal from 'nfvo-components/modal/Modal.jsx';
20 import SoftwareProductProcessesEditor from './SoftwareProductComponentProcessesEditor.js';
21 import SoftwareProductProcessListView from 'sdc-app/onboarding/softwareProduct/processes/SoftwareProductProcessListView.jsx';
22
23 class SoftwareProductProcessesView extends React.Component {
24     state = {
25         localFilter: ''
26     };
27
28     static propTypes = {
29         onAddProcess: PropTypes.func,
30         onEditProcess: PropTypes.func,
31         onDeleteProcess: PropTypes.func,
32         isDisplayModal: PropTypes.bool,
33         isModalInEditMode: PropTypes.bool,
34         onStorageSelect: PropTypes.func,
35         componentId: PropTypes.string,
36         softwareProductId: PropTypes.string,
37         currentSoftwareProduct: PropTypes.object
38     };
39
40     render() {
41         return (
42             <div className="vsp-processes-page">
43                 <div className="software-product-view">
44                     <div className="software-product-landing-view-right-side vsp-components-processes-page flex-column">
45                         {this.renderEditor()}
46                         <SoftwareProductProcessListView
47                             addButtonTitle={i18n(
48                                 'Add Component Process Details'
49                             )}
50                             {...this.props}
51                         />
52                     </div>
53                 </div>
54             </div>
55         );
56     }
57
58     renderEditor() {
59         let {
60             softwareProductId,
61             version,
62             componentId,
63             isReadOnlyMode,
64             isDisplayModal,
65             isModalInEditMode
66         } = this.props;
67         return (
68             <Modal
69                 show={isDisplayModal}
70                 bsSize="large"
71                 animation={true}
72                 className="onborading-modal">
73                 <Modal.Header>
74                     <Modal.Title>
75                         {isModalInEditMode
76                             ? i18n('Edit Process Details')
77                             : i18n('Create New Process Details')}
78                     </Modal.Title>
79                 </Modal.Header>
80                 <Modal.Body className="edit-process-modal">
81                     <SoftwareProductProcessesEditor
82                         componentId={componentId}
83                         softwareProductId={softwareProductId}
84                         version={version}
85                         isReadOnlyMode={isReadOnlyMode}
86                     />
87                 </Modal.Body>
88             </Modal>
89         );
90     }
91 }
92
93 export default SoftwareProductProcessesView;