fixed sensorlist
This commit is contained in:
parent
a63f1c013d
commit
dd488c8919
|
@ -7,8 +7,12 @@ import {
|
||||||
import State from '../redux/state/ReadAllByTarget';
|
import State from '../redux/state/ReadAllByTarget';
|
||||||
|
|
||||||
import * as ReadAllByTargetActions from '../redux/action/read_all_by_target';
|
import * as ReadAllByTargetActions from '../redux/action/read_all_by_target';
|
||||||
|
import * as ReadAllByProbeActions from '../redux/action/read_all_by_probe';
|
||||||
|
import * as ReadAllByDomainActions from '../redux/action/read_all_by_domain';
|
||||||
import Target from '@overflow/target/api/model/Target';
|
import Target from '@overflow/target/api/model/Target';
|
||||||
import Sensor from '@overflow/sensor/api/model/Sensor';
|
import Sensor from '@overflow/sensor/api/model/Sensor';
|
||||||
|
import Probe from '@overflow/probe/api/model/Probe';
|
||||||
|
import Domain from '@overflow/domain/api/model/Domain';
|
||||||
|
|
||||||
export function mapStateToProps(state: any): SensorListStateProps {
|
export function mapStateToProps(state: any): SensorListStateProps {
|
||||||
return {
|
return {
|
||||||
|
@ -20,6 +24,12 @@ export function mapDispatchToProps(dispatch: Dispatch<any>): SensorListDispatchP
|
||||||
onReadAllByTarget: (target: Target) => {
|
onReadAllByTarget: (target: Target) => {
|
||||||
dispatch(ReadAllByTargetActions.request(target));
|
dispatch(ReadAllByTargetActions.request(target));
|
||||||
},
|
},
|
||||||
|
onReadAllByProbe: (probe: Probe) => {
|
||||||
|
dispatch(ReadAllByProbeActions.request(probe));
|
||||||
|
},
|
||||||
|
onReadAllByDomain: (domain: Domain) => {
|
||||||
|
dispatch(ReadAllByDomainActions.request(domain));
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,13 +5,17 @@ import SensorDetailContainer from '../SensorDetail';
|
||||||
import Probe from '@overflow/probe/api/model/Probe';
|
import Probe from '@overflow/probe/api/model/Probe';
|
||||||
import Sensor from '@overflow/sensor/api/model/Sensor';
|
import Sensor from '@overflow/sensor/api/model/Sensor';
|
||||||
import Target from '@overflow/target/api/model/Target';
|
import Target from '@overflow/target/api/model/Target';
|
||||||
|
import Domain from '@overflow/domain/api/model/Domain';
|
||||||
|
|
||||||
export interface StateProps {
|
export interface StateProps {
|
||||||
|
probe?: Probe;
|
||||||
target?: Target;
|
target?: Target;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DispatchProps {
|
export interface DispatchProps {
|
||||||
onReadAllByTarget?(target: Target): void;
|
onReadAllByTarget?(target: Target): void;
|
||||||
|
onReadAllByProbe?(probe: Probe): void;
|
||||||
|
onReadAllByDomain?(domain: Domain): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type SensorListProps = StateProps & DispatchProps;
|
export type SensorListProps = StateProps & DispatchProps;
|
||||||
|
|
43
src/ts/@overflow/sensor/redux/action/read_all_by_domain.ts
Normal file
43
src/ts/@overflow/sensor/redux/action/read_all_by_domain.ts
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
import Action from '@overflow/commons/redux/Action';
|
||||||
|
import Sensor from '../../api/model/Sensor';
|
||||||
|
import ReadAllByDomainPayload from '../payload/ReadAllByDomainPayload';
|
||||||
|
import Domain from '@overflow/domain/api/model/Domain';
|
||||||
|
|
||||||
|
// Action Type
|
||||||
|
export type REQUEST = '@overflow/sensor/read_all_by_domain/REQUEST';
|
||||||
|
export type REQUEST_SUCCESS = '@overflow/sensor/read_all_by_domain/REQUEST_SUCCESS';
|
||||||
|
export type REQUEST_FAILURE = '@overflow/sensor/read_all_by_domain/REQUEST_FAILURE';
|
||||||
|
|
||||||
|
export const REQUEST: REQUEST = '@overflow/sensor/read_all_by_domain/REQUEST';
|
||||||
|
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/sensor/read_all_by_domain/REQUEST_SUCCESS';
|
||||||
|
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/sensor/read_all_by_domain/REQUEST_FAILURE';
|
||||||
|
|
||||||
|
// Action Creater
|
||||||
|
export type request = (domain: Domain) => Action<ReadAllByDomainPayload>;
|
||||||
|
export type requestSuccess = (sensors: Sensor[]) => Action<Sensor[]>;
|
||||||
|
export type requestFailure = (error: Error) => Action;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export const request: request = (domain: Domain): Action<ReadAllByDomainPayload> => {
|
||||||
|
return {
|
||||||
|
type: REQUEST,
|
||||||
|
payload: {
|
||||||
|
domain: domain,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const requestSuccess: requestSuccess = (sensors: Sensor[]): Action<Sensor[]> => {
|
||||||
|
return {
|
||||||
|
type: REQUEST_SUCCESS,
|
||||||
|
payload: sensors,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const requestFailure: requestFailure = (error: Error): Action => {
|
||||||
|
return {
|
||||||
|
type: REQUEST_FAILURE,
|
||||||
|
error: error,
|
||||||
|
};
|
||||||
|
};
|
43
src/ts/@overflow/sensor/redux/action/read_all_by_probe.ts
Normal file
43
src/ts/@overflow/sensor/redux/action/read_all_by_probe.ts
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
import Action from '@overflow/commons/redux/Action';
|
||||||
|
import Sensor from '../../api/model/Sensor';
|
||||||
|
import ReadAllByProbePayload from '../payload/ReadAllByProbePayload';
|
||||||
|
import Probe from '@overflow/probe/api/model/Probe';
|
||||||
|
|
||||||
|
// Action Type
|
||||||
|
export type REQUEST = '@overflow/sensor/read_all_by_probe/REQUEST';
|
||||||
|
export type REQUEST_SUCCESS = '@overflow/sensor/read_all_by_probe/REQUEST_SUCCESS';
|
||||||
|
export type REQUEST_FAILURE = '@overflow/sensor/read_all_by_probe/REQUEST_FAILURE';
|
||||||
|
|
||||||
|
export const REQUEST: REQUEST = '@overflow/sensor/read_all_by_probe/REQUEST';
|
||||||
|
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/sensor/read_all_by_probe/REQUEST_SUCCESS';
|
||||||
|
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/sensor/read_all_by_probe/REQUEST_FAILURE';
|
||||||
|
|
||||||
|
// Action Creater
|
||||||
|
export type request = (probe: Probe) => Action<ReadAllByProbePayload>;
|
||||||
|
export type requestSuccess = (sensors: Sensor[]) => Action<Sensor[]>;
|
||||||
|
export type requestFailure = (error: Error) => Action;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export const request: request = (probe: Probe): Action<ReadAllByProbePayload> => {
|
||||||
|
return {
|
||||||
|
type: REQUEST,
|
||||||
|
payload: {
|
||||||
|
probe: probe,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const requestSuccess: requestSuccess = (sensors: Sensor[]): Action<Sensor[]> => {
|
||||||
|
return {
|
||||||
|
type: REQUEST_SUCCESS,
|
||||||
|
payload: sensors,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const requestFailure: requestFailure = (error: Error): Action => {
|
||||||
|
return {
|
||||||
|
type: REQUEST_FAILURE,
|
||||||
|
error: error,
|
||||||
|
};
|
||||||
|
};
|
|
@ -0,0 +1,7 @@
|
||||||
|
import Domain from '@overflow/domain/api/model/Domain';
|
||||||
|
|
||||||
|
interface ReadAllByDomainPayload {
|
||||||
|
domain: Domain;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ReadAllByDomainPayload;
|
|
@ -0,0 +1,7 @@
|
||||||
|
import Probe from '@overflow/probe/api/model/Probe';
|
||||||
|
|
||||||
|
interface ReadAllByProbePayload {
|
||||||
|
probe: Probe;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ReadAllByProbePayload;
|
Loading…
Reference in New Issue
Block a user