Merge remote-tracking branch 'origin/master'

This commit is contained in:
geek 2018-06-06 19:36:54 +09:00
commit 5bf5a2e0eb
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"
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',
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<any>;
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();
}
}

View File

@ -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
];

View File

@ -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<any>,
private router: Router
// private infraService: InfraService,
) {

View File

@ -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) {

View File

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

View File

@ -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({