From 6664c2a0cbefd5090b394c46a9dd6fe0c9133573 Mon Sep 17 00:00:00 2001 From: insanity Date: Fri, 21 Jul 2017 18:09:59 +0900 Subject: [PATCH] route --- src/ts/@overflow/app/views/monitoring/probe/Detail.tsx | 2 +- src/ts/@overflow/probe/react/ProbeDetail.tsx | 3 ++- src/ts/@overflow/probe/react/ProbeList.tsx | 5 ++++- src/ts/@overflow/probe/react/components/ProbeDetail.tsx | 5 +++-- src/ts/@overflow/probe/react/components/ProbeList.tsx | 3 +++ 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/ts/@overflow/app/views/monitoring/probe/Detail.tsx b/src/ts/@overflow/app/views/monitoring/probe/Detail.tsx index 7848f8a..2761603 100644 --- a/src/ts/@overflow/app/views/monitoring/probe/Detail.tsx +++ b/src/ts/@overflow/app/views/monitoring/probe/Detail.tsx @@ -17,7 +17,7 @@ class ProbeDetail extends React.Component, object> { public render(): JSX.Element { return ( - + ); } } diff --git a/src/ts/@overflow/probe/react/ProbeDetail.tsx b/src/ts/@overflow/probe/react/ProbeDetail.tsx index 3d9c197..0fc17e1 100644 --- a/src/ts/@overflow/probe/react/ProbeDetail.tsx +++ b/src/ts/@overflow/probe/react/ProbeDetail.tsx @@ -5,8 +5,9 @@ import { DispatchProps as ProbeDetailDispatchProps, } from './components/ProbeDetail'; -export function mapStateToProps(state: any): ProbeDetailStateProps { +export function mapStateToProps(state: any, props: any): ProbeDetailStateProps { return { + id: props.params.id, }; } diff --git a/src/ts/@overflow/probe/react/ProbeList.tsx b/src/ts/@overflow/probe/react/ProbeList.tsx index b1be172..88ee1ba 100644 --- a/src/ts/@overflow/probe/react/ProbeList.tsx +++ b/src/ts/@overflow/probe/react/ProbeList.tsx @@ -7,7 +7,7 @@ import { import Domain from '@overflow/domain/api/model/Domain'; import * as probeListActions from '../redux/action/read_all_by_domain'; - +import { push as routerPush } from 'react-router-redux'; export function mapStateToProps(state: any): ProbeListStateProps { return { @@ -20,6 +20,9 @@ export function mapDispatchToProps(dispatch: Dispatch): ProbeListDispatchPr onReadAllByDomain: (domain: Domain) => { dispatch(probeListActions.request(domain)); }, + onProbeSelection: (id: string) => { + dispatch(routerPush('/temp/probe/' + id)); + }, }; } diff --git a/src/ts/@overflow/probe/react/components/ProbeDetail.tsx b/src/ts/@overflow/probe/react/components/ProbeDetail.tsx index 8068cd0..1ccae35 100644 --- a/src/ts/@overflow/probe/react/components/ProbeDetail.tsx +++ b/src/ts/@overflow/probe/react/components/ProbeDetail.tsx @@ -11,7 +11,7 @@ import { import Probe from '@overflow/probe/api/model/Probe'; export interface StateProps { - + id: string; } export interface DispatchProps { @@ -28,13 +28,14 @@ export class ProbeDetail extends React.Component { constructor(props: Props, context: State) { super(props, context); this.state = { + params: null, }; } public render(): JSX.Element { return ( - Probe Detail....id: ? + Probe Detail....id: {this.props.id} {/* */} diff --git a/src/ts/@overflow/probe/react/components/ProbeList.tsx b/src/ts/@overflow/probe/react/components/ProbeList.tsx index 565033f..35b0f6d 100644 --- a/src/ts/@overflow/probe/react/components/ProbeList.tsx +++ b/src/ts/@overflow/probe/react/components/ProbeList.tsx @@ -10,6 +10,7 @@ export interface StateProps { export interface DispatchProps { onReadAllByDomain(domain: Domain): void; + onProbeSelection(id: string): void; } export type Props = StateProps & DispatchProps; @@ -95,6 +96,8 @@ export class ProbeList extends React.Component { this.setState({ selected: selectedProbe, }); + + this.props.onProbeSelection(selectedProbe.id); } public handleSearch(result: Probe[]): void {