From 418947dfc036f5eb6c08d1d2a4b94995d8213ac1 Mon Sep 17 00:00:00 2001 From: geek Date: Wed, 6 Jun 2018 19:36:51 +0900 Subject: [PATCH] ing --- .../component/detail/detail.component.ts | 6 +-- @overflow/target/component/index.ts | 6 +-- .../target/component/list/list.component.ts | 39 +++++++++++++++---- @overflow/target/service/index.ts | 2 +- @overflow/target/service/target.service.ts | 15 +++++-- .../targets/target-list-page.component.html | 2 +- src/app/pages/targets/target-page.module.ts | 2 +- 7 files changed, 51 insertions(+), 21 deletions(-) diff --git a/@overflow/target/component/detail/detail.component.ts b/@overflow/target/component/detail/detail.component.ts index 7bd85e6..a86b13d 100644 --- a/@overflow/target/component/detail/detail.component.ts +++ b/@overflow/target/component/detail/detail.component.ts @@ -143,9 +143,9 @@ export class DetailComponent implements OnInit, AfterContentInit, OnDestroy { } onDisplayNameChangeKeypress(event, value) { - if (event.key === 'Enter') { - this.onDisplayNameChange(value); - } + // if (event.key === 'Enter') { + // this.onDisplayNameChange(value); + // } } } diff --git a/@overflow/target/component/index.ts b/@overflow/target/component/index.ts index 1597ea7..5ce5bb6 100644 --- a/@overflow/target/component/index.ts +++ b/@overflow/target/component/index.ts @@ -1,9 +1,9 @@ import { DetailComponent } from './detail/detail.component'; import { ListComponent } from './list/list.component'; -// import { FilterComponent } from './list/filter/filter.component'; +import {FilterComponent} from './list/filter/filter.component'; export const COMPONENTS = [ ListComponent, - // DetailComponent, - // FilterComponent + DetailComponent, + FilterComponent ]; diff --git a/@overflow/target/component/list/list.component.ts b/@overflow/target/component/list/list.component.ts index 90ced88..c451320 100644 --- a/@overflow/target/component/list/list.component.ts +++ b/@overflow/target/component/list/list.component.ts @@ -4,8 +4,12 @@ import { Infra } from '@overflow/commons-typescript/model/infra'; import { Probe } from '@overflow/commons-typescript/model/probe'; import { Target } from '@overflow/commons-typescript/model/target'; -import { Observable, of, Subscription } from 'rxjs'; import { Store, select } from '@ngrx/store'; +import { TargetService } from '../../service/target.service'; +import { InfraService } from '@overflow/infra/service/infra.service'; +import {PageParams} from '@overflow/commons-typescript/model/commons/PageParams'; +import { catchError, map, tap, take } from 'rxjs/operators'; +import {Page} from '@overflow/commons-typescript/model/commons/Page'; @Component({ selector: 'of-target-list', @@ -20,14 +24,13 @@ export class ListComponent implements OnInit, AfterContentInit, OnDestroy { // target: Target = null; // sensorSettingDisplay = false; - pageSize = '10'; - totalLength = 0; - currPage = 0; + // pageSize = '10'; + // totalLength = 0; + // currPage = 0; constructor( - // private route: ActivatedRoute, - // private router: Router, - // private store: Store, + private store: Store, + private targetService: TargetService, ) { } @@ -44,7 +47,27 @@ export class ListComponent implements OnInit, AfterContentInit, OnDestroy { // console.log(error); // } // ); - console.log('ddddddddddddddddddddd'); + const pageParams: PageParams = { + pageNo: 0, + countPerPage: 10, + sortCol: 'id', + sortDirection: 'descending', + }; + + this.targetService.readAllByProbeID(1, pageParams) + .pipe( + tap(() => { + + }), + map((r: Page) => { + console.log(r); + }), + catchError(err => { + console.log(err); + return err; + }), + take(1), + ).subscribe(); } ngAfterContentInit() { diff --git a/@overflow/target/service/index.ts b/@overflow/target/service/index.ts index f62c62a..cd647e4 100644 --- a/@overflow/target/service/index.ts +++ b/@overflow/target/service/index.ts @@ -1,5 +1,5 @@ import { TargetService } from './target.service'; export const SERVICES = [ - // TargetService, + TargetService, ]; diff --git a/@overflow/target/service/target.service.ts b/@overflow/target/service/target.service.ts index 8d63b5f..d08a6f7 100644 --- a/@overflow/target/service/target.service.ts +++ b/@overflow/target/service/target.service.ts @@ -5,6 +5,9 @@ import { Observable } from 'rxjs'; import { Target } from '@overflow/commons-typescript/model/target'; import { Host, Service } from '@overflow/commons-typescript/model/discovery'; +import {PageParams} from '@overflow/commons-typescript/model/commons/PageParams'; +import {Page} from '@overflow/commons-typescript/model/commons/Page'; +import {Notification} from '@overflow/commons-typescript/model/notification'; @Injectable() export class TargetService { @@ -18,10 +21,10 @@ export class TargetService { public registDiscoveredTargets(probeID: number, hosts: Host[], services: Service[]): Observable { return this.rpcService.call('TargetService.registDiscoveredTargets', probeID, hosts, services); } - - public modify(target: Target): Observable { - return this.rpcService.call('TargetService.modify', target); - } + // + // public modify(target: Target): Observable { + // return this.rpcService.call('TargetService.modify', target); + // } public findExistHostTarget(probeID: number, hostIP: string): Observable { return this.rpcService.call('TargetService.readExistHostTarget', probeID, hostIP); @@ -30,4 +33,8 @@ export class TargetService { public findExistServiceTarget(hostID: number, portNumber: number, portType: string): Observable { return this.rpcService.call('TargetService.readExistServiceTarget', hostID, portNumber, portType); } + + public readAllByProbeID(probeID: number, pageParams: PageParams): Observable> { + return this.rpcService.call>('TargetService.readAllByProbeID', probeID, pageParams); + } } diff --git a/src/app/pages/targets/target-list-page.component.html b/src/app/pages/targets/target-list-page.component.html index d4f229a..7021478 100644 --- a/src/app/pages/targets/target-list-page.component.html +++ b/src/app/pages/targets/target-list-page.component.html @@ -2,7 +2,7 @@
- +
diff --git a/src/app/pages/targets/target-page.module.ts b/src/app/pages/targets/target-page.module.ts index ccedc2e..a9b14a2 100644 --- a/src/app/pages/targets/target-page.module.ts +++ b/src/app/pages/targets/target-page.module.ts @@ -14,7 +14,7 @@ import { TargetPageComponent } from './target-page.component'; CommonModule, UIModule, TargetPageRoutingModule, - // TargetModule, + TargetModule, // TabbarModule ], declarations: [