diff --git a/src/packages/discovery/component/setting/setting.component.html b/src/packages/discovery/component/setting/setting.component.html index 4f219dd..7b0d07f 100644 --- a/src/packages/discovery/component/setting/setting.component.html +++ b/src/packages/discovery/component/setting/setting.component.html @@ -13,21 +13,21 @@
- +
- +
- +
@@ -37,21 +37,26 @@
- +
+ TCP   + + UDP   + +
- +
- +
@@ -63,18 +68,24 @@ Cars --> +
+
+ +
- - +
- -
{{car.name}}
+
{{service.name}}
+
+
diff --git a/src/packages/discovery/component/setting/setting.component.ts b/src/packages/discovery/component/setting/setting.component.ts index aac02ee..d533e6e 100644 --- a/src/packages/discovery/component/setting/setting.component.ts +++ b/src/packages/discovery/component/setting/setting.component.ts @@ -51,12 +51,12 @@ export class SettingComponent implements OnInit, AfterContentInit { startPort; endPort; // private settingForm: FormGroup; - hostChecked = true; - portChecked = true; - serviceChecked = true; + hostChecked = ['host']; + portChecked = []; + serviceChecked = []; tcpChecked = true; udpChecked = true; - includeServices = null; + includeServices = []; serviceItems = [ { name: 'SSH' }, @@ -75,22 +75,12 @@ export class SettingComponent implements OnInit, AfterContentInit { { name: 'NBSS' }, ]; - targetCars = []; - - cities = [ - {name: 'New York', code: 'NY'}, - {name: 'Rome', code: 'RM'}, - {name: 'London', code: 'LDN'}, - {name: 'Istanbul', code: 'IST'}, - {name: 'Paris', code: 'PRS'} -]; treeNodes = []; zones: Map = null; checkedSet = new Set(); -// treeNodes: TreeNode[] = []; testObj: any[] = testDiscovery; selectedDiscoveryResult: TreeNode[]; @@ -180,63 +170,73 @@ export class SettingComponent implements OnInit, AfterContentInit { this.endPort = '1024'; } -// handleHostCheckChange(e: MatCheckboxChange) { -// this.hostChecked = true; -// e.source.checked = true; -// } + handleHostCheckChange(e: any) { + // console.log(e); + this.hostChecked = ['host']; + // e.source.checked = true; + } -// handlePortCheckChange(e: MatCheckboxChange) { -// this.serviceChecked = false; -// } + handlePortCheckChange(e: any) { + console.log(e); + this.serviceChecked = []; + // this.serviceChecked = false; + } -// handleServiceCheckChange(e: MatCheckboxChange) { -// if (e.checked) { -// this.portChecked = true; -// } -// } + handleServiceCheckChange(e: any) { + console.log(e); + if (e) { + this.portChecked = ['port']; + } + } handleServiceChange(list: any) { this.includeServices = list; } discovery() { - // 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); - // } - // discoveryService = { - // includeServices: services, - // }; - // } - // if (this.portChecked) { - // discoveryPort = { - // firstScanRange: this.startPort, - // lastScanRange: this.endPort, - // includeTCP: this.tcpChecked, - // includeUDP: this.udpChecked, - // excludePorts: null, - // discoveryService: discoveryService - // }; - // } - // const discoveryZone: DiscoveryZone = { - // discoveryHost: { - // firstScanRange: this.startIP, - // lastScanRange: this.endIP, - // discoveryPort: discoveryPort, - // }, - // }; + console.log(this.startIP); - // console.log(discoveryZone); + console.log(this.startPort); + console.log(this.endPort); + + let discoveryPort: DiscoveryPort = null; + let discoveryService: DiscoveryService = null; + + if (this.serviceChecked.length > 0) { + const services = new Array(); + for (const service of this.includeServices) { + services.push(service.name); + } + discoveryService = { + includeServices: services, + }; + } + if (this.portChecked.length > 0) { + discoveryPort = { + firstScanRange: this.startPort, + lastScanRange: this.endPort, + includeTCP: this.tcpChecked, + includeUDP: this.udpChecked, + excludePorts: null, + 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 })); - this.started = true; + // this.started = true; } checkDiscoveryResult(node) {