This commit is contained in:
insanity 2018-03-29 21:08:29 +09:00
parent e23ad44191
commit 36497b1455
3 changed files with 32 additions and 21 deletions

View File

@ -5,7 +5,9 @@ import { RPCClientError } from '@loafer/ng-rpc/protocol';
import { import {
DiscoveryStartInfo, DiscoveryStartInfo,
DiscoveryZone, DiscoveryZone,
Zone Zone,
DiscoveryPort,
DiscoveryService
} from '../../model'; } from '../../model';
import * as CIDR from 'ip-cidr'; import * as CIDR from 'ip-cidr';
import * as DiscoveredStore from '../../store/setting'; import * as DiscoveredStore from '../../store/setting';
@ -185,7 +187,9 @@ export class SettingComponent implements OnInit, AfterContentInit {
} }
handleServiceCheckChange(e: MatCheckboxChange) { handleServiceCheckChange(e: MatCheckboxChange) {
this.includeServices = null; if (e.checked) {
this.portChecked = true;
}
} }
handleServiceChange(list: any) { handleServiceChange(list: any) {
@ -193,31 +197,38 @@ export class SettingComponent implements OnInit, AfterContentInit {
} }
discovery() { discovery() {
if (!this.portChecked) { let discoveryPort: DiscoveryPort = null;
this.startPort = '0'; let discoveryService: DiscoveryService = null;
this.endPort = '0';
} if (this.serviceChecked) {
const services = new Array(); const services = new Array();
for (const service of this.includeServices) { for (const service of this.includeServices) {
services.push(service.name); services.push(service.name);
} }
const discoveryZone: DiscoveryZone = { discoveryService = {
discoveryHost: { includeServices: services,
firstScanRange: this.startIP, };
lastScanRange: this.endIP, }
discoveryPort: { if (this.portChecked) {
discoveryPort = {
firstScanRange: this.startPort, firstScanRange: this.startPort,
lastScanRange: this.endPort, lastScanRange: this.endPort,
includeTCP: this.tcpChecked, includeTCP: this.tcpChecked,
includeUDP: this.udpChecked, includeUDP: this.udpChecked,
excludePorts: null, excludePorts: null,
discoveryService: { discoveryService: discoveryService
includeServices: services };
} }
}, const discoveryZone: DiscoveryZone = {
discoveryHost: {
firstScanRange: this.startIP,
lastScanRange: this.endIP,
discoveryPort: discoveryPort,
}, },
}; };
console.log(discoveryZone);
console.log('start discovery - ' + this.probe.probeKey); console.log('start discovery - ' + this.probe.probeKey);
this.discoverstore.dispatch(new DiscoverStore.DiscoverZone( this.discoverstore.dispatch(new DiscoverStore.DiscoverZone(
{ probeID: this.probe.probeKey, discoveryZone: discoveryZone })); { probeID: this.probe.probeKey, discoveryZone: discoveryZone }));

View File

@ -15,7 +15,7 @@
<div [style.margin]="'30px 0px'"> <div [style.margin]="'30px 0px'">
<div>Status</div> <div>Status</div>
<mat-radio-group class="radio-group"> <mat-radio-group class="radio-group">
<mat-radio-button class="radio-button" value="0">All</mat-radio-button> <mat-radio-button class="radio-button" value="0" [checked]="true">All</mat-radio-button>
<mat-radio-button class="radio-button" value="1">Active</mat-radio-button> <mat-radio-button class="radio-button" value="1">Active</mat-radio-button>
<mat-radio-button class="radio-button" value="2">Inactive</mat-radio-button> <mat-radio-button class="radio-button" value="2">Inactive</mat-radio-button>
</mat-radio-group> </mat-radio-group>
@ -23,7 +23,7 @@
<div [style.margin]="'30px 0px'"> <div [style.margin]="'30px 0px'">
<div>Type</div> <div>Type</div>
<mat-radio-group class="radio-group"> <mat-radio-group class="radio-group">
<mat-radio-button class="radio-button" value="0">All</mat-radio-button> <mat-radio-button class="radio-button" value="0" [checked]="true">All</mat-radio-button>
<mat-radio-button class="radio-button" value="1">Host</mat-radio-button> <mat-radio-button class="radio-button" value="1">Host</mat-radio-button>
<mat-radio-button class="radio-button" value="2">Application</mat-radio-button> <mat-radio-button class="radio-button" value="2">Application</mat-radio-button>
</mat-radio-group> </mat-radio-group>

View File

@ -9,7 +9,7 @@
<perfect-scrollbar style="height: 150px"> <perfect-scrollbar style="height: 150px">
<mat-radio-group class="radio-group" > <mat-radio-group class="radio-group" >
<mat-radio-button class="radio-button" *ngFor="let t of targets" value={{t.id}} (change)="targetSelected(t)" [checked]="targets.length === 0 && t.id === target.id"> <mat-radio-button class="radio-button" *ngFor="let t of targets" value={{t.id}} (change)="targetSelected(t)" [checked]="targets.length === 1 && t.id === target.id">
{{t.displayName}} {{t.displayName}}
</mat-radio-button> </mat-radio-button>
</mat-radio-group> </mat-radio-group>