diff --git a/src/ts/@overflow/app/index.tsx b/src/ts/@overflow/app/index.tsx index c4bfe6d..201310b 100644 --- a/src/ts/@overflow/app/index.tsx +++ b/src/ts/@overflow/app/index.tsx @@ -106,14 +106,14 @@ class OFApplication { private initRpcClient(): Promise { const rpcClient = new Promise((resolve, reject) => { let client = new WebSocketRPC(this.config.rpc.url); - // client.initialize() - // .then(() => { - // resolve(client); - // }) - // .catch((err: any) => { - // reject(err); - // }); - resolve(client); + client.initialize() + .then(() => { + resolve(client); + }) + .catch((err: any) => { + reject(err); + }); + // resolve(client); }); return rpcClient; diff --git a/src/ts/@overflow/probe/react/ProbeDetail.tsx b/src/ts/@overflow/probe/react/ProbeDetail.tsx index 80f00e5..91a67c0 100644 --- a/src/ts/@overflow/probe/react/ProbeDetail.tsx +++ b/src/ts/@overflow/probe/react/ProbeDetail.tsx @@ -12,6 +12,7 @@ import * as probeReadActions from '../redux/action/read'; export function mapStateToProps(state: any, props: any): ProbeDetailStateProps { return { id: props.params.id, + probe: state.probe, }; } diff --git a/src/ts/@overflow/probe/react/ProbeList.tsx b/src/ts/@overflow/probe/react/ProbeList.tsx index 43456c8..064cdda 100644 --- a/src/ts/@overflow/probe/react/ProbeList.tsx +++ b/src/ts/@overflow/probe/react/ProbeList.tsx @@ -12,6 +12,7 @@ import * as asyncRequestActions from '@overflow/commons/redux/action/asyncReques export function mapStateToProps(state: any): ProbeListStateProps { return { + probeList: state.probeList, }; } diff --git a/src/ts/@overflow/probe/react/components/ProbeDetailInfo.tsx b/src/ts/@overflow/probe/react/components/ProbeDetailInfo.tsx index 08695eb..1197b77 100644 --- a/src/ts/@overflow/probe/react/components/ProbeDetailInfo.tsx +++ b/src/ts/@overflow/probe/react/components/ProbeDetailInfo.tsx @@ -12,6 +12,7 @@ import { Discovery } from '@overflow/discovery/react/components/Discovery'; export interface StateProps { id: string; + probe: Probe; } export interface DispatchProps { @@ -22,8 +23,6 @@ export interface DispatchProps { export type Props = StateProps & DispatchProps; export interface State { - probe: any; // todo. fix to Probe - // isDiscovery: boolean; } @@ -32,40 +31,11 @@ export class ProbeDetailInfo extends React.Component { constructor(props: Props, context: State) { super(props, context); this.state = { - probe: null, - // isDiscovery: false, }; } public componentWillMount(): void { this.props.onRead(this.props.id); - // todo. getting probe by probeId - let p = { - 'id': '11', - 'status': { - 'name': 'INITIAL', - }, - 'domain': { - 'name': 'insanity\'s domain', - }, - 'cidr': '192.168.1.0/24', - 'displayName': '192.168.1.105\'s probe', - 'targetCount': '20', - 'sensorCount': '30', - 'probeKey': '1AGBLKDFJ2452ASDGFL2KWJLKSDJ', - 'description': 'description1111111111', - 'createDate': '2017-01-01', - 'authorizeDate': '2017-01-01', - 'restartDate': '2017-01-01', - 'authorizeMember': { - 'name': 'insanity', - }, - }; - - this.setState({ - probe: p, - // isDiscovery: false, - }); } public handleStartStop(event: any, data: any): void { @@ -73,26 +43,20 @@ export class ProbeDetailInfo extends React.Component { } public handleDiscovery = (event: any, data: any): void => { - console.log(event); - // this.setState({ isDiscovery: true }); - this.props.onDiscoveryClick('11'); + this.props.onDiscoveryClick(this.props.id); } - // public renderDiscovery(): JSX.Element { - // if (this.state.isDiscovery) { - // return ; - // } - // return null; - // - // } public showStopBtn(): JSX.Element { - if (this.state.probe.status.name === 'NORMAL') { + if (this.props.probe.status.name === 'NORMAL') { return