brunomilitzer | 87111ee | 2021-05-18 12:50:32 +0100 | [diff] [blame] | 1 | /*- |
| 2 | * ============LICENSE_START======================================================= |
saul.gill | 8088286 | 2021-06-03 18:06:18 +0100 | [diff] [blame] | 3 | * Copyright (C) 2021 Nordix Foundation. |
brunomilitzer | 87111ee | 2021-05-18 12:50:32 +0100 | [diff] [blame] | 4 | * ================================================================================ |
| 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.gill | 8088286 | 2021-06-03 18:06:18 +0100 | [diff] [blame] | 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
brunomilitzer | 87111ee | 2021-05-18 12:50:32 +0100 | [diff] [blame] | 10 | * |
| 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. |
brunomilitzer | 87111ee | 2021-05-18 12:50:32 +0100 | [diff] [blame] | 16 | * |
saul.gill | 8088286 | 2021-06-03 18:06:18 +0100 | [diff] [blame] | 17 | * SPDX-License-Identifier: Apache-2.0 |
| 18 | * ============LICENSE_END========================================================= |
brunomilitzer | 87111ee | 2021-05-18 12:50:32 +0100 | [diff] [blame] | 19 | */ |
| 20 | import React from 'react'; |
| 21 | import Nav from 'react-bootstrap/Nav'; |
| 22 | import Navbar from 'react-bootstrap/Navbar'; |
| 23 | import NavDropdown from 'react-bootstrap/NavDropdown'; |
| 24 | import OnapConstants from '../../utils/OnapConstants'; |
| 25 | import 'bootstrap-css-only/css/bootstrap.min.css'; |
| 26 | import styled from 'styled-components'; |
| 27 | import { Link } from 'react-router-dom'; |
| 28 | |
| 29 | const 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 | `; |
| 47 | const 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 | |
| 59 | const 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 | |
| 73 | export 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.gill | 8088286 | 2021-06-03 18:06:18 +0100 | [diff] [blame] | 90 | <StyledNavDropdown title="Tosca"> |
| 91 | <NavDropdown.Item as={ StyledLink } to="/readToscaTemplate">View Tosca Template</NavDropdown.Item> |
saul.gill | 587fb7a | 2021-06-17 09:11:55 +0100 | [diff] [blame^] | 92 | <NavDropdown.Item as={ StyledLink } to="/uploadToscaFile">Upload Tosca to Commissioning</NavDropdown.Item> |
saul.gill | 8088286 | 2021-06-03 18:06:18 +0100 | [diff] [blame] | 93 | </StyledNavDropdown> |
brunomilitzer | 87111ee | 2021-05-18 12:50:32 +0100 | [diff] [blame] | 94 | <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 | } |