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,
DiscoveryInfraTargetRegistAllReducer,
HistoryReadAllByProbeReducer,
<<<<<<< 15ea4947a2911a013b4ba1377088e49bd993a7fa
HistoryReadAllByProbeAndTypeReducer,
=======
readAllTargetByInfraReducer,
>>>>>>> fixed target / sensor
],
sagaWatchers: [
AsyncRequest,

View File

@ -8,6 +8,7 @@ import {
import Target from '@overflow/target/api/model/Target';
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 * 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 asyncRequestActions from '@overflow/commons/redux/action/asyncRequest';
import * as targetListActions from '@overflow/target/redux/action/read_all_by_probe';
// FIXME::....
export function mapStateToProps(state: any, props: any): SensorConfigurationStateProps {
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) => {
dispatch(asyncRequestActions.request('MetaCrawlerService', 'readAll', CrawlerReadAllByTargetActions.REQUEST));
},
onReadAllTargetByDomain: (domain: Domain) => {
dispatch(asyncRequestActions.request('InfraService', 'readAllByDomain', targetListActions.REQUEST, JSON.stringify(domain)));
},
onCheckCrawlerAuth: (authInfo: string) => {
// 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 {
return {
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) => {
dispatch(asyncRequestActions.request('SensorService', 'readAllByTarget', ReadAllByTargetActions.REQUEST, JSON.stringify(target)));
},
onReadAllByInfra: (infra: Infra) => {
dispatch(asyncRequestActions.request('SensorService', 'readAllByInfra', ReadAllByInfraActions.REQUEST, JSON.stringify(infra)));
onReadAllByInfra: (infraId: number) => {
dispatch(asyncRequestActions.request('SensorService', 'readAllByInfra', ReadAllByInfraActions.REQUEST, infraId));
},
onReadAllByProbe: (probe: Probe) => {
dispatch(ReadAllByProbeActions.request(probe));
@ -45,8 +45,8 @@ export function mapDispatchToProps(dispatch: Dispatch<any>): SensorListDispatchP
onSelectSensor: (id: number) => {
dispatch(routerPush('/sensor/' + String(id)));
},
onAddSensor: (targetId: string) => {
dispatch(routerPush('/sensor_setup/' + String(targetId)));
onAddSensor: (infraId: string) => {
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 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 CrawlerSelectorContainer from '@overflow/meta/react/CrawlerSelector';
export interface SensorConfigurationStateProps {
targetId: number;
infraId?: number;
infraList?: Infra[];
}
export interface SensorConfigurationDispatchProps {
onReadAllTargetByDomain?(domain: Domain): void;
}
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 {
return (
<Container fluid>

View File

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