discovery test

This commit is contained in:
insanity 2018-03-19 17:29:35 +09:00
parent fa1c67e563
commit b4923a19d5
2 changed files with 24 additions and 7 deletions

View File

@ -13,7 +13,7 @@
<!-- <form (ngSubmit)="discovery()"> -->
<div>
<div>
<mat-checkbox [checked]="true" [(ngModel)]="hostChecked">Host</mat-checkbox>
<mat-checkbox [checked]="true" [(ngModel)]="hostChecked" (change)="handleHostCheckChange($event)">Host</mat-checkbox>
</div>
<div>
<mat-form-field *ngIf="hostChecked">
@ -26,7 +26,7 @@
</div>
<div>
<div>
<mat-checkbox [(ngModel)]="portChecked">Port</mat-checkbox>
<mat-checkbox [(ngModel)]="portChecked" (change)="handlePortCheckChange($event)">Port</mat-checkbox>
</div>
<div>
<mat-form-field *ngIf="portChecked">
@ -39,7 +39,7 @@
</div>
<div>
<div>
<mat-checkbox [(ngModel)]="serviceChecked">Service</mat-checkbox>
<mat-checkbox [(ngModel)]="serviceChecked" (change)="handleServiceCheckChange($event)">Service</mat-checkbox>
</div>
<div>
<of-input-chip *ngIf="serviceChecked" [unselectedItems]="serviceItems"></of-input-chip>

View File

@ -41,8 +41,8 @@ export class SettingComponent implements OnInit, AfterContentInit {
ngOnInit() {
this.settingSucceed$.subscribe(
(ds: DiscoveryStartInfo) => {
if (ds !== null) {
(succeed: boolean) => {
if (succeed) {
this.started = true;
}
},
@ -62,8 +62,6 @@ export class SettingComponent implements OnInit, AfterContentInit {
const cidr = new CIDR(this.cidr);
if (!cidr.isValid()) {
alert('Invalid cidr : ' + this.cidr);
this.startIP = 'Unknown';
this.endIP = 'Unknown';
return;
}
this.startIP = cidr.addressStart.address;
@ -75,7 +73,26 @@ export class SettingComponent implements OnInit, AfterContentInit {
this.endPort = '1024';
}
handleHostCheckChange(e: MatCheckboxChange) {
this.hostChecked = true;
e.source.checked = true;
}
handlePortCheckChange(e: MatCheckboxChange) {
this.serviceChecked = false;
}
handleServiceCheckChange(e: MatCheckboxChange) {
}
discovery() {
if (!this.portChecked) {
this.startPort = '0';
this.endPort = '0';
}
if (!this.serviceChecked) {
}
const startInfo: DiscoveryStartInfo = {
startIp: this.startIP,
endIP: this.endIP,