sensor list

This commit is contained in:
snoop 2017-08-24 15:28:48 +09:00
parent c790051671
commit 4b1dfd1e62
5 changed files with 33 additions and 18 deletions

View File

@ -104,11 +104,8 @@ const reduxConfig: ReduxConfig = {
modifyProbeReducer, modifyProbeReducer,
DiscoveryInfraTargetRegistAllReducer, DiscoveryInfraTargetRegistAllReducer,
HistoryReadAllByProbeReducer, HistoryReadAllByProbeReducer,
<<<<<<< 15ea4947a2911a013b4ba1377088e49bd993a7fa
HistoryReadAllByProbeAndTypeReducer, HistoryReadAllByProbeAndTypeReducer,
=======
readAllTargetByInfraReducer, readAllTargetByInfraReducer,
>>>>>>> fixed target / sensor
], ],
sagaWatchers: [ sagaWatchers: [
AsyncRequest, AsyncRequest,

View File

@ -8,6 +8,7 @@ import {
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 Domain from '@overflow/domain/api/model/Domain';
import MetaSensorItem from '@overflow/meta/api/model/MetaSensorItem'; import MetaSensorItem from '@overflow/meta/api/model/MetaSensorItem';
import * as CrawlerReadAllByTargetActions from '@overflow/meta/redux/action/crawler_read_all_by_target'; import * as CrawlerReadAllByTargetActions from '@overflow/meta/redux/action/crawler_read_all_by_target';
@ -15,12 +16,14 @@ import * as SensorItemReadAllActions from '@overflow/meta/redux/action/sensor_it
import * as RegistActions from '../redux/action/regist'; import * as RegistActions from '../redux/action/regist';
import * as asyncRequestActions from '@overflow/commons/redux/action/asyncRequest'; import * as asyncRequestActions from '@overflow/commons/redux/action/asyncRequest';
import * as targetListActions from '@overflow/target/redux/action/read_all_by_probe';
// FIXME::.... // FIXME::....
export function mapStateToProps(state: any, props: any): SensorConfigurationStateProps { export function mapStateToProps(state: any, props: any): SensorConfigurationStateProps {
return { return {
targetId: props.params.id, infraList: state.infraList,
infraId: props.params.id,
}; };
} }
@ -29,6 +32,9 @@ export function mapDispatchToProps(dispatch: Dispatch<any>): SensorConfiguration
onCrawlerReadAllByTarget: (target: Target) => { onCrawlerReadAllByTarget: (target: Target) => {
dispatch(asyncRequestActions.request('MetaCrawlerService', 'readAll', CrawlerReadAllByTargetActions.REQUEST)); dispatch(asyncRequestActions.request('MetaCrawlerService', 'readAll', CrawlerReadAllByTargetActions.REQUEST));
}, },
onReadAllTargetByDomain: (domain: Domain) => {
dispatch(asyncRequestActions.request('InfraService', 'readAllByDomain', targetListActions.REQUEST, JSON.stringify(domain)));
},
onCheckCrawlerAuth: (authInfo: string) => { onCheckCrawlerAuth: (authInfo: string) => {
// dispatch(ReadActions.request(id)); // dispatch(ReadActions.request(id));
}, },

View File

@ -24,7 +24,7 @@ import * as asyncRequestActions from '@overflow/commons/redux/action/asyncReques
export function mapStateToProps(state: any, props: any): SensorListStateProps { export function mapStateToProps(state: any, props: any): SensorListStateProps {
return { return {
sensorList:state.SensorList, sensorList:state.SensorList,
targetId: props.params.id, infraId: props.params.id,
}; };
} }
@ -33,8 +33,8 @@ export function mapDispatchToProps(dispatch: Dispatch<any>): SensorListDispatchP
onReadAllByTarget: (target: Target) => { onReadAllByTarget: (target: Target) => {
dispatch(asyncRequestActions.request('SensorService', 'readAllByTarget', ReadAllByTargetActions.REQUEST, JSON.stringify(target))); dispatch(asyncRequestActions.request('SensorService', 'readAllByTarget', ReadAllByTargetActions.REQUEST, JSON.stringify(target)));
}, },
onReadAllByInfra: (infra: Infra) => { onReadAllByInfra: (infraId: number) => {
dispatch(asyncRequestActions.request('SensorService', 'readAllByInfra', ReadAllByInfraActions.REQUEST, JSON.stringify(infra))); dispatch(asyncRequestActions.request('SensorService', 'readAllByInfra', ReadAllByInfraActions.REQUEST, infraId));
}, },
onReadAllByProbe: (probe: Probe) => { onReadAllByProbe: (probe: Probe) => {
dispatch(ReadAllByProbeActions.request(probe)); dispatch(ReadAllByProbeActions.request(probe));
@ -45,8 +45,8 @@ export function mapDispatchToProps(dispatch: Dispatch<any>): SensorListDispatchP
onSelectSensor: (id: number) => { onSelectSensor: (id: number) => {
dispatch(routerPush('/sensor/' + String(id))); dispatch(routerPush('/sensor/' + String(id)));
}, },
onAddSensor: (targetId: string) => { onAddSensor: (infraId: string) => {
dispatch(routerPush('/sensor_setup/' + String(targetId))); dispatch(routerPush('/sensor_setup/' + String(infraId)));
}, },
}; };
} }

View File

@ -3,16 +3,19 @@ import { Icon, Step, Button, Table, Radio, Form, Container, Checkbox } from 'sem
import { Grid, Image, Label, Segment, Dropdown, Input, List, Accordion, Loader } from 'semantic-ui-react'; import { Grid, Image, Label, Segment, Dropdown, Input, List, Accordion, Loader } from 'semantic-ui-react';
import MetaCrawler from '@overflow/meta/api/model/MetaCrawler'; import MetaCrawler from '@overflow/meta/api/model/MetaCrawler';
import Infra from '@overflow/infra/api/model/Infra';
import Domain from '@overflow/domain/api/model/Domain';
import SensorItemTree from '@overflow/meta/react/SensorItemTree'; import SensorItemTree from '@overflow/meta/react/SensorItemTree';
import CrawlerSelectorContainer from '@overflow/meta/react/CrawlerSelector'; import CrawlerSelectorContainer from '@overflow/meta/react/CrawlerSelector';
export interface SensorConfigurationStateProps { export interface SensorConfigurationStateProps {
targetId: number; infraId?: number;
infraList?: Infra[];
} }
export interface SensorConfigurationDispatchProps { export interface SensorConfigurationDispatchProps {
onReadAllTargetByDomain?(domain: Domain): void;
} }
export interface SensorConfigurationState { export interface SensorConfigurationState {
@ -125,6 +128,18 @@ export class ConfigStepper extends React.Component<ConfigStepperProps, ConfigSte
} }
} }
public renderTarget(): JSX.Element[] {
let elems: Array<JSX.Element> = new Array;
elems.push(
<Dropdown openOnFocus
placeholder='Select Crawler' selection />,
);
return null;
}
public render(): JSX.Element { public render(): JSX.Element {
return ( return (
<Container fluid> <Container fluid>

View File

@ -12,7 +12,7 @@ export interface StateProps {
probe?: Probe; probe?: Probe;
target?: Target; target?: Target;
sensorList?: Sensor[]; sensorList?: Sensor[];
targetId?: number; infraId?: number;
} }
export interface DispatchProps { export interface DispatchProps {
@ -44,16 +44,13 @@ export class SensorList extends React.Component<SensorListProps, SensorListState
public componentWillMount(): void { public componentWillMount(): void {
// super.componentWillMount(); // super.componentWillMount();
if (this.props.targetId === undefined) { if (this.props.infraId === undefined) {
let domain: Domain = { let domain: Domain = {
id: 1, id: 1,
}; };
this.props.onReadAllByDomain(domain); this.props.onReadAllByDomain(domain);
} else { } else {
let target: Target = { this.props.onReadAllByInfra(this.props.infraId);
id: this.props.targetId,
};
this.props.onReadAllByTarget(target);
} }
} }
@ -85,7 +82,7 @@ export class SensorList extends React.Component<SensorListProps, SensorListState
console.log(event); console.log(event);
} }
public handleAddSensor(): void { public handleAddSensor(): void {
this.props.onAddSensor(this.props.targetId ? this.props.targetId : ''); this.props.onAddSensor(this.props.infraId ? this.props.infraId : '');
} }
public render(): JSX.Element { public render(): JSX.Element {