discovery stop

This commit is contained in:
insanity 2018-09-17 21:56:29 +09:00
parent 609ae9b49f
commit a019fd4035
4 changed files with 45 additions and 11 deletions

View File

@ -65,7 +65,7 @@
</svg>
</div>
<p-sidebar [(visible)]="displaySidebar" styleClass="ui-sidebar-md" position="right">
<p-sidebar [(visible)]="displaySidebar" styleClass="ui-sidebar-md" position="right" (onHide)="onHideDetail()">
<div *ngIf="selectedNode !== null">
<app-node-detail [node]="selectedNode" (otherHostSelect)="otherHostSelected($event)"></app-node-detail>
</div>
@ -73,7 +73,6 @@
<p-growl [(value)]="resultMsg" [sticky]="true"></p-growl>
<!-- <div class="ui-fluid">
<div class="ui-g">
<div class="ui-g-12">

View File

@ -108,6 +108,10 @@ export class HomePageComponent implements OnInit, OnDestroy {
this.discoveryConfigService.started.subscribe(res => {
if (res) {
this.startDiscovery();
} else {
if (null !== this.discoveryRequestID) {
this.probeService.send('DiscoveryService.DiscoverStop', requesterID, this.discoveryRequestID);
}
}
});
}
@ -311,6 +315,7 @@ export class HomePageComponent implements OnInit, OnDestroy {
const nodeElement = this as Element;
const node = getNodeFromElement(nodeElement);
if (null === node || 'zone' === node.group) {
__this.onTargetClick(node);
return;
}
@ -525,6 +530,27 @@ export class HomePageComponent implements OnInit, OnDestroy {
this.selectedNode = node;
}
onHideDetail() {
const __this = this;
const nodeElements = d3.select(this.discoveryTargetRef.nativeElement).selectAll('.node-container');
const linkElements = d3.select(this.discoveryTargetRef.nativeElement).selectAll('.link');
__this.selectedNode = null;
nodeElements.each(function () {
const _thisElement = this as Element;
d3.select(_thisElement).classed('semi-unselected', false);
d3.select(_thisElement).classed('unselected', false);
});
linkElements.each(function () {
const _thisElement = this as Element;
d3.select(_thisElement).classed('semi-unselected', false);
d3.select(_thisElement).classed('unselected', false);
});
}
/**
* DiscoverHost
*/
@ -606,6 +632,7 @@ export class HomePageComponent implements OnInit, OnDestroy {
const countSum = 'Host: ' + hostCount + ' / ' + 'Service: ' + serviceCount;
const timeSpentSum = hours + ':' + minutes + ':' + seconds;
this.resultMsg.push({ severity: 'success', summary: countSum, detail: timeSpentSum });
// this.simulation.stop();
}

View File

@ -1,14 +1,24 @@
<app-toolbar>
<app-nic-dropdown [blockTarget]="pagesContent" (select)="onNICSelect($event)"></app-nic-dropdown>
<app-scanner-setting-dropdown [blockTarget]="pagesContent" (ready)="onConfigReady($event)"></app-scanner-setting-dropdown>
<div class="toolbar-button push-pull-button" style="width: 32px" [hidden]="discoveryConfigService.started | async">
<button class="button-component" type="button" (click)="onStart()">
<div class="toolbar-button push-pull-button" style="width: 32px">
<div class="toolbar-button push-pull-button" style="width: 36px" *ngIf="discoveryConfigService.started | async else play">
<button class="button-component" type="button" (click)="onStop()">
Stop
</button>
</div>
<ng-template #play>
<button class="button-component" type="button" (click)="onStart()" [hidden]="discoveryConfigService.started | async">
<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
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>
</svg>
</button>
</ng-template>
</div>
<div class="toolbar-button push-pull-button" style="width: 36px" *ngIf="discoveryConfigService.started | async">
<button class="button-component" type="button">
<svg aria-hidden="true" class="octicon icon spin" version="1.1" viewBox="0 0 15 15">

View File

@ -4,7 +4,6 @@ import {
import { Router } from '@angular/router';
import { DiscoverHost, Zone } from '@overflow/model/discovery';
import { DiscoveryConfigService } from '../../commons/service/discovery-config.service';
import { ProbeService, requesterID } from '../../commons/service/probe.service';
enum MenuOrientation {
STATIC,
@ -68,7 +67,6 @@ export class PagesComponent implements AfterViewInit, OnDestroy, OnInit {
public zone: NgZone,
private router: Router,
private discoveryConfigService: DiscoveryConfigService,
private probeService: ProbeService
) {
}