diff --git a/src/ts/@overflow/sensor/react/_ b/src/ts/@overflow/app/views/sensor/SensorList.tsx similarity index 100% rename from src/ts/@overflow/sensor/react/_ rename to src/ts/@overflow/app/views/sensor/SensorList.tsx diff --git a/src/ts/@overflow/sensor/react/SensorList.tsx b/src/ts/@overflow/sensor/react/SensorList.tsx new file mode 100644 index 0000000..6a46d44 --- /dev/null +++ b/src/ts/@overflow/sensor/react/SensorList.tsx @@ -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) => ({ +// onReadAllByTarget: (target: Target) => { +// dispatch(ReadAllByTargetActions.request(target)); +// }, +// }); + + +export function mapDispatchToProps(dispatch: Dispatch): SensorListProps { + return { + onReadAllByTarget: (target: Target) => { + dispatch(ReadAllByTargetActions.request(target)); + }, + }; +} + + +export default connect(mapStateToProps, mapDispatchToProps)(SensorList); diff --git a/src/ts/@overflow/sensor/react/components/Sensors.tsx b/src/ts/@overflow/sensor/react/components/SensorList.tsx similarity index 94% rename from src/ts/@overflow/sensor/react/components/Sensors.tsx rename to src/ts/@overflow/sensor/react/components/SensorList.tsx index c33c1e4..4529655 100644 --- a/src/ts/@overflow/sensor/react/components/Sensors.tsx +++ b/src/ts/@overflow/sensor/react/components/SensorList.tsx @@ -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 { +export class SensorList extends React.Component { private data: any; @@ -144,6 +146,11 @@ export class Sensors extends React.Component { ); } + + + private onReadAllByTarget(): void { + console.log(''); + } } diff --git a/src/ts/@overflow/sensor/redux/state/ReadAllByTarget.ts b/src/ts/@overflow/sensor/redux/state/ReadAllByTarget.ts new file mode 100644 index 0000000..3999ef8 --- /dev/null +++ b/src/ts/@overflow/sensor/redux/state/ReadAllByTarget.ts @@ -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; diff --git a/src/ts/@overflow/temp/react/components/TargetDetails.tsx b/src/ts/@overflow/temp/react/components/TargetDetails.tsx index 9eabcf1..9a68905 100644 --- a/src/ts/@overflow/temp/react/components/TargetDetails.tsx +++ b/src/ts/@overflow/temp/react/components/TargetDetails.tsx @@ -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 }, - { name: 'Sensors', child: }, + { name: 'Sensors', child: }, ]; return ( // - + ); } diff --git a/src/ts/@overflow/temp/react/components/Targets.tsx b/src/ts/@overflow/temp/react/components/Targets.tsx index 3e6d8fa..2282f72 100644 --- a/src/ts/@overflow/temp/react/components/Targets.tsx +++ b/src/ts/@overflow/temp/react/components/Targets.tsx @@ -9,7 +9,7 @@ export interface TargetsProps { } export interface TargetsState { - selected: boolean; + selected: Target; openAddTarget: boolean; }