2 * Copyright © 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.
16 import React from 'react';
17 import PropTypes from 'prop-types';
18 import { I18n } from 'react-redux-i18n';
19 import { SVGIcon, Button } from 'onap-ui-react';
20 import ArchiveLabel from 'shared/archiveLabel/ArchiveLabel';
22 const Buttons = ({ history, archiveWorkflow, restoreWorkflow, isArchive }) => (
23 <div className="header-buttons">
25 onClick={() => history.push('/workflows/')}
26 label={I18n.t('workflow.overview.backBtnLabel')}
27 className="go-catalog-btn"
33 restoreWorkflow={restoreWorkflow}
34 archiveWorkflow={archiveWorkflow}
40 history: PropTypes.object,
41 archiveWorkflow: PropTypes.func,
42 isArchive: PropTypes.bool,
43 restoreWorkflow: PropTypes.func
46 const Title = ({ name, isArchive }) => (
47 <div className="title">
48 {name} - {I18n.t('workflow.overview.title')}
49 {isArchive && <ArchiveLabel />}
53 name: PropTypes.string,
54 isArchive: PropTypes.bool
57 const ArchiveBtn = ({ isArchive, archiveWorkflow, restoreWorkflow }) => {
60 onClick={archiveWorkflow}
61 title="Archive workflow"
62 className="archive-btn"
66 <Button className="restore-btn" onClick={restoreWorkflow}>
71 ArchiveBtn.propTypes = {
72 status: PropTypes.string,
73 archiveWorkflow: PropTypes.func,
74 restoreWorkflow: PropTypes.func,
75 isArchive: PropTypes.bool
78 const WorkflowHeader = ({
86 <div className="overview-header">
87 <Title isArchive={isArchive} name={name} />
89 restoreWorkflow={restoreWorkflow}
90 archiveWorkflow={archiveWorkflow}
98 WorkflowHeader.propTypes = {
99 name: PropTypes.string,
100 history: PropTypes.object,
101 archiveWorkflow: PropTypes.func,
102 restoreWorkflow: PropTypes.func,
103 isArchive: PropTypes.bool
106 export default WorkflowHeader;