fixed sensor

This commit is contained in:
snoop 2017-07-20 19:04:35 +09:00
parent e0f91c03a0
commit c5561a915e
4 changed files with 23 additions and 11 deletions

View File

@ -4,21 +4,22 @@ import {
SensorDetailStateProps,
SensorDetailDispatchProps,
} from './components/SensorDetail';
import State from '../redux/state/ReadAllByTarget';
import State from '../redux/state/Read';
import * as ReadAllByTargetActions from '../redux/action/read_all_by_target';
import * as ReadActions from '../redux/action/read';
import Target from '@overflow/target/api/model/Target';
import Sensor from '@overflow/sensor/api/model/Sensor';
export function mapStateToProps(state: any): SensorDetailStateProps {
return {
sensor:state.sensor,
};
}
export function mapDispatchToProps(dispatch: Dispatch<any>): SensorDetailDispatchProps {
return {
onReadAllByTarget: (target: Target) => {
dispatch(ReadAllByTargetActions.request(target));
onRead: (id: number) => {
dispatch(ReadActions.request(id));
},
};
}

View File

@ -11,7 +11,7 @@ export interface SensorDetailStateProps {
}
export interface SensorDetailDispatchProps {
onRead?(id: number): void;
}
@ -31,7 +31,7 @@ export class SensorDetail extends React.Component<SensorDetailProps, SensorDetai
}
public componentWillMount(): void {
super.componentWillMount();
console.log('');
}
public render(): JSX.Element {

View File

@ -1,6 +1,6 @@
import * as React from 'react';
import { Table, Button, Header, Container } from 'semantic-ui-react';
import { SensorDetail } from './SensorDetail';
import SensorDetailContainer from '../SensorDetail';
import Probe from '@overflow/probe/api/model/Probe';
import Sensor from '@overflow/sensor/api/model/Sensor';
@ -116,7 +116,8 @@ export class SensorList extends React.Component<SensorListProps, SensorListState
public render(): JSX.Element {
if (this.state.isDetail) {
return (<SensorDetail sensor={this.state.selected} />);
// return (<SensorDetailContainer sensor={this.state.selected} />);
return (<SensorDetailContainer />);
}
return (
<Container fluid>

View File

@ -1,3 +1,13 @@
/**
* Created by geek on 17. 7. 3.
*/
import Sensor from '../../api/model/Sensor';
export interface State {
readonly isGetSensor: boolean;
readonly error?: Error;
}
export const defaultState: State = {
isGetSensor: undefined,
error: undefined,
};
export default State;