ing
This commit is contained in:
parent
41fc9f5e6d
commit
b43eda503f
|
@ -15,4 +15,9 @@
|
||||||
</div>
|
</div>
|
||||||
</p-sidebar>
|
</p-sidebar>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<p-dialog [showHeader]="false" [(visible)]="displayDiscoveryStopping" [modal]="true" [responsive]="false" [width]="300"
|
||||||
|
[height]="100" [minY]="70" [closeOnEscape]="false" [closable]="false">
|
||||||
|
<div class="ui-dialog-text-center">Discovery is being stopped...</div>
|
||||||
|
</p-dialog>
|
|
@ -18,4 +18,9 @@
|
||||||
|
|
||||||
/deep/ .ui-panel .ui-panel-content {
|
/deep/ .ui-panel .ui-panel-content {
|
||||||
padding: .6em .75em;
|
padding: .6em .75em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-dialog-text-center {
|
||||||
|
padding-top: 50px;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
|
@ -13,7 +13,7 @@ import { map, catchError, take, tap } from 'rxjs/operators';
|
||||||
|
|
||||||
import { Port, Service, Host } from '@overflow/model/discovery';
|
import { Port, Service, Host } from '@overflow/model/discovery';
|
||||||
|
|
||||||
import { TargetDisplayType } from '../../../core/type';
|
import { TargetDisplayType, DiscoveryStatusType } from '../../../core/type';
|
||||||
import * as AppStore from '../../../store';
|
import * as AppStore from '../../../store';
|
||||||
import * as TargetStore from '../../../store/target/target';
|
import * as TargetStore from '../../../store/target/target';
|
||||||
|
|
||||||
|
@ -30,6 +30,9 @@ export class DisplayComponent implements OnInit, AfterContentInit, OnDestroy {
|
||||||
selectedTargetSubscription: Subscription | null;
|
selectedTargetSubscription: Subscription | null;
|
||||||
selectedTarget: { group: string, target: Host | Port | Service } | null;
|
selectedTarget: { group: string, target: Host | Port | Service } | null;
|
||||||
|
|
||||||
|
displayDiscoveryStopping: boolean;
|
||||||
|
discoveryStatusSubscription: Subscription | null;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private store: Store<any>,
|
private store: Store<any>,
|
||||||
private changeDetector: ChangeDetectorRef,
|
private changeDetector: ChangeDetectorRef,
|
||||||
|
@ -56,6 +59,25 @@ export class DisplayComponent implements OnInit, AfterContentInit, OnDestroy {
|
||||||
}),
|
}),
|
||||||
).subscribe();
|
).subscribe();
|
||||||
|
|
||||||
|
this.discoveryStatusSubscription = this.store.pipe(
|
||||||
|
select(AppStore.DiscoverySelector.RequestSelector.selectDiscoveryStatus)
|
||||||
|
).pipe(
|
||||||
|
map((_discoveryStatus) => {
|
||||||
|
switch (_discoveryStatus) {
|
||||||
|
case DiscoveryStatusType.Stopping: {
|
||||||
|
__this.displayDiscoveryStopping = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default: {
|
||||||
|
__this.displayDiscoveryStopping = false;
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
__this.changeDetector.detectChanges();
|
||||||
|
}),
|
||||||
|
).subscribe();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngAfterContentInit(): void {
|
ngAfterContentInit(): void {
|
||||||
|
@ -65,6 +87,9 @@ export class DisplayComponent implements OnInit, AfterContentInit, OnDestroy {
|
||||||
if (null !== this.selectedTargetSubscription) {
|
if (null !== this.selectedTargetSubscription) {
|
||||||
this.selectedTargetSubscription.unsubscribe();
|
this.selectedTargetSubscription.unsubscribe();
|
||||||
}
|
}
|
||||||
|
if (null !== this.discoveryStatusSubscription) {
|
||||||
|
this.discoveryStatusSubscription.unsubscribe();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onHideDetail() {
|
onHideDetail() {
|
||||||
|
|
|
@ -12,7 +12,7 @@ import {
|
||||||
HostListener
|
HostListener
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
|
||||||
import { Observable, of, Subscription, combineLatest } from 'rxjs';
|
import { Observable, of, Subscription, combineLatest, Subject } from 'rxjs';
|
||||||
import { catchError, map, tap, exhaustMap, take, filter } from 'rxjs/operators';
|
import { catchError, map, tap, exhaustMap, take, filter } from 'rxjs/operators';
|
||||||
import { Store, select } from '@ngrx/store';
|
import { Store, select } from '@ngrx/store';
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ import * as TargetStore from '../../../store/target/target';
|
||||||
import * as UILayoutStore from '../../../store/ui/layout';
|
import * as UILayoutStore from '../../../store/ui/layout';
|
||||||
import { DiscoverySession } from '../../../core/discovery/discovery-session';
|
import { DiscoverySession } from '../../../core/discovery/discovery-session';
|
||||||
import { DiscoveryMessageType } from 'src/app/core/type';
|
import { DiscoveryMessageType } from 'src/app/core/type';
|
||||||
|
import { ConfirmationService } from 'primeng/primeng';
|
||||||
|
|
||||||
export class DisplaySummary {
|
export class DisplaySummary {
|
||||||
totalHosts: number;
|
totalHosts: number;
|
||||||
|
@ -36,10 +37,12 @@ export class DisplaySummary {
|
||||||
elapsedTime: string;
|
elapsedTime: string;
|
||||||
|
|
||||||
startDate: Date;
|
startDate: Date;
|
||||||
|
stopped: boolean;
|
||||||
|
|
||||||
hTimer: any;
|
hTimer: any;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
|
this.stopped = true;
|
||||||
this.totalHosts = 0;
|
this.totalHosts = 0;
|
||||||
this.totalPorts = 0;
|
this.totalPorts = 0;
|
||||||
this.totalServices = 0;
|
this.totalServices = 0;
|
||||||
|
@ -47,6 +50,7 @@ export class DisplaySummary {
|
||||||
}
|
}
|
||||||
|
|
||||||
start(startDate: Date) {
|
start(startDate: Date) {
|
||||||
|
this.stopped = false;
|
||||||
this.startDate = startDate;
|
this.startDate = startDate;
|
||||||
const __this = this;
|
const __this = this;
|
||||||
const _startDate = new Date();
|
const _startDate = new Date();
|
||||||
|
@ -71,6 +75,7 @@ export class DisplaySummary {
|
||||||
stop(stopDate: Date) {
|
stop(stopDate: Date) {
|
||||||
clearInterval(this.hTimer);
|
clearInterval(this.hTimer);
|
||||||
this.setElapsedTime(this.startDate, stopDate);
|
this.setElapsedTime(this.startDate, stopDate);
|
||||||
|
this.stopped = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
increaseHost() {
|
increaseHost() {
|
||||||
|
@ -127,10 +132,16 @@ export class MapComponent implements OnInit, AfterContentInit, OnDestroy {
|
||||||
|
|
||||||
discoverySubscription: Subscription | null = null;
|
discoverySubscription: Subscription | null = null;
|
||||||
|
|
||||||
|
private preventBrowserCloseSubject: Subject<void>;
|
||||||
|
private preventBrowserCloseSubscription: Subscription | null = null;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private store: Store<any>,
|
private store: Store<any>,
|
||||||
private changeDetector: ChangeDetectorRef,
|
private changeDetector: ChangeDetectorRef,
|
||||||
|
private confirmationService: ConfirmationService,
|
||||||
) {
|
) {
|
||||||
|
this.preventBrowserCloseSubject = new Subject<void>();
|
||||||
|
|
||||||
this.maxScale = 1;
|
this.maxScale = 1;
|
||||||
this.minScale = 0.7;
|
this.minScale = 0.7;
|
||||||
|
|
||||||
|
@ -148,6 +159,14 @@ export class MapComponent implements OnInit, AfterContentInit, OnDestroy {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@HostListener('window:beforeunload', ['$event'])
|
||||||
|
onBeforeUnload($event: Event) {
|
||||||
|
if (null !== this.displaySummary && !this.displaySummary.stopped) {
|
||||||
|
this.preventBrowserCloseSubject.next();
|
||||||
|
$event.returnValue = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@HostListener('window:resize', ['$event'])
|
@HostListener('window:resize', ['$event'])
|
||||||
onResize(event) {
|
onResize(event) {
|
||||||
if (undefined !== this.displayTargetRef) {
|
if (undefined !== this.displayTargetRef) {
|
||||||
|
@ -251,6 +270,26 @@ export class MapComponent implements OnInit, AfterContentInit, OnDestroy {
|
||||||
}),
|
}),
|
||||||
).subscribe();
|
).subscribe();
|
||||||
|
|
||||||
|
this.preventBrowserCloseSubscription = this.preventBrowserCloseSubject
|
||||||
|
.pipe(
|
||||||
|
map(() => {
|
||||||
|
this.confirmationService.confirm({
|
||||||
|
message: 'Discovery is in progress.',
|
||||||
|
header: 'Alert',
|
||||||
|
icon: 'pi pi-info-circle',
|
||||||
|
acceptLabel: 'Yes',
|
||||||
|
acceptVisible: true,
|
||||||
|
rejectVisible: false,
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
catchError(error => {
|
||||||
|
console.log(error);
|
||||||
|
alert('An error has occurred.');
|
||||||
|
return of();
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
.subscribe();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngAfterContentInit(): void {
|
ngAfterContentInit(): void {
|
||||||
|
@ -275,6 +314,9 @@ export class MapComponent implements OnInit, AfterContentInit, OnDestroy {
|
||||||
if (null !== this.selectedTargetSubscription) {
|
if (null !== this.selectedTargetSubscription) {
|
||||||
this.selectedTargetSubscription.unsubscribe();
|
this.selectedTargetSubscription.unsubscribe();
|
||||||
}
|
}
|
||||||
|
if (null !== this.preventBrowserCloseSubscription) {
|
||||||
|
this.preventBrowserCloseSubscription.unsubscribe();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
initMapDisplay(zone: Zone, hosts: Host[], ports: Port[], services: Service[]) {
|
initMapDisplay(zone: Zone, hosts: Host[], ports: Port[], services: Service[]) {
|
||||||
|
|
|
@ -20,9 +20,4 @@
|
||||||
</div>
|
</div>
|
||||||
</of-p-div>
|
</of-p-div>
|
||||||
|
|
||||||
<p-confirmDialog></p-confirmDialog>
|
<p-confirmDialog></p-confirmDialog>
|
||||||
|
|
||||||
<p-dialog [showHeader]="false" [(visible)]="stopping" [modal]="true" [responsive]="false" [width]="300" [height]="100"
|
|
||||||
[minY]="70" [closeOnEscape]="false" [closable]="false">
|
|
||||||
<div class="ui-dialog-text-center">Discovery is being stopped...</div>
|
|
||||||
</p-dialog>
|
|
|
@ -1,8 +1,7 @@
|
||||||
|
|
||||||
import { Component, OnInit, OnDestroy, ViewChild, ElementRef, ChangeDetectorRef, HostListener } from '@angular/core';
|
import { Component, OnInit, OnDestroy, } from '@angular/core';
|
||||||
|
|
||||||
import { Subject, Subscription, of, Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { map, catchError, take, tap } from 'rxjs/operators';
|
|
||||||
|
|
||||||
import { Store, select } from '@ngrx/store';
|
import { Store, select } from '@ngrx/store';
|
||||||
|
|
||||||
|
@ -24,62 +23,19 @@ import { DiscoverySession } from '../../core/discovery/discovery-session';
|
||||||
})
|
})
|
||||||
export class HomePageComponent implements OnInit, OnDestroy {
|
export class HomePageComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
blockedDocument = false;
|
|
||||||
|
|
||||||
private preventBrowserCloseSubject: Subject<void>;
|
|
||||||
private preventBrowserCloseSubscription: Subscription;
|
|
||||||
|
|
||||||
showWelcomPage$: Observable<boolean>;
|
showWelcomPage$: Observable<boolean>;
|
||||||
|
|
||||||
@HostListener('window:beforeunload', ['$event'])
|
|
||||||
onBeforeUnload($event: Event) {
|
|
||||||
// if (null !== this.discoveryRequestID) {
|
|
||||||
// this.preventBrowserCloseSubject.next();
|
|
||||||
// $event.returnValue = true;
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private confirmationService: ConfirmationService,
|
|
||||||
private probeService: ProbeService,
|
private probeService: ProbeService,
|
||||||
private store: Store<any>,
|
private store: Store<any>,
|
||||||
) {
|
) {
|
||||||
this.preventBrowserCloseSubject = new Subject<void>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.showWelcomPage$ = this.store.pipe(select(AppStore.EnvironmentSelector.UserSelector.selectShowWelcomPage));
|
this.showWelcomPage$ = this.store.pipe(select(AppStore.EnvironmentSelector.UserSelector.selectShowWelcomPage));
|
||||||
|
|
||||||
this.preventBrowserCloseSubscription = this.preventBrowserCloseSubject
|
|
||||||
.pipe(
|
|
||||||
map(() => {
|
|
||||||
this.confirmationService.confirm({
|
|
||||||
message: 'Discovery is in progress.',
|
|
||||||
header: 'Alert',
|
|
||||||
icon: 'pi pi-info-circle',
|
|
||||||
acceptLabel: 'Yes',
|
|
||||||
acceptVisible: true,
|
|
||||||
rejectVisible: false,
|
|
||||||
});
|
|
||||||
}),
|
|
||||||
catchError(error => {
|
|
||||||
console.log(error);
|
|
||||||
alert('An error has occurred.');
|
|
||||||
return of();
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
.subscribe();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
this.preventBrowserCloseSubscription.unsubscribe();
|
|
||||||
}
|
|
||||||
|
|
||||||
blockDocument() {
|
|
||||||
this.blockedDocument = true;
|
|
||||||
setTimeout(() => {
|
|
||||||
this.blockedDocument = false;
|
|
||||||
}, 3000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
requestDiscover() {
|
requestDiscover() {
|
||||||
|
|
|
@ -49,6 +49,7 @@ export function buildDefaultMenu(
|
||||||
label: __DARWIN__ ? 'Save…' : 'Save…',
|
label: __DARWIN__ ? 'Save…' : 'Save…',
|
||||||
id: 'save',
|
id: 'save',
|
||||||
click: emit('save'),
|
click: emit('save'),
|
||||||
|
enabled: false,
|
||||||
accelerator: 'CmdOrCtrl+S',
|
accelerator: 'CmdOrCtrl+S',
|
||||||
},
|
},
|
||||||
separator,
|
separator,
|
||||||
|
@ -67,7 +68,7 @@ export function buildDefaultMenu(
|
||||||
enabled: false,
|
enabled: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: __DARWIN__ ? 'svg…' : 'svg…',
|
label: __DARWIN__ ? 'SVG…' : 'SVG…',
|
||||||
id: 'export-svg',
|
id: 'export-svg',
|
||||||
click: emit('show-export-svg'),
|
click: emit('show-export-svg'),
|
||||||
enabled: false,
|
enabled: false,
|
||||||
|
@ -169,6 +170,7 @@ export function buildDefaultMenu(
|
||||||
id: 'preferences',
|
id: 'preferences',
|
||||||
accelerator: 'CmdOrCtrl+,',
|
accelerator: 'CmdOrCtrl+,',
|
||||||
click: emit('show-preferences'),
|
click: emit('show-preferences'),
|
||||||
|
enabled: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: __DARWIN__ ? 'Language…' : 'Language…',
|
label: __DARWIN__ ? 'Language…' : 'Language…',
|
||||||
|
@ -177,11 +179,13 @@ export function buildDefaultMenu(
|
||||||
label: __DARWIN__ ? 'English…' : 'English…',
|
label: __DARWIN__ ? 'English…' : 'English…',
|
||||||
id: 'language-english',
|
id: 'language-english',
|
||||||
click: emit('change-language-english'),
|
click: emit('change-language-english'),
|
||||||
|
enabled: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: __DARWIN__ ? 'Korean…' : 'Korean…',
|
label: __DARWIN__ ? 'Korean…' : 'Korean…',
|
||||||
id: 'language-korean',
|
id: 'language-korean',
|
||||||
click: emit('change-language-korean'),
|
click: emit('change-language-korean'),
|
||||||
|
enabled: false,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user