This commit is contained in:
insanity 2018-09-21 11:10:39 +09:00
parent 7fea7f7746
commit 88705142df
5 changed files with 52 additions and 24 deletions

View File

@ -82,21 +82,21 @@
<div class="ui-g">
<div class="ui-ping-row">
<div class="title">Count </div>
<input type="number" pInputText [(ngModel)]="count" min="1" max="50">
<p-spinner size="1" [(ngModel)]="count" [min]="1" [max]="30"></p-spinner>
</div>
<div class="ui-ping-row">
<div class="title">Interval </div>
<input type="number" pInputText [(ngModel)]="interval" min="1" max="10">
<p-spinner size="1" [(ngModel)]="interval" [min]="0" [max]="5"></p-spinner>
</div>
<div class="ui-ping-row">
<div class="title">Deadline </div>
<input type="number" pInputText [(ngModel)]="deadline" min="1" max="10">
<p-spinner size="1" [(ngModel)]="deadline" [min]="1" [max]="10"></p-spinner>
</div>
</div>
<button type="button" pButton label="Ping" (click)="doPing()" class="ui-button-secondary ui-pingbn-position"></button>
<div class="ui-ping-result-textarea">
<p-progressSpinner *ngIf="pingWaiting"></p-progressSpinner>
<p-progressBar *ngIf="pingWaiting" mode="indeterminate"></p-progressBar>
<textarea *ngIf="!pingWaiting && pingResult" pInputTextarea autoResize="autoResize" [(ngModel)]="pingResultRaw"></textarea>
</div>

View File

@ -56,6 +56,7 @@ export class HostDetailComponent implements OnChanges {
console.log(pingResult);
if (pingResult) {
this.pingResult = pingResult;
console.log(pingResult.raw);
this.pingResultRaw = pingResult.raw.join('');
}
this.pingWaiting = false;

View File

@ -33,6 +33,8 @@ export class ScannerSettingDropdownComponent implements OnInit {
zone: Zone;
lastCondition: Condition = null;
validIPArray: string[];
constructor(
private discoveryConfigService: DiscoveryConfigService
) {
@ -50,13 +52,13 @@ export class ScannerSettingDropdownComponent implements OnInit {
if (this.zone === null) {
return;
}
console.log(this.zone);
const cidr = new IPCIDR(this.zone.network);
const cidrUtil = new IPCIDR(this.zone.network);
this.validIPArray = cidrUtil.toArray();
this.ipType = MetaIPTypeEnum.V4;
this.firstIP = cidr.start();
this.lastIP = cidr.end();
this.firstIP = cidrUtil.start();
this.lastIP = cidrUtil.end();
this.includePortType = [MetaPortTypeEnum.TCP, MetaPortTypeEnum.UDP];
this.firstPort = '1';
this.lastPort = '65535';
@ -74,6 +76,10 @@ export class ScannerSettingDropdownComponent implements OnInit {
this.ipErrMsg = 'Invalid IP format.';
return;
}
if (this.validIPArray.indexOf(value) === -1) {
this.ipErrMsg = 'Invalid IP range.';
return;
}
const from = idx === 0 ? value : this.firstIP;
const to = idx === 1 ? value : this.lastIP;
if (this.ipToNum(from) > this.ipToNum(to)) {

View File

@ -65,21 +65,22 @@
<div class="ui-g">
<div class="ui-ping-row">
<div class="title">Count </div>
<input type="number" pInputText [(ngModel)]="count" min="1" max="50">
<p-spinner size="1" [(ngModel)]="count" [min]="1" [max]="30"></p-spinner>
</div>
<div class="ui-ping-row">
<div class="title">Interval </div>
<input type="number" pInputText [(ngModel)]="interval" min="1" max="10">
<p-spinner size="1" [(ngModel)]="interval" [min]="0" [max]="5"></p-spinner>
</div>
<div class="ui-ping-row">
<div class="title">Deadline </div>
<input type="number" pInputText [(ngModel)]="deadline" min="1" max="10">
<p-spinner size="1" [(ngModel)]="deadline" [min]="1" [max]="10"></p-spinner>
</div>
</div>
<button type="button" pButton label="Ping" (click)="doPing()" class="ui-button-secondary ui-pingbn-position"></button>
<div class="ui-ping-result">
<p-progressSpinner *ngIf="pingWaiting"></p-progressSpinner>
<p-table [value]="pingResult.responses | objectKeys" *ngIf="!pingWaiting && pingResult">
<p-progressBar *ngIf="pingWaiting" mode="indeterminate"></p-progressBar>
<p-table [value]="pingResult.responses | objectKeys" *ngIf="!pingWaiting && pingResult" [scrollable]="true"
scrollHeight="200px">
<ng-template pTemplate="header">
<tr>
<th style="width: 3.25em">No.</th>
@ -88,7 +89,7 @@
</ng-template>
<ng-template pTemplate="body" let-key let-i="rowIndex">
<tr>
<td>
<td style="width: 3.25em">
{{i + 1}}
</td>
<td>

View File

@ -44,16 +44,36 @@
</p-tabPanel>
<p-tabPanel header="Hosts">
<perfect-scrollbar>
<ul class="key-value">
<li *ngFor="let host of zone.hostList | ipSort: 'address'">
<a href="javascript:void(0)" (click)="hostSelected(host)" style="text-decoration:none">
<span class="meta-value">{{host.address}}</span> <span *ngIf="host.name" class="meta-value">
({{host.name}})</span>
</a>
</li>
</ul>
</perfect-scrollbar>
<div>
<perfect-scrollbar>
<ul class="key-value">
<li *ngFor="let host of zone.hostList | ipSort: 'address'">
<a href="javascript:void(0)" (click)="hostSelected(host)" style="text-decoration:none">
<span class="meta-value">{{host.address}}</span> <span *ngIf="host.name" class="meta-value">
({{host.name}})</span>
</a>
</li>
<li *ngFor="let host of zone.hostList | ipSort: 'address'">
<a href="javascript:void(0)" (click)="hostSelected(host)" style="text-decoration:none">
<span class="meta-value">{{host.address}}</span> <span *ngIf="host.name" class="meta-value">
({{host.name}})</span>
</a>
</li>
<li *ngFor="let host of zone.hostList | ipSort: 'address'">
<a href="javascript:void(0)" (click)="hostSelected(host)" style="text-decoration:none">
<span class="meta-value">{{host.address}}</span> <span *ngIf="host.name" class="meta-value">
({{host.name}})</span>
</a>
</li>
<li *ngFor="let host of zone.hostList | ipSort: 'address'">
<a href="javascript:void(0)" (click)="hostSelected(host)" style="text-decoration:none">
<span class="meta-value">{{host.address}}</span> <span *ngIf="host.name" class="meta-value">
({{host.name}})</span>
</a>
</li>
</ul>
</perfect-scrollbar>
</div>
</p-tabPanel>
</p-tabView>