43 lines
1.3 KiB
TypeScript
43 lines
1.3 KiB
TypeScript
import { Injectable } from '@angular/core';
|
|
|
|
import { RPCService } from '@loafer/ng-rpc';
|
|
import { Observable } from 'rxjs';
|
|
|
|
import { Target } from '@overflow/commons-typescript/model/target';
|
|
import { Page, PageParams } from '@overflow/commons-typescript/core/model';
|
|
|
|
@Injectable()
|
|
export class TargetService {
|
|
|
|
public constructor(
|
|
private rpcService: RPCService,
|
|
) {
|
|
|
|
}
|
|
|
|
public regist(target: Target, probeID: number): Observable<Target> {
|
|
return this.rpcService.call<Target>('TargetService.regist', target, probeID);
|
|
}
|
|
|
|
public registAll(targets: Target[], probeID: number): Observable<Target[]> {
|
|
return this.rpcService.call<Target[]>('TargetService.registAll', targets, probeID);
|
|
}
|
|
|
|
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);
|
|
}
|
|
|
|
public readAllByProbeID(probeID: number, pageParams: PageParams): Observable<Page<Target>> {
|
|
return this.rpcService.call<Page<Target>>('TargetService.readAllByProbeID', probeID, pageParams);
|
|
}
|
|
|
|
public readAllTargetByProbeID(probeID: number): Observable<Target[]> {
|
|
return this.rpcService.call<Target[]>('TargetService.readAllTargetByProbeID', probeID);
|
|
}
|
|
|
|
}
|