gggggggggggggggggggg

This commit is contained in:
insanity 2017-07-21 16:57:00 +09:00
commit 547fc2a84b
7 changed files with 128 additions and 9 deletions

View File

@ -7,6 +7,8 @@ import LeftMenu from './LeftMenu';
import ProbeList from '../monitoring/probe/List'; import ProbeList from '../monitoring/probe/List';
import ProbeDetail from '../monitoring/probe/Detail'; import ProbeDetail from '../monitoring/probe/Detail';
import SensorList from '../monitoring/sensor/List';
import SensorSetup from '../monitoring/sensor/Setup';
export interface Props extends RouteComponentProps<any> { export interface Props extends RouteComponentProps<any> {
} }
@ -31,17 +33,20 @@ export class AppLayout extends React.Component<Props, State> {
public render(): JSX.Element { public render(): JSX.Element {
return ( return (
<Container fluid> <Container fluid>
<LeftMenu /> <LeftMenu />
<Segment vertical style={{ margin: '0 0 0 210px', padding: '0' }}> <Segment vertical style={{ margin: '0 0 0 210px', padding: '0' }}>
<Header /> <Header />
<Route exact path={`${this.props.match.url}/probe`} component={ProbeList} /> <Route exact path={`${this.props.match.url}/probe`} component={ProbeList} />
<Route exact path={`${this.props.match.url}/probe/:id`} component={ProbeDetail} /> <Route exact path={`${this.props.match.url}/probe/:id`} component={ProbeDetail} />
<Route path={`${this.props.match.url}/probe`} component={ProbeList} />
<Route path={`${this.props.match.url}/sensor_list`} component={SensorList} />
<Route path={`${this.props.match.url}/sensor_setup`} component={SensorSetup} />
<Footer /> <Footer />
</Segment> </Segment>
</Container > </Container >
); );
} }
} }

View File

@ -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));
},
}; };
} }

View File

@ -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;

View 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,
};
};

View 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,
};
};

View File

@ -0,0 +1,7 @@
import Domain from '@overflow/domain/api/model/Domain';
interface ReadAllByDomainPayload {
domain: Domain;
}
export default ReadAllByDomainPayload;

View File

@ -0,0 +1,7 @@
import Probe from '@overflow/probe/api/model/Probe';
interface ReadAllByProbePayload {
probe: Probe;
}
export default ReadAllByProbePayload;