diff --git a/src/ts/@overflow/sensor/react/SensorList.tsx b/src/ts/@overflow/sensor/react/SensorList.tsx index 86f6ac0..61926b0 100644 --- a/src/ts/@overflow/sensor/react/SensorList.tsx +++ b/src/ts/@overflow/sensor/react/SensorList.tsx @@ -7,8 +7,12 @@ import { import State from '../redux/state/ReadAllByTarget'; 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 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 { return { @@ -20,6 +24,12 @@ export function mapDispatchToProps(dispatch: Dispatch): SensorListDispatchP onReadAllByTarget: (target: Target) => { dispatch(ReadAllByTargetActions.request(target)); }, + onReadAllByProbe: (probe: Probe) => { + dispatch(ReadAllByProbeActions.request(probe)); + }, + onReadAllByDomain: (domain: Domain) => { + dispatch(ReadAllByDomainActions.request(domain)); + }, }; } diff --git a/src/ts/@overflow/sensor/react/components/SensorList.tsx b/src/ts/@overflow/sensor/react/components/SensorList.tsx index ef30f1d..048248e 100644 --- a/src/ts/@overflow/sensor/react/components/SensorList.tsx +++ b/src/ts/@overflow/sensor/react/components/SensorList.tsx @@ -5,13 +5,17 @@ import SensorDetailContainer from '../SensorDetail'; import Probe from '@overflow/probe/api/model/Probe'; import Sensor from '@overflow/sensor/api/model/Sensor'; import Target from '@overflow/target/api/model/Target'; +import Domain from '@overflow/domain/api/model/Domain'; export interface StateProps { + probe?: Probe; target?: Target; } export interface DispatchProps { onReadAllByTarget?(target: Target): void; + onReadAllByProbe?(probe: Probe): void; + onReadAllByDomain?(domain: Domain): void; } export type SensorListProps = StateProps & DispatchProps; diff --git a/src/ts/@overflow/sensor/redux/action/read_all_by_domain.ts b/src/ts/@overflow/sensor/redux/action/read_all_by_domain.ts new file mode 100644 index 0000000..fc78f6b --- /dev/null +++ b/src/ts/@overflow/sensor/redux/action/read_all_by_domain.ts @@ -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; +export type requestSuccess = (sensors: Sensor[]) => Action; +export type requestFailure = (error: Error) => Action; + + + +export const request: request = (domain: Domain): Action => { + return { + type: REQUEST, + payload: { + domain: domain, + }, + }; +}; + +export const requestSuccess: requestSuccess = (sensors: Sensor[]): Action => { + return { + type: REQUEST_SUCCESS, + payload: sensors, + }; +}; + +export const requestFailure: requestFailure = (error: Error): Action => { + return { + type: REQUEST_FAILURE, + error: error, + }; +}; diff --git a/src/ts/@overflow/sensor/redux/action/read_all_by_probe.ts b/src/ts/@overflow/sensor/redux/action/read_all_by_probe.ts new file mode 100644 index 0000000..723f235 --- /dev/null +++ b/src/ts/@overflow/sensor/redux/action/read_all_by_probe.ts @@ -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; +export type requestSuccess = (sensors: Sensor[]) => Action; +export type requestFailure = (error: Error) => Action; + + + +export const request: request = (probe: Probe): Action => { + return { + type: REQUEST, + payload: { + probe: probe, + }, + }; +}; + +export const requestSuccess: requestSuccess = (sensors: Sensor[]): Action => { + return { + type: REQUEST_SUCCESS, + payload: sensors, + }; +}; + +export const requestFailure: requestFailure = (error: Error): Action => { + return { + type: REQUEST_FAILURE, + error: error, + }; +}; diff --git a/src/ts/@overflow/sensor/redux/payload/ReadAllByDomainPayload.ts b/src/ts/@overflow/sensor/redux/payload/ReadAllByDomainPayload.ts new file mode 100644 index 0000000..3234527 --- /dev/null +++ b/src/ts/@overflow/sensor/redux/payload/ReadAllByDomainPayload.ts @@ -0,0 +1,7 @@ +import Domain from '@overflow/domain/api/model/Domain'; + +interface ReadAllByDomainPayload { + domain: Domain; +} + +export default ReadAllByDomainPayload; diff --git a/src/ts/@overflow/sensor/redux/payload/ReadAllByProbePayload.ts b/src/ts/@overflow/sensor/redux/payload/ReadAllByProbePayload.ts new file mode 100644 index 0000000..2f5901e --- /dev/null +++ b/src/ts/@overflow/sensor/redux/payload/ReadAllByProbePayload.ts @@ -0,0 +1,7 @@ +import Probe from '@overflow/probe/api/model/Probe'; + +interface ReadAllByProbePayload { + probe: Probe; +} + +export default ReadAllByProbePayload;