discovery

This commit is contained in:
geek 2017-07-25 17:19:40 +09:00
parent 987995e026
commit 65bc4425f0
3 changed files with 41 additions and 9 deletions

View File

@ -52,12 +52,12 @@ export class Discovery extends React.Component<Props, State> {
this.handleProbeChange.bind(this); this.handleProbeChange.bind(this);
this.state = { this.state = {
startPopup:false, startPopup:false,
probeTemp:probeTemp, probeTemp:null,
}; };
} }
public componentWillMount():void { public componentWillMount():void {
this.setState({probeTemp:probeTemp});
} }
public handleProbeChange(obj: Object): void { public handleProbeChange(obj: Object): void {
@ -78,7 +78,7 @@ export class Discovery extends React.Component<Props, State> {
return ( return (
<Container fluid> <Container fluid>
<Header as='h3' dividing> Discovery Details</Header> <Header as='h3' dividing> Discovery Details</Header>
<DiscoveryProbe probe={this.state.probeTemp}/> {/*<DiscoveryProbe probe={this.state.probeTemp}/>*/}
<br /> <br />
<DiscoveryTable onProbeChange={this.handleProbeChange.bind(this)} /> <DiscoveryTable onProbeChange={this.handleProbeChange.bind(this)} />

View File

@ -4,6 +4,9 @@ import {
StateProps as ProbeDetailStateProps, StateProps as ProbeDetailStateProps,
DispatchProps as ProbeDetailDispatchProps, DispatchProps as ProbeDetailDispatchProps,
} from './components/ProbeDetailInfo'; } from './components/ProbeDetailInfo';
import { push as routerPush } from 'react-router-redux';
import Probe from '@overflow/probe/api/model/Probe';
export function mapStateToProps(state: any, props: any): ProbeDetailStateProps { export function mapStateToProps(state: any, props: any): ProbeDetailStateProps {
return { return {
@ -13,6 +16,9 @@ export function mapStateToProps(state: any, props: any): ProbeDetailStateProps {
export function mapDispatchToProps(dispatch: Dispatch<any>): ProbeDetailDispatchProps { export function mapDispatchToProps(dispatch: Dispatch<any>): ProbeDetailDispatchProps {
return { return {
// onDiscoverySelect: ( id: string) => {
// dispatch(routerPush('/discovery/' + id ));
// },
}; };
} }

View File

@ -9,19 +9,22 @@ import {
} 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';
import {Discovery} from '../../../discovery/react/components/Discovery';
export interface StateProps { export interface StateProps {
id: string; id: string;
} }
export interface DispatchProps { export interface DispatchProps {
// onDiscoverySelect(id:string):void;
} }
export type Props = StateProps & DispatchProps; export type Props = StateProps & DispatchProps;
export interface State { export interface State {
probe: Probe; probe: Probe;
id: string;
isDiscovery:boolean;
} }
@ -31,21 +34,35 @@ export class ProbeDetailInfo extends React.Component<Props, State> {
super(props, context); super(props, context);
this.state = { this.state = {
probe: null, probe: null,
id: '44',
isDiscovery: false,
}; };
} }
public componentWillMount(): void { public componentWillMount(): void {
this.setState({ this.setState({
probe: null, probe: null,
id: '44',
isDiscovery: false,
}); });
} }
public handleStartStop(event: any, data: any): void { public handleStartStop(event: any, data: any): void {
console.log(event); console.log(event);
} }
public handleDiscovery(event: any, data: any): void {
alert('Discovery'); public handleDiscovery = (event: any, data: any): void => {
console.log(event);
// let probeId = String(this.state.id);
// this.props.onDiscoverySelect(this.state.id);
// if (this.state.isDiscovery) {
// this.setState({isDiscovery: false});
// } else {
// this.setState({isDiscovery: true});
// }
} }
public showStartStopBtn(): JSX.Element { public showStartStopBtn(): JSX.Element {
return <Button content='Stop' icon='stop' labelPosition='left' negative/>; return <Button content='Stop' icon='stop' labelPosition='left' negative/>;
} }
@ -102,11 +119,20 @@ export class ProbeDetailInfo extends React.Component<Props, State> {
</Table.Footer> </Table.Footer>
</Table> </Table>
{/* {this.showStartStopBtn()} */} {/* {this.showStartStopBtn()} */}
</Container> </Container>
); );
} }
private showDiscovery = ():JSX.Element => {
if (!this.state.isDiscovery) {
this.setState({isDiscovery:true});
return <Discovery/>;
} else {
this.setState({isDiscovery:false});
return null;
}
}
} }