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