2018-04-06 11:02:18 +00:00
|
|
|
import { Injectable } from '@angular/core';
|
|
|
|
|
2018-05-24 06:44:13 +00:00
|
|
|
import { RPCService } from '@loafer/ng-rpc';
|
2018-06-05 11:31:29 +00:00
|
|
|
import { Observable } from 'rxjs';
|
2018-04-06 11:02:18 +00:00
|
|
|
|
2018-05-02 08:25:38 +00:00
|
|
|
import { Target } from '@overflow/commons-typescript/model/target';
|
2018-06-07 07:28:27 +00:00
|
|
|
import { Page, PageParams } from '@overflow/commons-typescript/core/model';
|
2018-04-06 11:02:18 +00:00
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
export class TargetService {
|
|
|
|
|
|
|
|
public constructor(
|
|
|
|
private rpcService: RPCService,
|
|
|
|
) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2018-06-12 13:21:53 +00:00
|
|
|
public regist(target: Target, probeID: number): Observable<Target> {
|
|
|
|
return this.rpcService.call<Target>('TargetService.regist', target, probeID);
|
2018-06-05 11:25:04 +00:00
|
|
|
}
|
2018-04-06 11:02:18 +00:00
|
|
|
|
2018-06-22 02:44:36 +00:00
|
|
|
public registAll(infraIDs: number[], probeID: number): Observable<Target[]> {
|
|
|
|
return this.rpcService.call<Target[]>('TargetService.registAll', infraIDs, probeID);
|
2018-06-05 13:01:01 +00:00
|
|
|
}
|
|
|
|
|
2018-06-12 13:21:53 +00:00
|
|
|
public remove(id: number, probeID: number) {
|
|
|
|
return this.rpcService.call('TargetService.remove', id, probeID);
|
|
|
|
}
|
|
|
|
|
|
|
|
public read(id: number): Observable<Target> {
|
|
|
|
return this.rpcService.call<Target>('TargetService.read', id);
|
2018-06-05 13:01:01 +00:00
|
|
|
}
|
2018-06-06 10:36:51 +00:00
|
|
|
|
2018-06-21 11:10:18 +00:00
|
|
|
public readAllByProbeID(probeID: number): Observable<Target[]> {
|
|
|
|
return this.rpcService.call<Target[]>('TargetService.readAllByProbeID', probeID);
|
2018-06-06 10:36:51 +00:00
|
|
|
}
|
2018-06-11 09:16:12 +00:00
|
|
|
|
2018-06-12 13:21:53 +00:00
|
|
|
public readAllTargetByProbeID(probeID: number): Observable<Target[]> {
|
|
|
|
return this.rpcService.call<Target[]>('TargetService.readAllTargetByProbeID', probeID);
|
2018-06-11 09:16:12 +00:00
|
|
|
}
|
2018-06-12 13:21:53 +00:00
|
|
|
|
2018-04-06 11:02:18 +00:00
|
|
|
}
|