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-g">
<div class="ui-ping-row"> <div class="ui-ping-row">
<div class="title">Count </div> <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>
<div class="ui-ping-row"> <div class="ui-ping-row">
<div class="title">Interval </div> <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>
<div class="ui-ping-row"> <div class="ui-ping-row">
<div class="title">Deadline </div> <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>
</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 ui-pingbn-position"></button>
<div class="ui-ping-result-textarea"> <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> <textarea *ngIf="!pingWaiting && pingResult" pInputTextarea autoResize="autoResize" [(ngModel)]="pingResultRaw"></textarea>
</div> </div>

View File

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

View File

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

View File

@ -65,21 +65,22 @@
<div class="ui-g"> <div class="ui-g">
<div class="ui-ping-row"> <div class="ui-ping-row">
<div class="title">Count </div> <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>
<div class="ui-ping-row"> <div class="ui-ping-row">
<div class="title">Interval </div> <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>
<div class="ui-ping-row"> <div class="ui-ping-row">
<div class="title">Deadline </div> <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>
</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 ui-pingbn-position"></button>
<div class="ui-ping-result"> <div class="ui-ping-result">
<p-progressSpinner *ngIf="pingWaiting"></p-progressSpinner> <p-progressBar *ngIf="pingWaiting" mode="indeterminate"></p-progressBar>
<p-table [value]="pingResult.responses | objectKeys" *ngIf="!pingWaiting && pingResult"> <p-table [value]="pingResult.responses | objectKeys" *ngIf="!pingWaiting && pingResult" [scrollable]="true"
scrollHeight="200px">
<ng-template pTemplate="header"> <ng-template pTemplate="header">
<tr> <tr>
<th style="width: 3.25em">No.</th> <th style="width: 3.25em">No.</th>
@ -88,7 +89,7 @@
</ng-template> </ng-template>
<ng-template pTemplate="body" let-key let-i="rowIndex"> <ng-template pTemplate="body" let-key let-i="rowIndex">
<tr> <tr>
<td> <td style="width: 3.25em">
{{i + 1}} {{i + 1}}
</td> </td>
<td> <td>

View File

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