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 { export interface PingResult {
responses: Map<number, PingResponse>; responses: Map<number, PingResponse>;
summary: PingSummary; summary: PingSummary;
raw?: string[];
} }

View File

@ -1,3 +1,5 @@
<p-blockUI [blocked]="block"></p-blockUI>
<div id="app-container"> <div id="app-container">
<div id="app-chrome" class="focused"> <div id="app-chrome" class="focused">
<app-title-bar *ngIf="showTitleBar"></app-title-bar> <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 { export class AppComponent implements OnInit, OnDestroy {
title = 'scanner-app'; title = 'scanner-app';
showTitleBar: boolean; showTitleBar: boolean;
block: boolean;
menuSubscription: Subscription; menuSubscription: Subscription;
displayAbout: boolean; displayAbout: boolean;
@ -25,10 +26,10 @@ export class AppComponent implements OnInit, OnDestroy {
public constructor( public constructor(
private changeDetector: ChangeDetectorRef, private changeDetector: ChangeDetectorRef,
private electronProxyService: ElectronProxyService, private electronProxyService: ElectronProxyService,
private probeService: ProbeService,
) { ) {
// this.showTitleBar = !__LINUX__; // this.showTitleBar = !__LINUX__;
this.showTitleBar = false; this.showTitleBar = false;
this.block = false;
} }
ngOnInit(): void { ngOnInit(): void {

View File

@ -95,6 +95,12 @@
<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"
[minY]="70" [closeOnEscape]="false" [closable]="false" [hidden]="true">
</p-dialog>
<!-- <div class="ui-fluid"> <!-- <div class="ui-fluid">
<div class="ui-g"> <div class="ui-g">
<div class="ui-g-12"> <div class="ui-g-12">

View File

@ -37,6 +37,7 @@ export class HomePageComponent implements OnInit, OnDestroy {
blockedPanel = false; blockedPanel = false;
displaySidebar = false; displaySidebar = false;
stopping = false;
blockedDocument = false; blockedDocument = false;
@ -118,6 +119,7 @@ export class HomePageComponent implements OnInit, OnDestroy {
this.startDiscovery(); this.startDiscovery();
} else { } else {
if (null !== this.discoveryRequestID) { if (null !== this.discoveryRequestID) {
this.stopping = true;
this.probeService.send('DiscoveryService.DiscoverStop', requesterID, this.discoveryRequestID); this.probeService.send('DiscoveryService.DiscoverStop', requesterID, this.discoveryRequestID);
} }
} }
@ -637,6 +639,8 @@ 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());
@ -678,6 +682,7 @@ export class HomePageComponent implements OnInit, OnDestroy {
this.resultMsg.push(hostCount + ''); this.resultMsg.push(hostCount + '');
this.resultMsg.push(serviceCount + ''); this.resultMsg.push(serviceCount + '');
this.resultMsg.push(hours + ':' + minutes + ':' + seconds); this.resultMsg.push(hours + ':' + minutes + ':' + seconds);
this.stopping = false;
} }
/** /**

View File

@ -4,6 +4,7 @@ import {
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 } from '../../commons/service/discovery-config.service';
import { Subject } from 'rxjs';
enum MenuOrientation { enum MenuOrientation {
STATIC, STATIC,

View File

@ -93,8 +93,8 @@
<br /> <br />
<p-progressSpinner *ngIf="pingWaiting"></p-progressSpinner> <p-progressSpinner *ngIf="pingWaiting"></p-progressSpinner>
<textarea style="width: 100%; height: 200px; background-color: black; color:#fff;" *ngIf="!pingWaiting && pingResult" <textarea style="width: 100%; height: 250px; background-color: black; color:#fff;" *ngIf="!pingWaiting && pingResult"
pInputTextarea autoResize="autoResize" [(ngModel)]="pingResult.raw"></textarea> pInputTextarea autoResize="autoResize" [(ngModel)]="pingResultRaw"></textarea>
</p-tabPanel> </p-tabPanel>
</p-tabView> </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 { of } from 'rxjs';
import { map, catchError, take } from 'rxjs/operators'; import { map, catchError, take } from 'rxjs/operators';
@ -14,8 +14,7 @@ import { ProbeService } from '../service/probe.service';
templateUrl: './host-detail.component.html', templateUrl: './host-detail.component.html',
styleUrls: ['./host-detail.component.scss'], styleUrls: ['./host-detail.component.scss'],
}) })
export class HostDetailComponent { export class HostDetailComponent implements OnChanges {
@Input() host: Host; @Input() host: Host;
pingWaiting: boolean; pingWaiting: boolean;
@ -25,6 +24,7 @@ export class HostDetailComponent {
deadline: number; deadline: number;
pingResult: PingResult; pingResult: PingResult;
pingResultRaw: string;
constructor( constructor(
private probeService: ProbeService, private probeService: ProbeService,
@ -35,6 +35,11 @@ export class HostDetailComponent {
this.deadline = 1; this.deadline = 1;
} }
ngOnChanges(simpleChanges: SimpleChanges): void {
this.pingResult = null;
}
doPing() { doPing() {
this.pingWaiting = true; this.pingWaiting = true;
@ -48,8 +53,10 @@ export class HostDetailComponent {
.call<PingResult>('PingService.PingHost', this.host, option) .call<PingResult>('PingService.PingHost', this.host, option)
.pipe( .pipe(
map((pingResult: PingResult) => { map((pingResult: PingResult) => {
console.log(pingResult);
if (pingResult) { if (pingResult) {
this.pingResult = pingResult; this.pingResult = pingResult;
this.pingResultRaw = pingResult.raw.join('');
} }
this.pingWaiting = false; this.pingWaiting = false;
}), }),

View File

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

View File

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

View File

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