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 {
return (
<ProbeDetailContainer/>
<ProbeDetailContainer params={this.props.match.params}/>
);
}
}

View File

@ -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,
};
}

View File

@ -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<any>): ProbeListDispatchPr
onReadAllByDomain: (domain: 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';
export interface StateProps {
id: string;
}
export interface DispatchProps {
@ -28,13 +28,14 @@ export class ProbeDetail extends React.Component<Props, State> {
constructor(props: Props, context: State) {
super(props, context);
this.state = {
params: null,
};
}
public render(): JSX.Element {
return (
<Container fluid>
Probe Detail....id: ?
Probe Detail....id: {this.props.id}
{/* <ProbeBasicInfo probe={null} />
<TargetTable /> */}
</Container>

View File

@ -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<Props, State> {
this.setState({
selected: selectedProbe,
});
this.props.onProbeSelection(selectedProbe.id);
}
public handleSearch(result: Probe[]): void {