From 1275c1755df7fbea8a4fdbfc468123331ca2eba5 Mon Sep 17 00:00:00 2001 From: geek Date: Wed, 26 Jul 2017 12:00:30 +0900 Subject: [PATCH] discovery --- src/ts/@overflow/probe/react/ProbeDetail.tsx | 4 ++++ .../react/components/ProbeDetailInfo.tsx | 24 ++++++++++--------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/ts/@overflow/probe/react/ProbeDetail.tsx b/src/ts/@overflow/probe/react/ProbeDetail.tsx index bdd3578..04f0f47 100644 --- a/src/ts/@overflow/probe/react/ProbeDetail.tsx +++ b/src/ts/@overflow/probe/react/ProbeDetail.tsx @@ -5,6 +5,7 @@ import { DispatchProps as ProbeDetailDispatchProps, } 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 { @@ -15,6 +16,9 @@ export function mapStateToProps(state: any, props: any): ProbeDetailStateProps { export function mapDispatchToProps(dispatch: Dispatch): ProbeDetailDispatchProps { return { + onDiscoveryClick: ( id: string) => { + dispatch(routerPush( id + '/ targets' )); + }, }; } diff --git a/src/ts/@overflow/probe/react/components/ProbeDetailInfo.tsx b/src/ts/@overflow/probe/react/components/ProbeDetailInfo.tsx index 4a8ebba..9064dba 100644 --- a/src/ts/@overflow/probe/react/components/ProbeDetailInfo.tsx +++ b/src/ts/@overflow/probe/react/components/ProbeDetailInfo.tsx @@ -15,14 +15,14 @@ export interface StateProps { } export interface DispatchProps { - // onDiscoverySelect(id:string):void; + onDiscoveryClick(id:string):void; } export type Props = StateProps & DispatchProps; export interface State { probe: any; // todo. fix to Probe - isDiscovery: boolean; + // isDiscovery: boolean; } @@ -32,7 +32,7 @@ export class ProbeDetailInfo extends React.Component { super(props, context); this.state = { probe: null, - isDiscovery: false, + // isDiscovery: false, }; } @@ -67,7 +67,7 @@ export class ProbeDetailInfo extends React.Component { this.setState({ probe: p, - isDiscovery: false, + // isDiscovery: false, }); } @@ -77,15 +77,17 @@ export class ProbeDetailInfo extends React.Component { public handleDiscovery = (event: any, data: any): void => { console.log(event); - this.setState({ isDiscovery: true }); + // this.setState({ isDiscovery: true }); + this.props.onDiscoveryClick('11'); } - public renderDiscovery(): JSX.Element { - if (this.state.isDiscovery) { - return ; - } - return null; - } + // public renderDiscovery(): JSX.Element { + // if (this.state.isDiscovery) { + // return ; + // } + // return null; + // + // } public showStartStopBtn(): JSX.Element { if (this.state.probe.status.name === 'STARTED') {