diff --git a/src/ts/@overflow/app/views/layout/AppLayout.tsx b/src/ts/@overflow/app/views/layout/AppLayout.tsx index 60bb9dc..a15026f 100644 --- a/src/ts/@overflow/app/views/layout/AppLayout.tsx +++ b/src/ts/@overflow/app/views/layout/AppLayout.tsx @@ -3,7 +3,6 @@ import { Redirect, RouteComponentProps, RouteProps, Route, Switch } from 'react- import { Container, Menu, Sidebar, Segment, Icon, Breadcrumb, Grid, Dropdown } from 'semantic-ui-react'; import { Header } from './Header'; import { Footer } from './Footer'; -import TitleBarContainer from './TitleBarContainer'; import LeftMenu from './LeftMenu'; import Home from '../Home'; @@ -38,7 +37,6 @@ export class AppLayout extends React.Component {
- diff --git a/src/ts/@overflow/app/views/layout/ProbeDetailLayout.tsx b/src/ts/@overflow/app/views/layout/ProbeDetailLayout.tsx index 8b199ba..213a47f 100644 --- a/src/ts/@overflow/app/views/layout/ProbeDetailLayout.tsx +++ b/src/ts/@overflow/app/views/layout/ProbeDetailLayout.tsx @@ -42,7 +42,7 @@ export class ProbeDetailLayout extends React.Component {
- + diff --git a/src/ts/@overflow/app/views/layout/TitleBar.tsx b/src/ts/@overflow/app/views/layout/TitleBar.tsx index f066fe5..4a99108 100644 --- a/src/ts/@overflow/app/views/layout/TitleBar.tsx +++ b/src/ts/@overflow/app/views/layout/TitleBar.tsx @@ -4,6 +4,7 @@ import { Grid, Container, Breadcrumb, Header, Menu, Input, Segment } from 'seman export interface StateProps { sub: any; + title: any; } export interface DispatchProps { @@ -13,6 +14,7 @@ export interface DispatchProps { export type Props = StateProps & DispatchProps; export interface State { + selected: number; } export class TitleBar extends React.Component { @@ -20,11 +22,17 @@ export class TitleBar extends React.Component { constructor(props: any, context: any) { super(props, context); this.state = { + selected: 0, }; } - public handleMenu(menu:any): any { - this.props.onRedirect(menu.path); + public handleMenu(menu: any, index: number): any { + this.setState({ + selected: index, + }); + if (this.state.selected !== index) { + this.props.onRedirect(menu.path); + } } public renderSubMenus(): JSX.Element { @@ -34,15 +42,15 @@ export class TitleBar extends React.Component { } return subMenus.map((menu: any, index: number) => ( - + )); } public render(): JSX.Element { return ( - -
TEMP + +
{this.props.title} Home diff --git a/src/ts/@overflow/app/views/layout/TitleBarContainer.tsx b/src/ts/@overflow/app/views/layout/TitleBarContainer.tsx index 5ca518a..b56d32c 100644 --- a/src/ts/@overflow/app/views/layout/TitleBarContainer.tsx +++ b/src/ts/@overflow/app/views/layout/TitleBarContainer.tsx @@ -10,6 +10,7 @@ import { push as routerPush } from 'react-router-redux'; export function mapStateToProps(state: any, ownProps: any): StateProps { return { sub: ownProps.sub, + title: ownProps.title, }; } diff --git a/src/ts/@overflow/app/views/monitoring/probe/List.tsx b/src/ts/@overflow/app/views/monitoring/probe/List.tsx index 345de7a..f43e073 100644 --- a/src/ts/@overflow/app/views/monitoring/probe/List.tsx +++ b/src/ts/@overflow/app/views/monitoring/probe/List.tsx @@ -4,6 +4,7 @@ import ProbeListContainer from '@overflow/probe/react/ProbeList'; import WebSocketRPC from '@overflow/commons/websocket/WebSocketRPC'; import AppContext from '@overflow/commons/context'; import inject from '@overflow/commons/context/decorator/inject'; +import TitleBarContainer from '@overflow/app/views/layout/TitleBarContainer'; class ProbeList extends React.Component, object> { @inject() @@ -17,7 +18,10 @@ class ProbeList extends React.Component, object> { public render(): JSX.Element { return ( - +
+ + +
); } }