3 * Copyright 2016 RIFT.IO Inc
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
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 import React from 'react';
20 export default class LaunchpadBreadcrumbs extends React.Component {
24 this.current = props.current;
29 componentWillReceiveProps(props) {
32 breadcrumbItem(url, name, isCurrent) {
34 return (<span className="current">{name}</span>);
36 return (<a href={url} onClick={this.props.clickHandler}>{name}</a>);
40 let mgmtDomainName = window.location.hash.split('/')[2];
41 let nsrId = window.location.hash.split('/')[3];
42 let url_base = '#/launchpad/' + mgmtDomainName + '/' + nsrId;
44 <div className="header-nav">
45 <a href={'#/launchpad/' + mgmtDomainName} onClick={this.props.clickHandler}>DASHBOARD</a>
46 <span className="spacer"> > </span>
47 {this.breadcrumbItem(url_base+'/detail', 'Viewport', (this.props.current == 'viewport'))}
48 <span className="spacer"> | </span>
49 {this.breadcrumbItem(url_base+'/topology', 'Topology', (this.props.current == 'topology' ))}
50 <span className="spacer"> | </span>
51 {this.breadcrumbItem(url_base+'/topologyL2', 'Topology L2', (this.props.current == 'topologyL2' ))}
52 <span className="spacer"> | </span>
53 {this.breadcrumbItem(url_base+'/topologyL2Vm', 'Topology L2Vm', (this.props.current == 'topologyL2Vm'))}