This commit is contained in:
insanity 2018-09-10 18:32:41 +09:00
parent 5b3ad22280
commit 1e0836ed42
2 changed files with 14 additions and 3 deletions

View File

@ -55,8 +55,10 @@
<p-checkbox name="includePortType" value="UDP" label="UDP" [(ngModel)]="includePortType" (onChange)="validateUDP($event)"></p-checkbox>
</div>
<div class="ui-g-10 ui-g-offset-2">Range :
<input type="number" pInputText placeholder="1" style="width:100px;" [(ngModel)]="firstPort" min="1" max="65535" (ngModelChange)="validatePort($event, 0)"> -
<input type="number" pInputText placeholder="65535" style="width:100px;" [(ngModel)]="lastPort" min="1" max="65535" (ngModelChange)="validatePort($event, 1)">
<input type="text" pInputText placeholder="1" style="width:100px;" [(ngModel)]="firstPort" min="1" max="65535" maxlength="5"
(ngModelChange)="validatePort($event, 0)" (keypress)="portPressed($event)"> -
<input type="text" pInputText placeholder="65535" style="width:100px;" [(ngModel)]="lastPort" min="1" max="65535" maxlength="5"
(ngModelChange)="validatePort($event, 1)" (keypress)="portPressed($event)">
</div>
</div>
<div *ngIf="portErrMsg">

View File

@ -88,12 +88,18 @@ export class ScannerSettingDropdownComponent implements OnInit {
}
}
ipPressed(evt: any) {
ipPressed(evt: KeyboardEvent) {
if (!Number.isInteger(Number(evt.key)) && evt.key !== '.') {
return false;
}
}
portPressed(evt: KeyboardEvent) {
if (!Number.isInteger(Number(evt.key))) {
return false;
}
}
ipToNum(ip: string): number {
return ip.split('.').reduce(function (ipInt, octet) { return (ipInt << 8) + parseInt(octet, 10) }, 0) >>> 0;
}
@ -113,6 +119,7 @@ export class ScannerSettingDropdownComponent implements OnInit {
return;
}
if (to > 65535) {
console.log('?????????????????');
this.lastPort = '65535';
return;
}
@ -167,6 +174,8 @@ export class ScannerSettingDropdownComponent implements OnInit {
this.includePortType = this.lastCondition.includePortType;
this.firstPort = this.lastCondition.firstPort;
this.lastPort = this.lastCondition.lastPort;
this.ipErrMsg = '';
this.portErrMsg = '';
}
setSummary(): void {