temporary breadcrumb
This commit is contained in:
parent
687034778e
commit
81049e375f
|
@ -52,18 +52,22 @@ export class TitleBar extends React.Component<Props, State> {
|
||||||
return this.capitalizeFirst(pathArr[1]);
|
return this.capitalizeFirst(pathArr[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public handleBreadcrumb = (path: string) => {
|
||||||
|
console.log(path);
|
||||||
|
this.props.onRedirect(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
// temporary
|
||||||
public renderBreadcrumb(): JSX.Element[] {
|
public renderBreadcrumb(): JSX.Element[] {
|
||||||
let elems: JSX.Element[] = new Array();
|
let elems: JSX.Element[] = new Array();
|
||||||
let pathArr = this.props.location.split('/');
|
let pathArr = this.props.location.split('/');
|
||||||
|
|
||||||
if (pathArr[1].indexOf('probe') > -1 || pathArr[1].indexOf('sensor') > -1) {
|
for (let item of pathArr) {
|
||||||
elems.push(<Breadcrumb.Section link>Monitoring</Breadcrumb.Section>);
|
if (item !== '' && !item.match(/^\d+$/)) {
|
||||||
elems.push(<Breadcrumb.Divider />);
|
let path = '/' + item;
|
||||||
elems.push(<Breadcrumb.Section link active>{this.capitalizeFirst(pathArr[1])}</Breadcrumb.Section>);
|
elems.push(<Breadcrumb.Section onClick={this.handleBreadcrumb.bind(this, path)}>{this.capitalizeFirst(item)}</Breadcrumb.Section>);
|
||||||
}else if (pathArr[1].indexOf('target') > -1) {
|
elems.push(<Breadcrumb.Divider />);
|
||||||
elems.push(<Breadcrumb.Section link>Infrastructure</Breadcrumb.Section>);
|
}
|
||||||
elems.push(<Breadcrumb.Divider />);
|
|
||||||
elems.push(<Breadcrumb.Section link active>{this.capitalizeFirst(pathArr[1])}</Breadcrumb.Section>);
|
|
||||||
}
|
}
|
||||||
return elems;
|
return elems;
|
||||||
}
|
}
|
||||||
|
@ -75,7 +79,7 @@ export class TitleBar extends React.Component<Props, State> {
|
||||||
<Header as='h3'>{this.showTitle()}
|
<Header as='h3'>{this.showTitle()}
|
||||||
<Header.Subheader>
|
<Header.Subheader>
|
||||||
<Breadcrumb size='mini'>
|
<Breadcrumb size='mini'>
|
||||||
<Breadcrumb.Section link>Home</Breadcrumb.Section>
|
<Breadcrumb.Section onClick={this.handleBreadcrumb.bind(this, '/')}>Home</Breadcrumb.Section>
|
||||||
<Breadcrumb.Divider />
|
<Breadcrumb.Divider />
|
||||||
{this.renderBreadcrumb()}
|
{this.renderBreadcrumb()}
|
||||||
</Breadcrumb>
|
</Breadcrumb>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user