sensor list

This commit is contained in:
snoop 2017-08-14 16:51:57 +09:00
parent 3cd9585259
commit 65bbc0bb06
3 changed files with 14 additions and 55 deletions

View File

@ -34,7 +34,7 @@ export function mapDispatchToProps(dispatch: Dispatch<any>): SensorListDispatchP
dispatch(ReadAllByProbeActions.request(probe)); dispatch(ReadAllByProbeActions.request(probe));
}, },
onReadAllByDomain: (domain: Domain) => { onReadAllByDomain: (domain: Domain) => {
dispatch(asyncRequestActions.request('SensorService', 'readAllByDomain', ReadAllByDomainActions.REQUEST, domain)); dispatch(asyncRequestActions.request('SensorService', 'readAllByDomain', ReadAllByDomainActions.REQUEST, JSON.stringify(domain)));
}, },
onSelectSensor: (id: number) => { onSelectSensor: (id: number) => {
dispatch(routerPush('/sensor/' + String(id))); dispatch(routerPush('/sensor/' + String(id)));

View File

@ -11,6 +11,7 @@ export interface StateProps {
probe?: Probe; probe?: Probe;
target?: Target; target?: Target;
sensorList?: Sensor[]; sensorList?: Sensor[];
targetId?: number;
} }
export interface DispatchProps { export interface DispatchProps {
@ -37,64 +38,22 @@ export class SensorList extends React.Component<SensorListProps, SensorListState
this.state = { this.state = {
selected: null, selected: null,
}; };
let target: Target = {
id:1,
};
this.props.onReadAllByTarget(target);
} }
public componentWillMount(): void { public componentWillMount(): void {
// super.componentWillMount(); // super.componentWillMount();
if (this.props.targetId === undefined) {
let domain: Domain = {
id: 1,
};
this.props.onReadAllByDomain(domain);
} else {
let target: Target = {
id: this.props.targetId,
};
this.props.onReadAllByTarget(target);
}
// this.data = [
// {
// 'id': '111',
// 'metaSensorStatus': {
// 'name': 'NORMAL',
// },
// 'target': {
// 'id': '1',
// },
// 'metaCrawler': {
// 'name': 'WMI',
// 'description': 'WMI description',
// },
// 'crawlerInputItems': 'json value',
// 'description': 'description1111111111',
// },
// {
// 'id': '222',
// 'metaSensorStatus': {
// 'name': 'NORMAL',
// },
// 'target': {
// 'id': '1',
// },
// 'metaCrawler': {
// 'name': 'SNMP',
// 'description': 'SNMP description',
// },
// 'crawlerInputItems': 'json value',
// 'description': 'description1111111111',
// },
// {
// 'id': '333',
// 'metaSensorStatus': {
// 'name': 'NORMAL',
// },
// 'target': {
// 'id': '1',
// },
// 'metaCrawler': {
// 'name': 'JMX',
// 'description': 'JMX description',
// },
// 'crawlerInputItems': 'json value',
// 'description': 'description1111111111',
// },
// ];
} }
public handleSelect(selectedSensor: Sensor): void { public handleSelect(selectedSensor: Sensor): void {

View File

@ -35,7 +35,7 @@ export class TargetList extends React.Component<Props, State> {
public componentWillMount(): void { public componentWillMount(): void {
let probe: Probe = { let probe: Probe = {
id: Number(this.props.probeId), id: Number(1),
}; };
this.props.onReadAllByProbe(probe); this.props.onReadAllByProbe(probe);
} }