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();
for (const service of this.includeServices) {
services.push(service.name);
}
discoveryService = {
includeServices: services,
};
} }
const services = new Array(); if (this.portChecked) {
for (const service of this.includeServices) { discoveryPort = {
services.push(service.name); firstScanRange: this.startPort,
lastScanRange: this.endPort,
includeTCP: this.tcpChecked,
includeUDP: this.udpChecked,
excludePorts: null,
discoveryService: discoveryService
};
} }
const discoveryZone: DiscoveryZone = { const discoveryZone: DiscoveryZone = {
discoveryHost: { discoveryHost: {
firstScanRange: this.startIP, firstScanRange: this.startIP,
lastScanRange: this.endIP, lastScanRange: this.endIP,
discoveryPort: { discoveryPort: discoveryPort,
firstScanRange: this.startPort,
lastScanRange: this.endPort,
includeTCP: this.tcpChecked,
includeUDP: this.udpChecked,
excludePorts: null,
discoveryService: {
includeServices: services
}
},
}, },
}; };
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>