discovery status added
This commit is contained in:
parent
5e3b8f19a7
commit
12be850581
|
@ -1,6 +1,6 @@
|
||||||
<of-p-div #discoveryContainer>
|
<of-p-div #discoveryContainer>
|
||||||
<div *ngIf="showIntro" class="home-start">
|
<div *ngIf="showIntro" class="home-start">
|
||||||
<div class="start-button" (click)="discoveryConfigService.setStarted(true)">
|
<div class="start-button" (click)="discoveryConfigService.setDiscoveryStatus('Started')">
|
||||||
<svg version="1.1" viewBox="0 0 200 210">
|
<svg version="1.1" viewBox="0 0 200 210">
|
||||||
<path d="M8.3,193.5c0.1,2.4,0.8,4.9,2.1,7.1c4.5,7.7,14.3,10.4,22.1,5.9l152.1-87.8c2-1.3,3.8-3.1,5.1-5.4
|
<path d="M8.3,193.5c0.1,2.4,0.8,4.9,2.1,7.1c4.5,7.7,14.3,10.4,22.1,5.9l152.1-87.8c2-1.3,3.8-3.1,5.1-5.4
|
||||||
c4.5-7.7,1.8-17.6-5.9-22.1L31.6,3.4c-2.2-1.1-4.6-1.7-7.2-1.7c-8.9,0-16.2,7.2-16.2,16.2V193.5z" />
|
c4.5-7.7,1.8-17.6-5.9-22.1L31.6,3.4c-2.2-1.1-4.6-1.7-7.2-1.7c-8.9,0-16.2,7.2-16.2,16.2V193.5z" />
|
||||||
|
@ -95,9 +95,9 @@
|
||||||
<p-blockUI id="discovery-blockUI" [target]="discoveryContainer" [blocked]="discoveryRequestID !== null">
|
<p-blockUI id="discovery-blockUI" [target]="discoveryContainer" [blocked]="discoveryRequestID !== null">
|
||||||
</p-blockUI>
|
</p-blockUI>
|
||||||
|
|
||||||
<p-dialog header="Stopping..." [(visible)]="stopping" [modal]="true" [responsive]="false" [width]="300" [minWidth]="200"
|
<p-dialog [showHeader]="false" [(visible)]="stopping" [modal]="true" [responsive]="false" [width]="300" [height]="100"
|
||||||
[minY]="70" [closeOnEscape]="false" [closable]="false" [hidden]="true">
|
[minY]="70" [closeOnEscape]="false" [closable]="false">
|
||||||
|
Discovery is being stopped...
|
||||||
</p-dialog>
|
</p-dialog>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ import { toMetaIPType, MetaIPTypeEnum, toMetaCryptoType, MetaCryptoTypeEnum, toM
|
||||||
import { DiscoveryModeType } from '@overflow/model/discovery/discovery';
|
import { DiscoveryModeType } from '@overflow/model/discovery/discovery';
|
||||||
|
|
||||||
import { ProbeService, requesterID } from '../../../commons/service/probe.service';
|
import { ProbeService, requesterID } from '../../../commons/service/probe.service';
|
||||||
import { DiscoveryConfigService } from '../../../commons/service/discovery-config.service';
|
import { DiscoveryConfigService, DiscoveryStatusType } from '../../../commons/service/discovery-config.service';
|
||||||
import { Node } from '../../../commons/model/node';
|
import { Node } from '../../../commons/model/node';
|
||||||
import { Link } from '../../../commons/model/link';
|
import { Link } from '../../../commons/model/link';
|
||||||
|
|
||||||
|
@ -114,10 +114,10 @@ export class HomePageComponent implements OnInit, OnDestroy {
|
||||||
this.discoveryConfigService.discoverHost.subscribe(res => {
|
this.discoveryConfigService.discoverHost.subscribe(res => {
|
||||||
this.discoverHost = res as DiscoverHost;
|
this.discoverHost = res as DiscoverHost;
|
||||||
});
|
});
|
||||||
this.discoveryConfigService.started.subscribe(res => {
|
this.discoveryConfigService.discoveryStatus.subscribe(res => {
|
||||||
if (res) {
|
if (res === DiscoveryStatusType.Started) {
|
||||||
this.startDiscovery();
|
this.startDiscovery();
|
||||||
} else {
|
} else if (res === DiscoveryStatusType.Stopping) {
|
||||||
if (null !== this.discoveryRequestID) {
|
if (null !== this.discoveryRequestID) {
|
||||||
this.stopping = true;
|
this.stopping = true;
|
||||||
this.probeService.send('DiscoveryService.DiscoverStop', requesterID, this.discoveryRequestID);
|
this.probeService.send('DiscoveryService.DiscoverStop', requesterID, this.discoveryRequestID);
|
||||||
|
@ -639,8 +639,6 @@ export class HomePageComponent implements OnInit, OnDestroy {
|
||||||
public DiscoveryStop(stopDate: Date) {
|
public DiscoveryStop(stopDate: Date) {
|
||||||
console.log('DiscoveryStop', stopDate);
|
console.log('DiscoveryStop', stopDate);
|
||||||
|
|
||||||
this.discoveryConfigService.setStarted(false);
|
|
||||||
|
|
||||||
this.discoveryRequestID = null;
|
this.discoveryRequestID = null;
|
||||||
|
|
||||||
const _millisecond = Math.abs(stopDate.getTime() - this.discoveryStartDate.getTime());
|
const _millisecond = Math.abs(stopDate.getTime() - this.discoveryStartDate.getTime());
|
||||||
|
@ -674,7 +672,8 @@ export class HomePageComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
console.log(`Host: ${hostCount}개 Service: ${serviceCount}개`);
|
console.log(`Host: ${hostCount}개 Service: ${serviceCount}개`);
|
||||||
|
|
||||||
this.discoveryConfigService.setStarted(false);
|
this.discoveryConfigService.setDiscoveryStatus(DiscoveryStatusType.Stopped);
|
||||||
|
|
||||||
this.simulationRestart(true);
|
this.simulationRestart(true);
|
||||||
this.zoomToFit(0.95, 500);
|
this.zoomToFit(0.95, 500);
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<app-scanner-setting-dropdown [blockTarget]="pagesContent" (ready)="onConfigReady($event)"></app-scanner-setting-dropdown>
|
<app-scanner-setting-dropdown [blockTarget]="pagesContent" (ready)="onConfigReady($event)"></app-scanner-setting-dropdown>
|
||||||
<ng-template #play>
|
<ng-template #play>
|
||||||
<div class="toolbar-button push-pull-button" style="width: 32px">
|
<div class="toolbar-button push-pull-button" style="width: 32px">
|
||||||
<button class="button-component" type="button" (click)="onStart()" [hidden]="discoveryConfigService.started | async">
|
<button class="button-component" type="button" (click)="onStart()" [hidden]="discoveryStatus === 'Started' ">
|
||||||
<svg aria-hidden="true" class="octicon icon" version="1.1" viewBox="0 0 15 17">
|
<svg aria-hidden="true" class="octicon icon" version="1.1" viewBox="0 0 15 17">
|
||||||
<path d="M0.2,15.6c0,0.2,0.1,0.4,0.2,0.6c0.4,0.6,1.2,0.8,1.8,0.5l12.2-7.1c0.2-0.1,0.3-0.3,0.4-0.4
|
<path d="M0.2,15.6c0,0.2,0.1,0.4,0.2,0.6c0.4,0.6,1.2,0.8,1.8,0.5l12.2-7.1c0.2-0.1,0.3-0.3,0.4-0.4
|
||||||
c0.4-0.6,0.1-1.4-0.5-1.8L2.1,0.3C1.9,0.2,1.7,0.2,1.5,0.2c-0.7,0-1.3,0.6-1.3,1.3V15.6z"></path>
|
c0.4-0.6,0.1-1.4-0.5-1.8L2.1,0.3C1.9,0.2,1.7,0.2,1.5,0.2c-0.7,0-1.3,0.6-1.3,1.3V15.6z"></path>
|
||||||
|
@ -12,7 +12,8 @@
|
||||||
</div>
|
</div>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
|
||||||
<div class="toolbar-button push-pull-button" style="width: 36px" *ngIf="discoveryConfigService.started | async else play">
|
<!-- Stop button -->
|
||||||
|
<div class="toolbar-button push-pull-button" style="width: 36px" *ngIf="discoveryStatus === 'Started' else play">
|
||||||
<button class="button-component" type="button" (click)="onStop()">
|
<button class="button-component" type="button" (click)="onStop()">
|
||||||
<svg aria-hidden="true" class="octicon icon" version="1.1" viewBox="0 0 15 17">
|
<svg aria-hidden="true" class="octicon icon" version="1.1" viewBox="0 0 15 17">
|
||||||
<path d="M13.6,16.1H1.4c-0.8,0-1.4-0.6-1.4-1.4V2.5c0-0.8,0.6-1.4,1.4-1.4h12.2c0.8,0,1.4,0.6,1.4,1.4v12.2
|
<path d="M13.6,16.1H1.4c-0.8,0-1.4-0.6-1.4-1.4V2.5c0-0.8,0.6-1.4,1.4-1.4h12.2c0.8,0,1.4,0.6,1.4,1.4v12.2
|
||||||
|
@ -20,7 +21,9 @@
|
||||||
</svg>
|
</svg>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="toolbar-button push-pull-button" style="width: 36px" *ngIf="discoveryConfigService.started | async">
|
|
||||||
|
<!-- Loading image -->
|
||||||
|
<div class="toolbar-button push-pull-button" style="width: 36px" *ngIf="discoveryStatus !== 'Stopped' ">
|
||||||
<button class="button-component" type="button">
|
<button class="button-component" type="button">
|
||||||
<svg aria-hidden="true" class="octicon icon spin" version="1.1" viewBox="0 0 15 15">
|
<svg aria-hidden="true" class="octicon icon spin" version="1.1" viewBox="0 0 15 15">
|
||||||
<path d="M14.6,5.2l-0.7,0.3l-0.7,0.3c0.7,2.6-0.3,5.4-2.7,6.8c-2.3,1.3-5.1,1-7-0.7L4.4,12l0.1-1.5l-3.1-0.2l-0.9,3.2
|
<path d="M14.6,5.2l-0.7,0.3l-0.7,0.3c0.7,2.6-0.3,5.4-2.7,6.8c-2.3,1.3-5.1,1-7-0.7L4.4,12l0.1-1.5l-3.1-0.2l-0.9,3.2
|
||||||
|
|
|
@ -3,8 +3,7 @@ import {
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { DiscoverHost, Zone } from '@overflow/model/discovery';
|
import { DiscoverHost, Zone } from '@overflow/model/discovery';
|
||||||
import { DiscoveryConfigService } from '../../commons/service/discovery-config.service';
|
import { DiscoveryConfigService, DiscoveryStatusType } from '../../commons/service/discovery-config.service';
|
||||||
import { Subject } from 'rxjs';
|
|
||||||
|
|
||||||
enum MenuOrientation {
|
enum MenuOrientation {
|
||||||
STATIC,
|
STATIC,
|
||||||
|
@ -62,6 +61,7 @@ export class PagesComponent implements AfterViewInit, OnDestroy, OnInit {
|
||||||
rippleMouseDownListener: any;
|
rippleMouseDownListener: any;
|
||||||
|
|
||||||
discoveryMode: string;
|
discoveryMode: string;
|
||||||
|
discoveryStatus: DiscoveryStatusType;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
public renderer: Renderer,
|
public renderer: Renderer,
|
||||||
|
@ -79,6 +79,11 @@ export class PagesComponent implements AfterViewInit, OnDestroy, OnInit {
|
||||||
this.discoveryConfigService.discoveryMode.subscribe(res => {
|
this.discoveryConfigService.discoveryMode.subscribe(res => {
|
||||||
this.discoveryMode = res as string;
|
this.discoveryMode = res as string;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.discoveryConfigService.discoveryStatus.subscribe(res => {
|
||||||
|
this.discoveryStatus = res as DiscoveryStatusType;
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bindRipple() {
|
bindRipple() {
|
||||||
|
@ -369,11 +374,11 @@ export class PagesComponent implements AfterViewInit, OnDestroy, OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
onStart() {
|
onStart() {
|
||||||
this.discoveryConfigService.setStarted(true);
|
this.discoveryConfigService.setDiscoveryStatus(DiscoveryStatusType.Started);
|
||||||
}
|
}
|
||||||
|
|
||||||
onStop() {
|
onStop() {
|
||||||
this.discoveryConfigService.setStarted(false);
|
this.discoveryConfigService.setDiscoveryStatus(DiscoveryStatusType.Stopping);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
</li>
|
</li>
|
||||||
<li *ngIf="service.port">
|
<li *ngIf="service.port">
|
||||||
Port
|
Port
|
||||||
<span class="meta-value">{{service.port.metaPortType.name}} {{service.port.portNumber}}</span>
|
<span class="meta-value">{{service.port.metaPortType.key}} {{service.port.portNumber}}</span>
|
||||||
</li>
|
</li>
|
||||||
<li *ngIf="service.description">
|
<li *ngIf="service.description">
|
||||||
Description
|
Description
|
||||||
|
|
|
@ -2,6 +2,12 @@ import { Injectable } from '@angular/core';
|
||||||
import { DiscoverHost, Zone } from '@overflow/model/discovery';
|
import { DiscoverHost, Zone } from '@overflow/model/discovery';
|
||||||
import { Observable, BehaviorSubject } from 'rxjs';
|
import { Observable, BehaviorSubject } from 'rxjs';
|
||||||
|
|
||||||
|
export enum DiscoveryStatusType {
|
||||||
|
Started = 'Started',
|
||||||
|
Stopping = 'Stopping',
|
||||||
|
Stopped = 'Stopped'
|
||||||
|
}
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
|
@ -10,20 +16,22 @@ export class DiscoveryConfigService {
|
||||||
|
|
||||||
private discoverHostSubject = new BehaviorSubject<DiscoverHost>(null);
|
private discoverHostSubject = new BehaviorSubject<DiscoverHost>(null);
|
||||||
private zoneSubject = new BehaviorSubject<Zone>(null);
|
private zoneSubject = new BehaviorSubject<Zone>(null);
|
||||||
private startSubject = new BehaviorSubject<boolean>(false);
|
|
||||||
private discoveryModeSubject = new BehaviorSubject<string>('');
|
private discoveryModeSubject = new BehaviorSubject<string>('');
|
||||||
|
|
||||||
|
private statusSubject = new BehaviorSubject<DiscoveryStatusType>(DiscoveryStatusType.Stopped);
|
||||||
|
|
||||||
discoverHost: Observable<DiscoverHost>;
|
discoverHost: Observable<DiscoverHost>;
|
||||||
zone: Observable<Zone>;
|
zone: Observable<Zone>;
|
||||||
started: Observable<boolean>;
|
|
||||||
discoveryMode: Observable<string>;
|
discoveryMode: Observable<string>;
|
||||||
|
|
||||||
|
discoveryStatus: Observable<DiscoveryStatusType>;
|
||||||
|
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.discoverHost = this.discoverHostSubject.asObservable();
|
this.discoverHost = this.discoverHostSubject.asObservable();
|
||||||
this.zone = this.zoneSubject.asObservable();
|
this.zone = this.zoneSubject.asObservable();
|
||||||
this.started = this.startSubject.asObservable();
|
|
||||||
this.discoveryMode = this.discoveryModeSubject.asObservable();
|
this.discoveryMode = this.discoveryModeSubject.asObservable();
|
||||||
|
this.discoveryStatus = this.statusSubject.asObservable();
|
||||||
}
|
}
|
||||||
|
|
||||||
public setZone(zone: Zone): void {
|
public setZone(zone: Zone): void {
|
||||||
|
@ -34,11 +42,12 @@ export class DiscoveryConfigService {
|
||||||
this.discoverHostSubject.next(discoverHost);
|
this.discoverHostSubject.next(discoverHost);
|
||||||
}
|
}
|
||||||
|
|
||||||
public setStarted(isStarted: boolean): void {
|
|
||||||
this.startSubject.next(isStarted);
|
|
||||||
}
|
|
||||||
|
|
||||||
public setDiscoveryMode(mode: string): void {
|
public setDiscoveryMode(mode: string): void {
|
||||||
this.discoveryModeSubject.next(mode);
|
this.discoveryModeSubject.next(mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public setDiscoveryStatus(mode: DiscoveryStatusType) {
|
||||||
|
this.statusSubject.next(mode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user