discovery

This commit is contained in:
geek 2017-07-26 12:00:30 +09:00
parent c827892a86
commit 1275c1755d
2 changed files with 17 additions and 11 deletions

View File

@ -5,6 +5,7 @@ import {
DispatchProps as ProbeDetailDispatchProps, DispatchProps as ProbeDetailDispatchProps,
} from './components/ProbeDetailInfo'; } from './components/ProbeDetailInfo';
import { push as routerPush } from 'react-router-redux'; 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 {
@ -15,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 {
onDiscoveryClick: ( id: string) => {
dispatch(routerPush( id + '/ targets' ));
},
}; };
} }

View File

@ -15,14 +15,14 @@ export interface StateProps {
} }
export interface DispatchProps { export interface DispatchProps {
// onDiscoverySelect(id:string):void; onDiscoveryClick(id:string):void;
} }
export type Props = StateProps & DispatchProps; export type Props = StateProps & DispatchProps;
export interface State { export interface State {
probe: any; // todo. fix to Probe probe: any; // todo. fix to Probe
isDiscovery: boolean; // isDiscovery: boolean;
} }
@ -32,7 +32,7 @@ export class ProbeDetailInfo extends React.Component<Props, State> {
super(props, context); super(props, context);
this.state = { this.state = {
probe: null, probe: null,
isDiscovery: false, // isDiscovery: false,
}; };
} }
@ -67,7 +67,7 @@ export class ProbeDetailInfo extends React.Component<Props, State> {
this.setState({ this.setState({
probe: p, probe: p,
isDiscovery: false, // isDiscovery: false,
}); });
} }
@ -77,15 +77,17 @@ export class ProbeDetailInfo extends React.Component<Props, State> {
public handleDiscovery = (event: any, data: any): void => { public handleDiscovery = (event: any, data: any): void => {
console.log(event); console.log(event);
this.setState({ isDiscovery: true }); // this.setState({ isDiscovery: true });
this.props.onDiscoveryClick('11');
} }
public renderDiscovery(): JSX.Element { // public renderDiscovery(): JSX.Element {
if (this.state.isDiscovery) { // if (this.state.isDiscovery) {
return <Discovery />; // return <Discovery />;
} // }
return null; // return null;
} //
// }
public showStartStopBtn(): JSX.Element { public showStartStopBtn(): JSX.Element {
if (this.state.probe.status.name === 'STARTED') { if (this.state.probe.status.name === 'STARTED') {