blob: 7cf56570b575f7298de887632dbd2950419c7b57 [file] [log] [blame]
sebdetc8d61302019-07-04 15:50:34 +02001/*-
2 * ============LICENSE_START=======================================================
3 * ONAP CLAMP
4 * ================================================================================
5 * Copyright (C) 2019 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';
xuegao5fe750c2019-08-06 13:03:53 +020024import Nav from 'react-bootstrap/Nav';
sebdetc8d61302019-07-04 15:50:34 +020025import Navbar from 'react-bootstrap/Navbar';
26import NavDropdown from 'react-bootstrap/NavDropdown';
Ted Humphrey01e5fde2020-01-27 18:57:39 -050027import OnapConstants from '../../utils/OnapConstants';
sebdetc8d61302019-07-04 15:50:34 +020028import 'bootstrap-css-only/css/bootstrap.min.css';
29import styled from 'styled-components';
sebdetd0d65632019-08-26 05:47:01 -070030import { Link } from 'react-router-dom';
sebdetc8d61302019-07-04 15:50:34 +020031
sebdet8a02dd72019-07-31 17:11:11 +020032const StyledLink = styled(Link)`
sebdetd0d65632019-08-26 05:47:01 -070033 color: ${props => props.theme.menuFontColor};
sebdet8a02dd72019-07-31 17:11:11 +020034 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 :hover {
sebdetd0d65632019-08-26 05:47:01 -070044 text-decoration: none;
45 background-color: ${props => props.theme.menuHighlightedBackgroundColor};
46 color: ${props => props.theme.menuHighlightedFontColor};
sebdetc8d61302019-07-04 15:50:34 +020047 }
48`;
xuegao5fe750c2019-08-06 13:03:53 +020049const StyledNavLink = styled(Nav.Link)`
sebdetd0d65632019-08-26 05:47:01 -070050 color: ${props => props.theme.menuFontColor};
xuegao5fe750c2019-08-06 13:03:53 +020051 background-color: ${props => props.theme.menuBackgroundColor};
sebdetd0d65632019-08-26 05:47:01 -070052 font-weight: normal;
xuegao5fe750c2019-08-06 13:03:53 +020053 padding: .25rem 1.5rem;
54 :hover {
sebdetd0d65632019-08-26 05:47:01 -070055 background-color: ${props => props.theme.menuHighlightedBackgroundColor};
56 color: ${props => props.theme.menuHighlightedFontColor};
xuegao5fe750c2019-08-06 13:03:53 +020057 }
58`;
sebdetd0d65632019-08-26 05:47:01 -070059
60const StyledNavDropdown = styled(NavDropdown)`
61 color: ${props => props.theme.menuFontColor};
62 & .dropdown-toggle {
63 color: ${props => props.theme.menuFontColor};
64 background-color: ${props => props.theme.backgroundColor};
65 font-weight: normal;
66 :hover {
67 font-weight: bold;
68 }
69 }
70`;
71
sebdetc8d61302019-07-04 15:50:34 +020072export default class MenuBar extends React.Component {
xuegao691e2b72019-08-16 11:07:24 +020073 state = {
74 loopName: this.props.loopName,
75 disabled: true
76 };
77
78 componentWillReceiveProps(newProps) {
Ted Humphrey01e5fde2020-01-27 18:57:39 -050079 if (newProps.loopName !== OnapConstants.defaultLoopName) {
xuegao691e2b72019-08-16 11:07:24 +020080 this.setState({ disabled: false });
81 } else {
82 this.setState({ disabled: true });
83 }
84 }
xuegao5fe750c2019-08-06 13:03:53 +020085
sebdetc8d61302019-07-04 15:50:34 +020086 render () {
sebdet8a02dd72019-07-31 17:11:11 +020087 return (
xuegao5fe750c2019-08-06 13:03:53 +020088 <Navbar.Collapse>
sebdetaa486be2020-02-18 02:00:11 -080089 <StyledNavDropdown title="Loop Templates">
90 <NavDropdown.Item as={StyledLink} to="/ViewLoopTemplatesModal">View All Templates</NavDropdown.Item>
drveerendraf6b26252019-10-31 12:45:30 -040091 </StyledNavDropdown>
sebdetaa486be2020-02-18 02:00:11 -080092 <StyledNavDropdown title="Policy Models">
93 <NavDropdown.Item as={StyledLink} to="/uploadToscaPolicyModal">Upload Tosca Model</NavDropdown.Item>
94 <NavDropdown.Item as={StyledLink} to="/viewToscaPolicyModal">View Tosca Models</NavDropdown.Item>
sebdet8604d372020-03-10 02:44:53 -070095 <NavDropdown.Item as={StyledLink} to="/ManageDictionaries">Manage Metadata Dictionaries</NavDropdown.Item>
drveerendra50320952020-03-04 20:30:44 -050096 </StyledNavDropdown>
sebdetaa486be2020-02-18 02:00:11 -080097 <StyledNavDropdown title="Loop Instance">
sebdetd2a4df02020-02-26 15:47:30 -080098 <NavDropdown.Item as={StyledLink} to="/createLoop">Create</NavDropdown.Item>
sebdet8604d372020-03-10 02:44:53 -070099 <NavDropdown.Item as={StyledLink} to="/openLoop">Open</NavDropdown.Item>
100 <NavDropdown.Item as={StyledLink} to="/closeLoop" disabled={this.state.disabled}>Close</NavDropdown.Item>
101 <NavDropdown.Item as={StyledLink} to="/modifyLoop" disabled={this.state.disabled}>Modify</NavDropdown.Item>
102 <NavDropdown.Divider />
sebdetaa486be2020-02-18 02:00:11 -0800103 <NavDropdown.Item as={StyledLink} to="/loopProperties" disabled={this.state.disabled}>Properties</NavDropdown.Item>
xuegao691e2b72019-08-16 11:07:24 +0200104 <NavDropdown.Item as={StyledLink} to="/refreshStatus" disabled={this.state.disabled}>Refresh Status</NavDropdown.Item>
sebdetd0d65632019-08-26 05:47:01 -0700105 </StyledNavDropdown>
sebdetaa486be2020-02-18 02:00:11 -0800106 <StyledNavDropdown title="Loop Operations">
107 <NavDropdown.Item as={StyledLink} to="/submit" disabled={this.state.disabled}>Create and deploy to Policy Engine(SUBMIT)</NavDropdown.Item>
108 <NavDropdown.Item as={StyledLink} to="/stop" disabled={this.state.disabled}>Undeploy from Policy Engine (STOP)</NavDropdown.Item>
109 <NavDropdown.Item as={StyledLink} to="/restart" disabled={this.state.disabled}>ReDeploy to Policy Engine (RESTART)</NavDropdown.Item>
110 <NavDropdown.Item as={StyledLink} to="/delete" disabled={this.state.disabled}>Delete loop instance (DELETE)</NavDropdown.Item>
sebdet2d28cbf2020-02-27 14:43:57 -0800111 <NavDropdown.Divider />
sebdetaa486be2020-02-18 02:00:11 -0800112 <NavDropdown.Item as={StyledLink} to="/deploy" disabled={this.state.disabled}>Deploy to DCAE (DEPLOY)</NavDropdown.Item>
113 <NavDropdown.Item as={StyledLink} to="/undeploy" disabled={this.state.disabled}>UnDeploy to DCAE (UNDEPLOY)</NavDropdown.Item>
114 </StyledNavDropdown>
sebdetd0d65632019-08-26 05:47:01 -0700115 <StyledNavDropdown title="Help">
xuegao5fe750c2019-08-06 13:03:53 +0200116 <StyledNavLink href="https://wiki.onap.org/" target="_blank">Wiki</StyledNavLink>
117 <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 Us</StyledNavLink>
118 <NavDropdown.Item as={StyledLink} to="/userInfo">User Info</NavDropdown.Item>
sebdetd0d65632019-08-26 05:47:01 -0700119 </StyledNavDropdown>
sebdet8a02dd72019-07-31 17:11:11 +0200120 </Navbar.Collapse>
121 );
122 }
sebdetc8d61302019-07-04 15:50:34 +0200123}