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

View File

@ -15,7 +15,7 @@
<div [style.margin]="'30px 0px'">
<div>Status</div>
<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="2">Inactive</mat-radio-button>
</mat-radio-group>
@ -23,7 +23,7 @@
<div [style.margin]="'30px 0px'">
<div>Type</div>
<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="2">Application</mat-radio-button>
</mat-radio-group>

View File

@ -9,7 +9,7 @@
<perfect-scrollbar style="height: 150px">
<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}}
</mat-radio-button>
</mat-radio-group>