This commit is contained in:
insanity 2018-09-20 19:46:10 +09:00
parent 8b255fb19f
commit 884fbcd36d
11 changed files with 54 additions and 22 deletions

View File

@ -4,4 +4,5 @@ import { PingSummary } from './summary';
export interface PingResult {
responses: Map<number, PingResponse>;
summary: PingSummary;
raw?: string[];
}

View File

@ -1,3 +1,5 @@
<p-blockUI [blocked]="block"></p-blockUI>
<div id="app-container">
<div id="app-chrome" class="focused">
<app-title-bar *ngIf="showTitleBar"></app-title-bar>

View File

@ -15,6 +15,7 @@ import { MenuEvent } from '../commons/type';
export class AppComponent implements OnInit, OnDestroy {
title = 'scanner-app';
showTitleBar: boolean;
block: boolean;
menuSubscription: Subscription;
displayAbout: boolean;
@ -25,10 +26,10 @@ export class AppComponent implements OnInit, OnDestroy {
public constructor(
private changeDetector: ChangeDetectorRef,
private electronProxyService: ElectronProxyService,
private probeService: ProbeService,
) {
// this.showTitleBar = !__LINUX__;
this.showTitleBar = false;
this.block = false;
}
ngOnInit(): void {

View File

@ -95,6 +95,12 @@
<p-blockUI id="discovery-blockUI" [target]="discoveryContainer" [blocked]="discoveryRequestID !== null">
</p-blockUI>
<p-dialog header="Stopping..." [(visible)]="stopping" [modal]="true" [responsive]="false" [width]="300" [minWidth]="200"
[minY]="70" [closeOnEscape]="false" [closable]="false" [hidden]="true">
</p-dialog>
<!-- <div class="ui-fluid">
<div class="ui-g">
<div class="ui-g-12">

View File

@ -37,6 +37,7 @@ export class HomePageComponent implements OnInit, OnDestroy {
blockedPanel = false;
displaySidebar = false;
stopping = false;
blockedDocument = false;
@ -118,6 +119,7 @@ export class HomePageComponent implements OnInit, OnDestroy {
this.startDiscovery();
} else {
if (null !== this.discoveryRequestID) {
this.stopping = true;
this.probeService.send('DiscoveryService.DiscoverStop', requesterID, this.discoveryRequestID);
}
}
@ -637,6 +639,8 @@ export class HomePageComponent implements OnInit, OnDestroy {
public DiscoveryStop(stopDate: Date) {
console.log('DiscoveryStop', stopDate);
this.discoveryConfigService.setStarted(false);
this.discoveryRequestID = null;
const _millisecond = Math.abs(stopDate.getTime() - this.discoveryStartDate.getTime());
@ -678,6 +682,7 @@ export class HomePageComponent implements OnInit, OnDestroy {
this.resultMsg.push(hostCount + '');
this.resultMsg.push(serviceCount + '');
this.resultMsg.push(hours + ':' + minutes + ':' + seconds);
this.stopping = false;
}
/**

View File

@ -4,6 +4,7 @@ import {
import { Router } from '@angular/router';
import { DiscoverHost, Zone } from '@overflow/model/discovery';
import { DiscoveryConfigService } from '../../commons/service/discovery-config.service';
import { Subject } from 'rxjs';
enum MenuOrientation {
STATIC,

View File

@ -93,8 +93,8 @@
<br />
<p-progressSpinner *ngIf="pingWaiting"></p-progressSpinner>
<textarea style="width: 100%; height: 200px; background-color: black; color:#fff;" *ngIf="!pingWaiting && pingResult"
pInputTextarea autoResize="autoResize" [(ngModel)]="pingResult.raw"></textarea>
<textarea style="width: 100%; height: 250px; background-color: black; color:#fff;" *ngIf="!pingWaiting && pingResult"
pInputTextarea autoResize="autoResize" [(ngModel)]="pingResultRaw"></textarea>
</p-tabPanel>
</p-tabView>

View File

@ -1,4 +1,4 @@
import { Component, Input, Output, EventEmitter } from '@angular/core';
import { Component, Input, OnChanges, SimpleChanges } from '@angular/core';
import { of } from 'rxjs';
import { map, catchError, take } from 'rxjs/operators';
@ -14,8 +14,7 @@ import { ProbeService } from '../service/probe.service';
templateUrl: './host-detail.component.html',
styleUrls: ['./host-detail.component.scss'],
})
export class HostDetailComponent {
export class HostDetailComponent implements OnChanges {
@Input() host: Host;
pingWaiting: boolean;
@ -25,6 +24,7 @@ export class HostDetailComponent {
deadline: number;
pingResult: PingResult;
pingResultRaw: string;
constructor(
private probeService: ProbeService,
@ -35,6 +35,11 @@ export class HostDetailComponent {
this.deadline = 1;
}
ngOnChanges(simpleChanges: SimpleChanges): void {
this.pingResult = null;
}
doPing() {
this.pingWaiting = true;
@ -48,8 +53,10 @@ export class HostDetailComponent {
.call<PingResult>('PingService.PingHost', this.host, option)
.pipe(
map((pingResult: PingResult) => {
console.log(pingResult);
if (pingResult) {
this.pingResult = pingResult;
this.pingResultRaw = pingResult.raw.join('');
}
this.pingWaiting = false;
}),

View File

@ -59,7 +59,7 @@
</ul>
</p-tabPanel>
<p-tabPanel header="Health">
<p-tabPanel header="Health" *ngIf="service.port.metaPortType.key === 'TCP'">
<div class="ui-g-10 ui-g-offset-2">Count :
<input type="number" pInputText [(ngModel)]="count" min="1" max="50">
@ -71,20 +71,28 @@
<input type="number" pInputText [(ngModel)]="deadline" min="1" max="10">
</div>
<button type="button" pButton label="Ping" (click)="doPing()" class="ui-button-secondary ui-pingbn-position"></button>
<button type="button" pButton label="Ping" (click)="doPing()" class="ui-button-secondary"></button>
<p-progressSpinner *ngIf="pingWaiting"></p-progressSpinner>
<div *ngIf="!pingWaiting && pingResult">
<ul>
<li *ngFor="let key of pingResult.responses | objectKeys">
<span *ngIf="pingResult.responses[key].error else value">
<p-table [value]="pingResult.responses | objectKeys" *ngIf="!pingWaiting && pingResult">
<ng-template pTemplate="header">
<tr>
<th style="width: 3.25em">No.</th>
<th>Response Time (ms)</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-key let-i="rowIndex">
<tr>
<td>
{{i + 1}}
</td>
<td>
{{pingResult.responses[key].time}}
{{pingResult.responses[key].error}}
</span>
<ng-template #value>
Response time {{key}} : {{pingResult.responses[key].time}}ms
</ng-template>
</li>
</ul>
</div>
</td>
</tr>
</ng-template>
</p-table>
</p-tabPanel>
</p-tabView>

View File

@ -15,11 +15,13 @@ export class ServiceDetailComponent {
@Input() service: Service;
pingWaiting: boolean;
pingResult: PingResult;
pingResultStr: string;
count: number;
interval: number;
deadline: number;
constructor(
private probeService: ProbeService
) {
@ -45,8 +47,8 @@ export class ServiceDetailComponent {
console.log(pingResult);
if (pingResult) {
this.pingResult = pingResult;
this.pingWaiting = false;
}
this.pingWaiting = false;
}),
catchError(error => {
console.log(error);
@ -58,5 +60,4 @@ export class ServiceDetailComponent {
)
.subscribe();
}
}

View File

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<title>ElectronApp</title>
<title>overFlow</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">