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,
} 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<any>): ProbeDetailDispatchProps {
return {
onDiscoveryClick: ( id: string) => {
dispatch(routerPush( id + '/ targets' ));
},
};
}

View File

@ -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<Props, State> {
super(props, context);
this.state = {
probe: null,
isDiscovery: false,
// isDiscovery: false,
};
}
@ -67,7 +67,7 @@ export class ProbeDetailInfo extends React.Component<Props, State> {
this.setState({
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 => {
console.log(event);
this.setState({ isDiscovery: true });
// this.setState({ isDiscovery: true });
this.props.onDiscoveryClick('11');
}
public renderDiscovery(): JSX.Element {
if (this.state.isDiscovery) {
return <Discovery />;
}
return null;
}
// public renderDiscovery(): JSX.Element {
// if (this.state.isDiscovery) {
// return <Discovery />;
// }
// return null;
//
// }
public showStartStopBtn(): JSX.Element {
if (this.state.probe.status.name === 'STARTED') {