routtttttttttttttttttttttttttttte

This commit is contained in:
insanity 2017-07-21 16:54:13 +09:00
parent a63f1c013d
commit a48ced2333
5 changed files with 37 additions and 36 deletions

View File

@ -1,11 +1,12 @@
import * as React from 'react'; import * as React from 'react';
import { RouteComponentProps, RouteProps, Route } from 'react-router-dom'; import { RouteComponentProps, RouteProps, Route, Switch } from 'react-router-dom';
import { Container, Menu, Sidebar, Segment, Icon, Breadcrumb, Grid, Dropdown } from 'semantic-ui-react'; import { Container, Menu, Sidebar, Segment, Icon, Breadcrumb, Grid, Dropdown } from 'semantic-ui-react';
import { Header } from './Header'; import { Header } from './Header';
import { Footer } from './Footer'; import { Footer } from './Footer';
import LeftMenu from './LeftMenu'; import LeftMenu from './LeftMenu';
import ProbeList from '../monitoring/probe/List'; import ProbeList from '../monitoring/probe/List';
import ProbeDetail from '../monitoring/probe/Detail';
export interface Props extends RouteComponentProps<any> { export interface Props extends RouteComponentProps<any> {
} }
@ -30,16 +31,17 @@ export class AppLayout extends React.Component<Props, State> {
public render(): JSX.Element { public render(): JSX.Element {
return ( return (
<Container fluid> <Container fluid>
<LeftMenu /> <LeftMenu />
<Segment vertical style={{ margin: '0 0 0 210px', padding: '0' }}> <Segment vertical style={{ margin: '0 0 0 210px', padding: '0' }}>
<Header /> <Header />
<Route path={`${this.props.match.url}/probe`} component={ProbeList} /> <Route exact path={`${this.props.match.url}/probe`} component={ProbeList} />
<Route exact path={`${this.props.match.url}/probe/:id`} component={ProbeDetail} />
<Footer /> <Footer />
</Segment> </Segment>
</Container > </Container >
); );
} }
} }

View File

@ -5,7 +5,7 @@ import WebSocketRPC from '@overflow/commons/websocket/WebSocketRPC';
import AppContext from '@overflow/commons/context'; import AppContext from '@overflow/commons/context';
import inject from '@overflow/commons/context/decorator/inject'; import inject from '@overflow/commons/context/decorator/inject';
class ProbeList extends React.Component<RouteComponentProps<object>, object> { class ProbeDetail extends React.Component<RouteComponentProps<object>, object> {
@inject() @inject()
private client: WebSocketRPC; private client: WebSocketRPC;
@ -23,4 +23,4 @@ class ProbeList extends React.Component<RouteComponentProps<object>, object> {
} }
export default ProbeList; export default ProbeDetail;

View File

@ -7,7 +7,6 @@ import {
export function mapStateToProps(state: any): ProbeDetailStateProps { export function mapStateToProps(state: any): ProbeDetailStateProps {
return { return {
probe: state.probe,
}; };
} }

View File

@ -1,16 +1,17 @@
import * as React from 'react'; import * as React from 'react';
import { Button, import {
Button,
Table, Table,
Label, Label,
Segment, Segment,
Header, Header,
Container, Container,
} from 'semantic-ui-react'; } from 'semantic-ui-react';
import { TargetTable } from '@overflow/target/react/components/TargetList'; // import { TargetTable } from '@overflow/target/react/components/TargetList';
import Probe from '@overflow/probe/api/model/Probe'; import Probe from '@overflow/probe/api/model/Probe';
export interface StateProps { export interface StateProps {
probe: Probe;
} }
export interface DispatchProps { export interface DispatchProps {
@ -33,16 +34,21 @@ export class ProbeDetail extends React.Component<Props, State> {
public render(): JSX.Element { public render(): JSX.Element {
return ( return (
<Container fluid> <Container fluid>
<ProbeBasicInfo probe={this.props.probe} /> Probe Detail....id: ?
<TargetTable /> {/* <ProbeBasicInfo probe={null} />
<TargetTable /> */}
</Container> </Container>
); );
} }
} }
export class ProbeBasicInfo extends React.Component<Props, State> { export interface DetailProps {
probe: Probe;
}
constructor(props: Props, context: State) { export class ProbeBasicInfo extends React.Component<DetailProps, State> {
constructor(props: DetailProps, context: State) {
super(props, context); super(props, context);
this.state = { this.state = {
}; };
@ -55,20 +61,20 @@ export class ProbeBasicInfo extends React.Component<Props, State> {
alert('Discovery'); alert('Discovery');
} }
public showStartStopBtn(): JSX.Element { // public showStartStopBtn(): JSX.Element {
let temp: any = null; // let temp: any = null;
temp = this.props.probe; // temp = this.props.probe;
if (temp.metaProbeStatus.name === 'STARTED') { // if (temp.metaProbeStatus.name === 'STARTED') {
return <Button content='Stop' icon='stop' labelPosition='left' color={'blue'} floated={'right'} onClick={this.handleStartStop} />; // return <Button content='Stop' icon='stop' labelPosition='left' color={'blue'} floated={'right'} onClick={this.handleStartStop} />;
} else { // } else {
return <Button content='Start' icon='play' labelPosition='left' color={'blue'} floated={'right'} onClick={this.handleStartStop} />; // return <Button content='Start' icon='play' labelPosition='left' color={'blue'} floated={'right'} onClick={this.handleStartStop} />;
} // }
} // }
public render(): JSX.Element { public render(): JSX.Element {
return ( return (
<Container fluid> <Container fluid>
<Header as='h3' dividing>Probe Info</Header> {/* <Header as='h3' dividing>Probe Info</Header>
<Table celled={false}> <Table celled={false}>
<Table.Body> <Table.Body>
<Table.Row> <Table.Row>
@ -111,7 +117,7 @@ export class ProbeBasicInfo extends React.Component<Props, State> {
</Table> </Table>
<Button content='Discovery' icon='search' labelPosition='left' floated={'right'} positive onClick={this.handleDiscovery} /> <Button content='Discovery' icon='search' labelPosition='left' floated={'right'} positive onClick={this.handleDiscovery} />
{this.showStartStopBtn()} {this.showStartStopBtn()} */}
</Container> </Container>
); );

View File

@ -16,7 +16,6 @@ export type Props = StateProps & DispatchProps;
export interface State { export interface State {
selected: Probe; selected: Probe;
isDetail: boolean;
list: Probe[]; list: Probe[];
} }
@ -29,7 +28,6 @@ export class ProbeList extends React.Component<Props, State> {
this.state = { this.state = {
selected: null, selected: null,
isDetail: false,
list: null, list: null,
}; };
} }
@ -96,7 +94,6 @@ export class ProbeList extends React.Component<Props, State> {
public handleSelect(selectedProbe: any): void { public handleSelect(selectedProbe: any): void {
this.setState({ this.setState({
selected: selectedProbe, selected: selectedProbe,
isDetail: true,
}); });
} }
@ -125,9 +122,6 @@ export class ProbeList extends React.Component<Props, State> {
} }
public render(): JSX.Element { public render(): JSX.Element {
if (this.state.isDetail) {
return <ProbeDetail probe={this.state.selected} />;
}
let probeList = let probeList =
<Container fluid> <Container fluid>
<Table selectable striped> <Table selectable striped>