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

View File

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