fixed sensor

This commit is contained in:
snoop 2017-07-20 16:38:07 +09:00
parent 395a429677
commit 4e59080a6b
6 changed files with 62 additions and 7 deletions

View File

@ -0,0 +1,34 @@
import { connect, Dispatch } from 'react-redux';
import {
SensorList,
Props as SensorListProps,
State as SensorListState,
} from './components/SensorList';
import State from '../redux/state/ReadAllByTarget';
import * as ReadAllByTargetActions from '../redux/action/read_all_by_target';
import Target from '@overflow/target/api/model/Target';
import Sensor from '@overflow/sensor/api/model/Sensor';
export function mapStateToProps(state: any): SensorListProps {
return {
};
}
// const mapDispatchToProps = (dispatch: Dispatch<any>) => ({
// onReadAllByTarget: (target: Target) => {
// dispatch(ReadAllByTargetActions.request(target));
// },
// });
export function mapDispatchToProps(dispatch: Dispatch<any>): SensorListProps {
return {
onReadAllByTarget: (target: Target) => {
dispatch(ReadAllByTargetActions.request(target));
},
};
}
export default connect(mapStateToProps, mapDispatchToProps)(SensorList);

View File

@ -4,9 +4,11 @@ import { SensorDetails } from './SensorDetails';
import Probe from '@overflow/probe/api/model/Probe';
import Sensor from '@overflow/sensor/api/model/Sensor';
import Target from '@overflow/target/api/model/Target';
export interface Props {
probe?: Probe;
target?: Target;
onReadAllByTarget?(target: Target): void;
}
export interface State {
@ -15,7 +17,7 @@ export interface State {
}
export class Sensors extends React.Component<Props, State> {
export class SensorList extends React.Component<Props, State> {
private data: any;
@ -144,6 +146,11 @@ export class Sensors extends React.Component<Props, State> {
</Container>
);
}
private onReadAllByTarget(): void {
console.log('');
}
}

View File

@ -0,0 +1,13 @@
import Sensor from '../../api/model/Sensor';
export interface State {
readonly isGetSensorList: boolean;
readonly error?: Error;
}
export const defaultState: State = {
isGetSensorList: undefined,
error: undefined,
};
export default State;

View File

@ -1,13 +1,14 @@
import * as React from 'react';
import { Button, Table, Header, Container } from 'semantic-ui-react';
import { Sensors } from '@overflow/sensor/react/components/Sensors';
import { SensorList } from '@overflow/sensor/react/components/SensorList';
import { DetailContainer } from './commons/DetailContainer';
import Probe from '@overflow/probe/api/model/Probe';
import Target from '@overflow/target/api/model/Target';
export interface TargetDetailsProps {
probe?: Probe;
target?: boolean;
target?: Target;
}
export interface TargetDetailsState {
@ -34,14 +35,14 @@ export class TargetDetails extends React.Component<TargetDetailsProps, TargetDet
const items = [
{ name: 'Info', child: <TargetBasicInfo probe={this.props.probe} /> },
{ name: 'Sensors', child: <Sensors probe={this.props.probe} /> },
{ name: 'Sensors', child: <SensorList target={this.props.target} /> },
];
return (
// <DetailContainer panes={items}/>
<Container fluid>
<TargetBasicInfo probe={this.props.probe} />
<Sensors probe={this.props.probe} />
<SensorList target={this.props.target} />
</Container>
);
}

View File

@ -9,7 +9,7 @@ export interface TargetsProps {
}
export interface TargetsState {
selected: boolean;
selected: Target;
openAddTarget: boolean;
}