This commit is contained in:
insanity 2017-07-21 18:09:59 +09:00
parent 22ab907d59
commit 6664c2a0cb
5 changed files with 13 additions and 5 deletions

View File

@ -17,7 +17,7 @@ class ProbeDetail extends React.Component<RouteComponentProps<object>, object> {
public render(): JSX.Element { public render(): JSX.Element {
return ( return (
<ProbeDetailContainer/> <ProbeDetailContainer params={this.props.match.params}/>
); );
} }
} }

View File

@ -5,8 +5,9 @@ import {
DispatchProps as ProbeDetailDispatchProps, DispatchProps as ProbeDetailDispatchProps,
} from './components/ProbeDetail'; } from './components/ProbeDetail';
export function mapStateToProps(state: any): ProbeDetailStateProps { export function mapStateToProps(state: any, props: any): ProbeDetailStateProps {
return { return {
id: props.params.id,
}; };
} }

View File

@ -7,7 +7,7 @@ import {
import Domain from '@overflow/domain/api/model/Domain'; import Domain from '@overflow/domain/api/model/Domain';
import * as probeListActions from '../redux/action/read_all_by_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 { export function mapStateToProps(state: any): ProbeListStateProps {
return { return {
@ -20,6 +20,9 @@ export function mapDispatchToProps(dispatch: Dispatch<any>): ProbeListDispatchPr
onReadAllByDomain: (domain: Domain) => { onReadAllByDomain: (domain: Domain) => {
dispatch(probeListActions.request(domain)); dispatch(probeListActions.request(domain));
}, },
onProbeSelection: (id: string) => {
dispatch(routerPush('/temp/probe/' + id));
},
}; };
} }

View File

@ -11,7 +11,7 @@ import {
import Probe from '@overflow/probe/api/model/Probe'; import Probe from '@overflow/probe/api/model/Probe';
export interface StateProps { export interface StateProps {
id: string;
} }
export interface DispatchProps { export interface DispatchProps {
@ -28,13 +28,14 @@ export class ProbeDetail extends React.Component<Props, State> {
constructor(props: Props, context: State) { constructor(props: Props, context: State) {
super(props, context); super(props, context);
this.state = { this.state = {
params: null,
}; };
} }
public render(): JSX.Element { public render(): JSX.Element {
return ( return (
<Container fluid> <Container fluid>
Probe Detail....id: ? Probe Detail....id: {this.props.id}
{/* <ProbeBasicInfo probe={null} /> {/* <ProbeBasicInfo probe={null} />
<TargetTable /> */} <TargetTable /> */}
</Container> </Container>

View File

@ -10,6 +10,7 @@ export interface StateProps {
export interface DispatchProps { export interface DispatchProps {
onReadAllByDomain(domain: Domain): void; onReadAllByDomain(domain: Domain): void;
onProbeSelection(id: string): void;
} }
export type Props = StateProps & DispatchProps; export type Props = StateProps & DispatchProps;
@ -95,6 +96,8 @@ export class ProbeList extends React.Component<Props, State> {
this.setState({ this.setState({
selected: selectedProbe, selected: selectedProbe,
}); });
this.props.onProbeSelection(selectedProbe.id);
} }
public handleSearch(result: Probe[]): void { public handleSearch(result: Probe[]): void {