This commit is contained in:
insanity 2018-06-06 17:57:19 +09:00
parent 1bbd827596
commit a26ab0ca40
7 changed files with 47 additions and 21 deletions

View File

@ -47,4 +47,15 @@
<button class="ui-button-width-fit" [disabled]="selectedItems.length === 0" type="button" label="Save" icon="ui-icon-close" <button class="ui-button-width-fit" [disabled]="selectedItems.length === 0" type="button" label="Save" icon="ui-icon-close"
pButton (click)="saveTargets()"></button> pButton (click)="saveTargets()"></button>
</p-panel> </p-panel>
<p-dialog header="Title" [(visible)]="displayTargetDone" [modal]="true" [responsive]="true" [width]="600" [minWidth]="200" [minY]="70"
[closeOnEscape]="false">
<span>Target 지정이 완료되었습니다. 이어서 Sensor를 등록하시면 좋겠다능</span>
<p-footer>
<button type="button" pButton label="메인으로"></button>
<button type="button" pButton label="Target으로"></button>
<button type="button" pButton label="InfraMap으로"></button>
</p-footer>
</p-dialog>

View File

@ -21,9 +21,6 @@ import { Target } from '@overflow/commons-typescript/model/target';
selector: 'of-discovery-result', selector: 'of-discovery-result',
templateUrl: './search-result.component.html', templateUrl: './search-result.component.html',
animations: Anim, animations: Anim,
providers: [
TargetService
]
}) })
export class SearchResultComponent implements OnInit, OnChanges { export class SearchResultComponent implements OnInit, OnChanges {
@ -39,9 +36,14 @@ export class SearchResultComponent implements OnInit, OnChanges {
msgs: Message[]; msgs: Message[];
error$: Observable<any>; error$: Observable<any>;
targetSaveSucceed: boolean;
displayTargetDone: boolean;
constructor( constructor(
private targetService: TargetService private targetService: TargetService
) { ) {
this.targetSaveSucceed = false;
this.displayTargetDone = false;
} }
ngOnInit(): void { ngOnInit(): void {
@ -194,8 +196,26 @@ export class SearchResultComponent implements OnInit, OnChanges {
services.push(value); 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();
} }
} }

View File

@ -1,7 +1,7 @@
import { DiscoveryService } from './discovery.service'; import { DiscoveryService } from './discovery.service';
import { TargetDiscoveryService } from './target-discovery.service'; import { TargetService } from '@overflow/target/service/target.service';
export const SERVICES = [ export const SERVICES = [
DiscoveryService, DiscoveryService,
TargetDiscoveryService, TargetService
]; ];

View File

@ -9,7 +9,6 @@ import { Observable, of, Subscription } from 'rxjs';
import { catchError, exhaustMap, map, tap } from 'rxjs/operators'; import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
import { TreeNode, MenuItem, ContextMenu } from 'primeng/primeng'; import { TreeNode, MenuItem, ContextMenu } from 'primeng/primeng';
import { Store, select } from '@ngrx/store';
import { Target } from '@overflow/commons-typescript/model/target'; import { Target } from '@overflow/commons-typescript/model/target';
import { Infra, InfraHost, InfraService } from '@overflow/commons-typescript/model/infra'; import { Infra, InfraHost, InfraService } from '@overflow/commons-typescript/model/infra';
import { Domain, DomainMember } from '@overflow/commons-typescript/model/domain'; import { Domain, DomainMember } from '@overflow/commons-typescript/model/domain';
@ -37,7 +36,6 @@ export class InfraMapComponent implements OnInit, AfterContentInit {
infraTree: TreeNode[] = []; infraTree: TreeNode[] = [];
// sensors$ = this.sensorListStore.pipe(select(sensorListSelector.select('page')));
display = false; display = false;
loading = false; loading = false;
renameProbeVisible = false; renameProbeVisible = false;
@ -64,7 +62,6 @@ export class InfraMapComponent implements OnInit, AfterContentInit {
target: Target = null; target: Target = null;
constructor( constructor(
private store: Store<any>,
private router: Router private router: Router
// private infraService: InfraService, // private infraService: InfraService,
) { ) {

View File

@ -84,12 +84,10 @@ export class ProbeListComponent implements OnInit, OnDestroy {
} }
getUptime(probe: Probe) { getUptime(probe: Probe) {
// if (!probe.connectDate) { if (!probe.connectDate) {
// return 'Not Connected.'; return 'Not Connected.';
// } }
// const connectDate = new Date(probe.connectDate); return 'TODO';
// const hours = Math.abs(new Date().getTime() - connectDate.getTime());
// return this.convertUptimeString(hours);
} }
convertUptimeString(hours: number) { convertUptimeString(hours: number) {

View File

@ -15,8 +15,8 @@ export class TargetService {
} }
public registDiscoveredTargets(probeID: number, hosts: Host[], services: Service[]): Observable<Target> { public registDiscoveredTargets(probeID: number, hosts: Host[], services: Service[]): Observable<Target[]> {
return this.rpcService.call('TargetService.registDiscoveredTargets', probeID, hosts, services); return this.rpcService.call<Target[]>('TargetService.registDiscoveredTargets', probeID, hosts, services);
} }
public modify(target: Target): Observable<Target> { public modify(target: Target): Observable<Target> {

View File

@ -6,7 +6,7 @@ const routes: Routes = [
{ path: '', loadChildren: './pages/pages.module#PagesModule', canActivate: [AuthGuard] }, { path: '', loadChildren: './pages/pages.module#PagesModule', canActivate: [AuthGuard] },
{ path: 'auth', loadChildren: './pages/auth/auth-page.module#AuthPageModule' }, { path: 'auth', loadChildren: './pages/auth/auth-page.module#AuthPageModule' },
{ path: 'error', loadChildren: './pages/error/error-page.module#ErrorPageModule' }, { path: 'error', loadChildren: './pages/error/error-page.module#ErrorPageModule' },
// { path: '**', redirectTo: 'error' }, { path: '**', redirectTo: 'error' },
]; ];
@NgModule({ @NgModule({