From a26ab0ca40a441333a399cbbe4971d5c2520c48e Mon Sep 17 00:00:00 2001 From: insanity Date: Wed, 6 Jun 2018 17:57:19 +0900 Subject: [PATCH] test --- .../component/search-result.component.html | 13 +++++++- .../component/search-result.component.ts | 32 +++++++++++++++---- @overflow/discovery/service/index.ts | 4 +-- .../infra/component/infra-map.component.ts | 3 -- .../probe/component/probe-list.component.ts | 10 +++--- @overflow/target/service/target.service.ts | 4 +-- src/app/app-routing.module.ts | 2 +- 7 files changed, 47 insertions(+), 21 deletions(-) diff --git a/@overflow/discovery/component/search-result.component.html b/@overflow/discovery/component/search-result.component.html index dd950e4..555dc75 100644 --- a/@overflow/discovery/component/search-result.component.html +++ b/@overflow/discovery/component/search-result.component.html @@ -47,4 +47,15 @@ - \ No newline at end of file + + + + + Target 지정이 완료되었습니다. 이어서 Sensor를 등록하시면 좋겠다능 + + + + + + \ No newline at end of file diff --git a/@overflow/discovery/component/search-result.component.ts b/@overflow/discovery/component/search-result.component.ts index b9c974e..ea5e50b 100644 --- a/@overflow/discovery/component/search-result.component.ts +++ b/@overflow/discovery/component/search-result.component.ts @@ -21,9 +21,6 @@ import { Target } from '@overflow/commons-typescript/model/target'; selector: 'of-discovery-result', templateUrl: './search-result.component.html', animations: Anim, - providers: [ - TargetService - ] }) export class SearchResultComponent implements OnInit, OnChanges { @@ -39,9 +36,14 @@ export class SearchResultComponent implements OnInit, OnChanges { msgs: Message[]; error$: Observable; + targetSaveSucceed: boolean; + displayTargetDone: boolean; + constructor( private targetService: TargetService ) { + this.targetSaveSucceed = false; + this.displayTargetDone = false; } ngOnInit(): void { @@ -194,8 +196,26 @@ export class SearchResultComponent implements OnInit, OnChanges { services.push(value); } }); - console.log(hosts); - console.log(services); - this.targetService.registDiscoveredTargets(this.probeHost.probe.id, hosts, services); + + this.targetService.registDiscoveredTargets(this.probeHost.probe.id, hosts, services) + .pipe( + tap(() => { + this.targetSaveSucceed = false; + }), + map((targets: Target[]) => { + if (targets) { + this.displayTargetDone = true; + } + }), + catchError(error => { + this.error$ = of(error); + return of(); + }), + tap(() => { + this.targetSaveSucceed = true; + }), + take(1), + ).subscribe(); } + } diff --git a/@overflow/discovery/service/index.ts b/@overflow/discovery/service/index.ts index d227ad7..bc88e90 100644 --- a/@overflow/discovery/service/index.ts +++ b/@overflow/discovery/service/index.ts @@ -1,7 +1,7 @@ import { DiscoveryService } from './discovery.service'; -import { TargetDiscoveryService } from './target-discovery.service'; +import { TargetService } from '@overflow/target/service/target.service'; export const SERVICES = [ DiscoveryService, - TargetDiscoveryService, + TargetService ]; diff --git a/@overflow/infra/component/infra-map.component.ts b/@overflow/infra/component/infra-map.component.ts index ab4b1f2..502f20e 100644 --- a/@overflow/infra/component/infra-map.component.ts +++ b/@overflow/infra/component/infra-map.component.ts @@ -9,7 +9,6 @@ import { Observable, of, Subscription } from 'rxjs'; import { catchError, exhaustMap, map, tap } from 'rxjs/operators'; import { TreeNode, MenuItem, ContextMenu } from 'primeng/primeng'; -import { Store, select } from '@ngrx/store'; import { Target } from '@overflow/commons-typescript/model/target'; import { Infra, InfraHost, InfraService } from '@overflow/commons-typescript/model/infra'; import { Domain, DomainMember } from '@overflow/commons-typescript/model/domain'; @@ -37,7 +36,6 @@ export class InfraMapComponent implements OnInit, AfterContentInit { infraTree: TreeNode[] = []; - // sensors$ = this.sensorListStore.pipe(select(sensorListSelector.select('page'))); display = false; loading = false; renameProbeVisible = false; @@ -64,7 +62,6 @@ export class InfraMapComponent implements OnInit, AfterContentInit { target: Target = null; constructor( - private store: Store, private router: Router // private infraService: InfraService, ) { diff --git a/@overflow/probe/component/probe-list.component.ts b/@overflow/probe/component/probe-list.component.ts index 9b4ed39..be34b98 100644 --- a/@overflow/probe/component/probe-list.component.ts +++ b/@overflow/probe/component/probe-list.component.ts @@ -84,12 +84,10 @@ export class ProbeListComponent implements OnInit, OnDestroy { } getUptime(probe: Probe) { - // if (!probe.connectDate) { - // return 'Not Connected.'; - // } - // const connectDate = new Date(probe.connectDate); - // const hours = Math.abs(new Date().getTime() - connectDate.getTime()); - // return this.convertUptimeString(hours); + if (!probe.connectDate) { + return 'Not Connected.'; + } + return 'TODO'; } convertUptimeString(hours: number) { diff --git a/@overflow/target/service/target.service.ts b/@overflow/target/service/target.service.ts index 8d63b5f..6c52ed0 100644 --- a/@overflow/target/service/target.service.ts +++ b/@overflow/target/service/target.service.ts @@ -15,8 +15,8 @@ export class TargetService { } - public registDiscoveredTargets(probeID: number, hosts: Host[], services: Service[]): Observable { - return this.rpcService.call('TargetService.registDiscoveredTargets', probeID, hosts, services); + public registDiscoveredTargets(probeID: number, hosts: Host[], services: Service[]): Observable { + return this.rpcService.call('TargetService.registDiscoveredTargets', probeID, hosts, services); } public modify(target: Target): Observable { diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 576084d..d292388 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -6,7 +6,7 @@ const routes: Routes = [ { path: '', loadChildren: './pages/pages.module#PagesModule', canActivate: [AuthGuard] }, { path: 'auth', loadChildren: './pages/auth/auth-page.module#AuthPageModule' }, { path: 'error', loadChildren: './pages/error/error-page.module#ErrorPageModule' }, - // { path: '**', redirectTo: 'error' }, + { path: '**', redirectTo: 'error' }, ]; @NgModule({