Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
b2e8306567
|
@ -17,7 +17,7 @@ export class SensorService extends Service {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public read(id:string): Promise<Sensor> {
|
public read(id:number): Promise<Sensor> {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
27
src/ts/@overflow/sensor/react/SensorDetail.tsx
Normal file
27
src/ts/@overflow/sensor/react/SensorDetail.tsx
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
import { connect, Dispatch } from 'react-redux';
|
||||||
|
import {
|
||||||
|
SensorDetail,
|
||||||
|
SensorDetailStateProps,
|
||||||
|
SensorDetailDispatchProps,
|
||||||
|
} from './components/SensorDetail';
|
||||||
|
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): SensorDetailStateProps {
|
||||||
|
return {
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function mapDispatchToProps(dispatch: Dispatch<any>): SensorDetailDispatchProps {
|
||||||
|
return {
|
||||||
|
onReadAllByTarget: (target: Target) => {
|
||||||
|
dispatch(ReadAllByTargetActions.request(target));
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export default connect(mapStateToProps, mapDispatchToProps)(SensorDetail);
|
|
@ -5,19 +5,26 @@ import { SensorItems } from './SensorItems';
|
||||||
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 Probe from '@overflow/probe/api/model/Probe';
|
||||||
|
|
||||||
export interface SensorDetailsProps {
|
export interface SensorDetailStateProps {
|
||||||
sensor?: Sensor;
|
sensor?: Sensor;
|
||||||
probe?: Probe;
|
probe?: Probe;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface SensorDetailDispatchProps {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export type SensorDetailProps = SensorDetailStateProps & SensorDetailDispatchProps;
|
||||||
|
|
||||||
export interface SensorDetailsState {
|
export interface SensorDetailsState {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export class SensorDetails extends React.Component<SensorDetailsProps, SensorDetailsState> {
|
export class SensorDetail extends React.Component<SensorDetailProps, SensorDetailsState> {
|
||||||
|
|
||||||
constructor(props: SensorDetailsProps, context: SensorDetailsState) {
|
constructor(props: SensorDetailProps, context: SensorDetailsState) {
|
||||||
super(props, context);
|
super(props, context);
|
||||||
this.state = {
|
this.state = {
|
||||||
};
|
};
|
|
@ -1,6 +1,6 @@
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { Table, Button, Header, Container } from 'semantic-ui-react';
|
import { Table, Button, Header, Container } from 'semantic-ui-react';
|
||||||
import { SensorDetails } from './SensorDetails';
|
import { SensorDetail } 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';
|
||||||
|
@ -116,7 +116,7 @@ export class SensorList extends React.Component<Props, State> {
|
||||||
|
|
||||||
public render(): JSX.Element {
|
public render(): JSX.Element {
|
||||||
if (this.state.isDetail) {
|
if (this.state.isDetail) {
|
||||||
return <SensorDetails sensor={this.state.selected} />;
|
return <SensorDetail sensor={this.state.selected} />;
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<Container fluid>
|
<Container fluid>
|
||||||
|
|
|
@ -12,13 +12,13 @@ export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/sensor/read/REQUEST_S
|
||||||
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/sensor/read/REQUEST_FAILURE';
|
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/sensor/read/REQUEST_FAILURE';
|
||||||
|
|
||||||
// Action Creater
|
// Action Creater
|
||||||
export type request = (id: string) => Action<ReadPayload>;
|
export type request = (id: number) => Action<ReadPayload>;
|
||||||
export type requestSuccess = (sensor: Sensor) => Action<Sensor>;
|
export type requestSuccess = (sensor: Sensor) => Action<Sensor>;
|
||||||
export type requestFailure = (error: Error) => Action;
|
export type requestFailure = (error: Error) => Action;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const request: request = (id: string): Action<ReadPayload> => {
|
export const request: request = (id: number): Action<ReadPayload> => {
|
||||||
return {
|
return {
|
||||||
type: REQUEST,
|
type: REQUEST,
|
||||||
payload: {
|
payload: {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
interface ReadPayload {
|
interface ReadPayload {
|
||||||
id: string;
|
id: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ReadPayload;
|
export default ReadPayload;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user