blob: 978a87a3b027c7cb32d2fa605c151ac4bf8ce072 [file] [log] [blame]
brunomilitzer87111ee2021-05-18 12:50:32 +01001/*-
2 * ============LICENSE_START=======================================================
saul.gill80882862021-06-03 18:06:18 +01003 * Copyright (C) 2021 Nordix Foundation.
brunomilitzer87111ee2021-05-18 12:50:32 +01004 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
saul.gill80882862021-06-03 18:06:18 +01009 * http://www.apache.org/licenses/LICENSE-2.0
brunomilitzer87111ee2021-05-18 12:50:32 +010010 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
brunomilitzer87111ee2021-05-18 12:50:32 +010016 *
saul.gill80882862021-06-03 18:06:18 +010017 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
brunomilitzer87111ee2021-05-18 12:50:32 +010019 */
20import React from 'react';
21import Nav from 'react-bootstrap/Nav';
22import Navbar from 'react-bootstrap/Navbar';
23import NavDropdown from 'react-bootstrap/NavDropdown';
24import OnapConstants from '../../utils/OnapConstants';
25import 'bootstrap-css-only/css/bootstrap.min.css';
26import styled from 'styled-components';
27import { Link } from 'react-router-dom';
28
29const StyledLink = styled(Link)`
30 color: ${ props => props.theme.menuFontColor };
31 background-color: ${ props => props.theme.menuBackgroundColor };
32 font-weight: normal;
33 display: block;
34 width: 100%;
35 padding: .25rem 1.5rem;
36 clear: both;
37 text-align: inherit;
38 white-space: nowrap;
39 border: 0;
40
41 :hover {
42 text-decoration: none;
43 background-color: ${ props => props.theme.menuHighlightedBackgroundColor };
44 color: ${ props => props.theme.menuHighlightedFontColor };
45 }
46`;
47const StyledNavLink = styled(Nav.Link)`
48 color: ${ props => props.theme.menuFontColor };
49 background-color: ${ props => props.theme.menuBackgroundColor };
50 font-weight: normal;
51 padding: .25rem 1.5rem;
52
53 :hover {
54 background-color: ${ props => props.theme.menuHighlightedBackgroundColor };
55 color: ${ props => props.theme.menuHighlightedFontColor };
56 }
57`;
58
59const StyledNavDropdown = styled(NavDropdown)`
60 color: ${ props => props.theme.menuFontColor };
61
62 & .dropdown-toggle {
63 color: ${ props => props.theme.menuFontColor };
64 background-color: ${ props => props.theme.backgroundColor };
65 font-weight: normal;
66
67 :hover {
68 font-weight: bold;
69 }
70 }
71`;
72
73export default class MenuBar extends React.Component {
74 state = {
75 loopName: this.props.loopName,
76 disabled: true
77 };
78
79 componentWillReceiveProps(newProps) {
80 if (newProps.loopName !== OnapConstants.defaultLoopName) {
81 this.setState({ disabled: false });
82 } else {
83 this.setState({ disabled: true });
84 }
85 }
86
87 render() {
88 return (
89 <Navbar.Collapse>
saul.gill80882862021-06-03 18:06:18 +010090 <StyledNavDropdown title="Tosca">
91 <NavDropdown.Item as={ StyledLink } to="/readToscaTemplate">View Tosca Template</NavDropdown.Item>
saul.gill587fb7a2021-06-17 09:11:55 +010092 <NavDropdown.Item as={ StyledLink } to="/uploadToscaFile">Upload Tosca to Commissioning</NavDropdown.Item>
saul.gill80882862021-06-03 18:06:18 +010093 </StyledNavDropdown>
brunomilitzer87111ee2021-05-18 12:50:32 +010094 <StyledNavDropdown title="POLICY Framework">
95 <NavDropdown.Item as={ StyledLink } to="/viewAllPolicies">View All Policies</NavDropdown.Item>
96 </StyledNavDropdown>
97 <StyledNavDropdown title="CLAMP Options">
98 <NavDropdown.Item as={ StyledLink } to="/manageDictionaries">Tosca Metadata Dictionaries</NavDropdown.Item>
99 <NavDropdown.Divider/>
100 <NavDropdown.Item as={ StyledLink } to="/viewLoopTemplatesModal">View All Loop Templates</NavDropdown.Item>
101 </StyledNavDropdown>
102 <StyledNavDropdown title="LOOP Instance">
103 <NavDropdown.Item as={ StyledLink } to="/createLoop">Create</NavDropdown.Item>
104 <NavDropdown.Item as={ StyledLink } to="/openLoop">Open</NavDropdown.Item>
105 <NavDropdown.Item as={ StyledLink } to="/closeLoop" disabled={ this.state.disabled }>Close</NavDropdown.Item>
106 <NavDropdown.Item as={ StyledLink } to="/modifyLoop" disabled={ this.state.disabled }>Modify</NavDropdown.Item>
107 <NavDropdown.Divider/>
108 <NavDropdown.Item as={ StyledLink } to="/loopProperties" disabled={ this.state.disabled }>Properties</NavDropdown.Item>
109 <NavDropdown.Item as={ StyledLink } to="/refreshStatus" disabled={ this.state.disabled }>Refresh Status</NavDropdown.Item>
110 </StyledNavDropdown>
111 <StyledNavDropdown title="LOOP Operations">
112 <NavDropdown.Item as={ StyledLink } to="/submit" disabled={ this.state.disabled }>Create and deploy to Policy Framework (SUBMIT)</NavDropdown.Item>
113 <NavDropdown.Item as={ StyledLink } to="/stop" disabled={ this.state.disabled }>Undeploy from Policy Framework (STOP)</NavDropdown.Item>
114 <NavDropdown.Item as={ StyledLink } to="/restart" disabled={ this.state.disabled }>ReDeploy to Policy Framework (RESTART)</NavDropdown.Item>
115 <NavDropdown.Item as={ StyledLink } to="/delete" disabled={ this.state.disabled }>Delete loop instance (DELETE)</NavDropdown.Item>
116 <NavDropdown.Divider/>
117 <NavDropdown.Item as={ StyledLink } to="/deploy" disabled={ this.state.disabled }>Deploy to DCAE (DEPLOY)</NavDropdown.Item>
118 <NavDropdown.Item as={ StyledLink } to="/undeploy" disabled={ this.state.disabled }>UnDeploy to DCAE (UNDEPLOY)</NavDropdown.Item>
119 </StyledNavDropdown>
120 <StyledNavDropdown title="Help">
121 <StyledNavLink href="https://wiki.onap.org/" target="_blank">Wiki</StyledNavLink>
122 <StyledNavLink href="mailto:onap-discuss@lists.onap.org?subject=CLAMP&body=Please send us suggestions or feature enhancements or defect. If possible, please send us the steps to replicate any defect.">Contact
123 Us</StyledNavLink>
124 <NavDropdown.Item as={ StyledLink } to="/userInfo">User Info</NavDropdown.Item>
125 </StyledNavDropdown>
126 </Navbar.Collapse>
127 );
128 }
129}