From a24b0a49cbe77f020efab94d64a8765e7c17826e Mon Sep 17 00:00:00 2001 From: snoop Date: Thu, 10 Aug 2017 19:19:01 +0900 Subject: [PATCH] sensor detail --- .../views/monitoring/sensor/DetailInfo.tsx | 2 +- .../views/monitoring/sensor/DetailItems.tsx | 2 +- .../sensor/react/SensorDetailInfo.tsx | 3 +- .../sensor/react/SensorDetailItems.tsx | 12 +- .../react/components/SensorDetailInfo.tsx | 197 ++++++++++-------- .../react/components/SensorDetailItems.tsx | 161 +++++++------- .../redux/action/item_read_all_by_sensor.ts | 54 ++--- src/ts/@overflow/sensor/redux/action/read.ts | 54 ++--- 8 files changed, 254 insertions(+), 231 deletions(-) diff --git a/src/ts/@overflow/app/views/monitoring/sensor/DetailInfo.tsx b/src/ts/@overflow/app/views/monitoring/sensor/DetailInfo.tsx index 2a9dae8..1ca074a 100644 --- a/src/ts/@overflow/app/views/monitoring/sensor/DetailInfo.tsx +++ b/src/ts/@overflow/app/views/monitoring/sensor/DetailInfo.tsx @@ -10,7 +10,7 @@ class SensorDetailInfo extends React.Component, obje public render(): JSX.Element { return ( - + ); } } diff --git a/src/ts/@overflow/app/views/monitoring/sensor/DetailItems.tsx b/src/ts/@overflow/app/views/monitoring/sensor/DetailItems.tsx index b4264d9..98ee203 100644 --- a/src/ts/@overflow/app/views/monitoring/sensor/DetailItems.tsx +++ b/src/ts/@overflow/app/views/monitoring/sensor/DetailItems.tsx @@ -10,7 +10,7 @@ class SensorDetailItems extends React.Component, obj public render(): JSX.Element { return ( - + ); } } diff --git a/src/ts/@overflow/sensor/react/SensorDetailInfo.tsx b/src/ts/@overflow/sensor/react/SensorDetailInfo.tsx index 9e81669..d4bbf8e 100644 --- a/src/ts/@overflow/sensor/react/SensorDetailInfo.tsx +++ b/src/ts/@overflow/sensor/react/SensorDetailInfo.tsx @@ -11,10 +11,11 @@ import Target from '@overflow/target/api/model/Target'; import Sensor from '@overflow/sensor/api/model/Sensor'; import * as asyncRequestActions from '@overflow/commons/redux/action/asyncRequest'; - +import { push as routerPush } from 'react-router-redux'; export function mapStateToProps(state: any, props: any): SensorDetailInfoStateProps { return { sensorId:props.params.id, + sensor:state.Sensor, }; } diff --git a/src/ts/@overflow/sensor/react/SensorDetailItems.tsx b/src/ts/@overflow/sensor/react/SensorDetailItems.tsx index e146eee..fb245e1 100644 --- a/src/ts/@overflow/sensor/react/SensorDetailItems.tsx +++ b/src/ts/@overflow/sensor/react/SensorDetailItems.tsx @@ -6,18 +6,22 @@ import { } from './components/SensorDetailItems'; import State from '../redux/state/ItemRead'; -import * as ItemReadActions from '../redux/action/item_read'; +import Sensor from '@overflow/sensor/api/model/Sensor'; -export function mapStateToProps(state: any): SensorDetailItemsStateProps { +import * as ItemReadAllBySensorActions from '../redux/action/item_read_all_by_sensor'; +import * as asyncRequestActions from '@overflow/commons/redux/action/asyncRequest'; +export function mapStateToProps(state: any, props: any): SensorDetailItemsStateProps { return { sensorId: props.params.id, + sensorItemList: state.SensorItemList, }; } export function mapDispatchToProps(dispatch: Dispatch): SensorDetailItemsDispatchProps { return { - onRead: (id: number) => { - dispatch(ItemReadActions.request(id)); + onReadAllBySensor: (sensor: Sensor) => { + dispatch(asyncRequestActions.request('SensorItemService', 'readAllBySensor', + ItemReadAllBySensorActions.REQUEST, JSON.stringify(sensor))); }, }; } diff --git a/src/ts/@overflow/sensor/react/components/SensorDetailInfo.tsx b/src/ts/@overflow/sensor/react/components/SensorDetailInfo.tsx index 6d7d510..fa282f7 100644 --- a/src/ts/@overflow/sensor/react/components/SensorDetailInfo.tsx +++ b/src/ts/@overflow/sensor/react/components/SensorDetailInfo.tsx @@ -8,6 +8,7 @@ import Probe from '@overflow/probe/api/model/Probe'; export interface SensorDetailInfoStateProps { sensorId?: number; probe?: Probe; + sensor?: Sensor; } export interface SensorDetailInfoDispatchProps { @@ -17,7 +18,7 @@ export interface SensorDetailInfoDispatchProps { export type SensorDetailInfoProps = SensorDetailInfoStateProps & SensorDetailInfoDispatchProps; export interface SensorDetailInfoState { - sensor: Sensor; + // sensor: Sensor; } export class SensorDetailInfo extends React.Component { @@ -25,8 +26,10 @@ export class SensorDetailInfo extends React.Component; } else { return