Merge remote-tracking branch 'origin/master'

This commit is contained in:
geek 2017-07-20 17:33:18 +09:00
commit b2e8306567
6 changed files with 43 additions and 9 deletions

View File

@ -17,7 +17,7 @@ export class SensorService extends Service {
return null;
}
public read(id:string): Promise<Sensor> {
public read(id:number): Promise<Sensor> {
return null;
}

View 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);

View File

@ -5,19 +5,26 @@ import { SensorItems } from './SensorItems';
import Sensor from '@overflow/sensor/api/model/Sensor';
import Probe from '@overflow/probe/api/model/Probe';
export interface SensorDetailsProps {
export interface SensorDetailStateProps {
sensor?: Sensor;
probe?: Probe;
}
export interface SensorDetailDispatchProps {
}
export type SensorDetailProps = SensorDetailStateProps & SensorDetailDispatchProps;
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);
this.state = {
};

View File

@ -1,6 +1,6 @@
import * as React from '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 Sensor from '@overflow/sensor/api/model/Sensor';
@ -116,7 +116,7 @@ export class SensorList extends React.Component<Props, State> {
public render(): JSX.Element {
if (this.state.isDetail) {
return <SensorDetails sensor={this.state.selected} />;
return <SensorDetail sensor={this.state.selected} />;
}
return (
<Container fluid>

View File

@ -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';
// 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 requestFailure = (error: Error) => Action;
export const request: request = (id: string): Action<ReadPayload> => {
export const request: request = (id: number): Action<ReadPayload> => {
return {
type: REQUEST,
payload: {

View File

@ -1,5 +1,5 @@
interface ReadPayload {
id: string;
id: number;
}
export default ReadPayload;