sensor detail
This commit is contained in:
parent
52bafd4510
commit
567f6a570b
|
@ -5,6 +5,8 @@ import signInReducer from '@overflow/member/redux/reducer/signIn';
|
|||
import readAllProbeReducer from '@overflow/probe/redux/reducer/readAllByDomain';
|
||||
import readProbeReducer from '@overflow/probe/redux/reducer/read';
|
||||
|
||||
import readAllByTargetReducer from '@overflow/sensor/redux/reducer/read_all_by_target';
|
||||
|
||||
import AsyncRequest from '@overflow/app/redux/saga/AsyncRequest';
|
||||
|
||||
// Container Configuration
|
||||
|
@ -20,7 +22,7 @@ export interface RPCConfig {
|
|||
url: string;
|
||||
}
|
||||
const rpcConfig: RPCConfig = {
|
||||
url: 'ws://127.0.0.1:18081/rpc',
|
||||
url: 'ws://1127.0.0.1:18081/rpc',
|
||||
};
|
||||
|
||||
// Redux Configuration
|
||||
|
@ -42,6 +44,7 @@ const reduxConfig: ReduxConfig = {
|
|||
signInReducer,
|
||||
readAllProbeReducer,
|
||||
readProbeReducer,
|
||||
readAllByTargetReducer,
|
||||
],
|
||||
sagaWatchers: [
|
||||
AsyncRequest,
|
||||
|
|
|
@ -10,16 +10,18 @@ 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): SensorDetailInfoStateProps {
|
||||
import * as asyncRequestActions from '@overflow/commons/redux/action/asyncRequest';
|
||||
|
||||
export function mapStateToProps(state: any, props: any): SensorDetailInfoStateProps {
|
||||
return {
|
||||
sensor:state.sensor,
|
||||
sensorId:props.params.id,
|
||||
};
|
||||
}
|
||||
|
||||
export function mapDispatchToProps(dispatch: Dispatch<any>): SensorDetailInfoDispatchProps {
|
||||
return {
|
||||
onRead: (id: number) => {
|
||||
dispatch(ReadActions.request(id));
|
||||
dispatch(asyncRequestActions.request('SensorService', 'read', ReadActions.REQUEST, id));
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ import * as ItemReadActions from '../redux/action/item_read';
|
|||
|
||||
export function mapStateToProps(state: any): SensorDetailItemsStateProps {
|
||||
return {
|
||||
|
||||
sensorId: props.params.id,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import Probe from '@overflow/probe/api/model/Probe';
|
|||
|
||||
|
||||
export interface SensorDetailInfoStateProps {
|
||||
sensor?: Sensor;
|
||||
sensorId?: number;
|
||||
probe?: Probe;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import Sensor from '@overflow/sensor/api/model/Sensor';
|
|||
import SensorItem from '@overflow/sensor/api/model/SensorItem';
|
||||
|
||||
export interface StateProps {
|
||||
sensor?: Sensor;
|
||||
sensorId?: number;
|
||||
}
|
||||
|
||||
export interface DispatchProps {
|
||||
|
|
|
@ -165,7 +165,7 @@ export class SensorList extends React.Component<SensorListProps, SensorListState
|
|||
return (
|
||||
<ListContainer
|
||||
contents={sensorList}
|
||||
{/*data={this.data}*/}
|
||||
data={this.props.sensorList}
|
||||
/>
|
||||
);
|
||||
|
||||
|
|
|
@ -1,3 +1,28 @@
|
|||
/**
|
||||
* Created by geek on 17. 7. 3.
|
||||
*/
|
||||
|
||||
|
||||
import Action from '@overflow/commons/redux/Action';
|
||||
import { ReducersMapObject } from 'redux';
|
||||
import Sensor from '@overflow/sensor/api/model/Sensor';
|
||||
|
||||
import * as ReadtActionTypes from '../action/read';
|
||||
import ReadState, { defaultState as readDefaultState } from '../state/Read';
|
||||
|
||||
const reducer: ReducersMapObject = {
|
||||
[ReadtActionTypes.REQUEST_SUCCESS]:
|
||||
(state: ReadState = readDefaultState, action: Action<Sensor>): ReadState => {
|
||||
console.log(action);
|
||||
return {
|
||||
...state,
|
||||
Sensor:<Sensor>action.payload,
|
||||
};
|
||||
},
|
||||
[ReadtActionTypes.REQUEST_FAILURE]:
|
||||
(state: ReadState = readDefaultState, action: Action<Error>): ReadState => {
|
||||
return state;
|
||||
},
|
||||
};
|
||||
|
||||
export default reducer;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import Sensor from '../../api/model/Sensor';
|
||||
|
||||
export interface State {
|
||||
readonly isGetSensor: boolean;
|
||||
readonly Sensor: Sensor;
|
||||
readonly error?: Error;
|
||||
}
|
||||
|
||||
export const defaultState: State = {
|
||||
isGetSensor: undefined,
|
||||
Sensor: undefined,
|
||||
error: undefined,
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user