diff --git a/@overflow/discovery/component/setting/probe-selector/probe-selector.component.html b/@overflow/discovery/component/discovery/probe-selector/probe-selector.component.html similarity index 100% rename from @overflow/discovery/component/setting/probe-selector/probe-selector.component.html rename to @overflow/discovery/component/discovery/probe-selector/probe-selector.component.html diff --git a/@overflow/discovery/component/setting/probe-selector/probe-selector.component.ts b/@overflow/discovery/component/discovery/probe-selector/probe-selector.component.ts similarity index 83% rename from @overflow/discovery/component/setting/probe-selector/probe-selector.component.ts rename to @overflow/discovery/component/discovery/probe-selector/probe-selector.component.ts index 3a3f0fa..2bd6417 100644 --- a/@overflow/discovery/component/setting/probe-selector/probe-selector.component.ts +++ b/@overflow/discovery/component/discovery/probe-selector/probe-selector.component.ts @@ -4,13 +4,9 @@ import { } from '@angular/core'; import { Store, select, StateObservable } from '@ngrx/store'; import { RPCClientError } from '@loafer/ng-rpc'; -// import * as ListStore from '@overflow/probe/store/list'; -// import { ListSelector } from '@overflow/probe/store'; + import { Subscription } from 'rxjs/Subscription'; import { Probe } from '@overflow/commons-typescript/model/probe'; -import { AuthSelector } from '@overflow/member/store'; -import { Domain } from '@overflow/commons-typescript/model/domain'; -import { Dropdown } from 'primeng/primeng'; @Component({ selector: 'of-probe-selector', @@ -33,7 +29,7 @@ export class ProbeSelectorComponent implements OnInit, AfterContentInit, OnDestr } ngOnInit() { - this.probesSubscription$ = this.probes$.subscribe( + this.probesSubscription$ = this.probes$.subscribe ( (list: Probe[]) => { if (list !== null) { this.probes = list; diff --git a/@overflow/discovery/component/discovery/search-config/ip-input.component.html b/@overflow/discovery/component/discovery/search-config/ip-input.component.html new file mode 100644 index 0000000..dcd8b98 --- /dev/null +++ b/@overflow/discovery/component/discovery/search-config/ip-input.component.html @@ -0,0 +1,12 @@ + +
+ Start + + . + + . + + . + +
+ diff --git a/@overflow/discovery/component/discovery/search-config/ip-input.component.ts b/@overflow/discovery/component/discovery/search-config/ip-input.component.ts new file mode 100644 index 0000000..47a2320 --- /dev/null +++ b/@overflow/discovery/component/discovery/search-config/ip-input.component.ts @@ -0,0 +1,55 @@ +import { + AfterContentInit, + Component, + EventEmitter, + Input, + Output, + OnInit, +} from '@angular/core'; + +@Component({ + selector: 'of-ip-input', + templateUrl: './ip-input.component.html', +}) +export class IpInputComponent implements OnInit, AfterContentInit { + + first: string; + second: string; + third: string; + fourth: string; + + @Input() hostIp: string; + @Output() inputIp = new EventEmitter(); + + constructor( + ) { + } + + ngOnInit() { + if (this.hostIp !== '' && this.hostIp !== null && this.hostIp !== undefined) { + const tempIp = this.hostIp.split('.'); + + this.first = tempIp[0]; + this.second = tempIp[1]; + this.third = tempIp[2]; + this.fourth = tempIp[3]; + } + } + + ngAfterContentInit() { + } + + onIpInput(event) { + if ( + (this.first !== '' && this.first !== undefined) && + (this.second !== '' && this.second !== undefined) && + (this.third !== '' && this.third !== undefined) && + (this.fourth !== '' && this.fourth !== undefined) ) { + event.target.data = this.first + '.' + this.second + '.' + this.third + '.' + this.fourth; + this.inputIp.emit(event); + } else { + return; + } + } + +} diff --git a/@overflow/discovery/component/discovery/search-config/search-config.component.html b/@overflow/discovery/component/discovery/search-config/search-config.component.html index 97f4153..593b1ce 100644 --- a/@overflow/discovery/component/discovery/search-config/search-config.component.html +++ b/@overflow/discovery/component/discovery/search-config/search-config.component.html @@ -5,7 +5,7 @@
- +
@@ -24,40 +24,13 @@
-
- Start - - . - - . - - . - -
+
-
- End - - . - - . - - . - -
+
-
- Exclud - - . - - . - - . - -
+
@@ -70,7 +43,7 @@
- +
@@ -85,12 +58,12 @@ - +
- +
diff --git a/@overflow/discovery/component/discovery/search-config/search-config.component.ts b/@overflow/discovery/component/discovery/search-config/search-config.component.ts index 24b6c5c..19cca17 100644 --- a/@overflow/discovery/component/discovery/search-config/search-config.component.ts +++ b/@overflow/discovery/component/discovery/search-config/search-config.component.ts @@ -16,6 +16,8 @@ export class SearchConfigComponent implements OnInit, AfterContentInit { @Output() discoverySearchStartClick = new EventEmitter(); @Output() selectProbe = new EventEmitter(); + includeServices = []; + discoveryFormGroup: FormGroup; ipVesion: number; @@ -28,6 +30,12 @@ export class SearchConfigComponent implements OnInit, AfterContentInit { endPort: string; excludePort: string; + probe: number; + + startHostIp: string; + endHostIp: string; + excludeHostIp: string; + constructor( private formBuilder: FormBuilder, ) { @@ -37,6 +45,7 @@ export class SearchConfigComponent implements OnInit, AfterContentInit { this.ipVesion = 0; this.portType = 0; this.initForm(); + // this.hostIp = '192.168.1.10'; } ngAfterContentInit() { @@ -56,4 +65,9 @@ export class SearchConfigComponent implements OnInit, AfterContentInit { console.log(probe); this.selectProbe.emit(probe); } + + onInputIP(event, idx) { + console.log(idx); + console.log(event.target.data); + } } diff --git a/@overflow/discovery/component/setting/filter/service-selector/service-selector.component.html b/@overflow/discovery/component/discovery/service-selector/service-selector.component.html similarity index 100% rename from @overflow/discovery/component/setting/filter/service-selector/service-selector.component.html rename to @overflow/discovery/component/discovery/service-selector/service-selector.component.html diff --git a/@overflow/discovery/component/setting/filter/service-selector/service-selector.component.ts b/@overflow/discovery/component/discovery/service-selector/service-selector.component.ts similarity index 90% rename from @overflow/discovery/component/setting/filter/service-selector/service-selector.component.ts rename to @overflow/discovery/component/discovery/service-selector/service-selector.component.ts index 01b1577..16cf53a 100644 --- a/@overflow/discovery/component/setting/filter/service-selector/service-selector.component.ts +++ b/@overflow/discovery/component/discovery/service-selector/service-selector.component.ts @@ -1,4 +1,12 @@ -import { Component, OnInit, Input, AfterContentInit, Output, EventEmitter, OnDestroy } from '@angular/core'; +import { + Component, + OnInit, + Input, + AfterContentInit, + Output, + EventEmitter, + OnDestroy +} from '@angular/core'; import { Store, select, StateObservable } from '@ngrx/store'; import { RPCClientError } from '@loafer/ng-rpc'; import * as ListStore from '@overflow/meta/crawler/store/list'; @@ -18,8 +26,6 @@ export class ServiceSelectorComponent implements OnInit, AfterContentInit, OnDes @Output() crawlerSelected = new EventEmitter(); @Input() includeServices; - @Input() disabled: boolean; - constructor( private listStore: Store, ) { diff --git a/@overflow/discovery/component/index.ts b/@overflow/discovery/component/index.ts index ede4b22..0d18f7e 100644 --- a/@overflow/discovery/component/index.ts +++ b/@overflow/discovery/component/index.ts @@ -1,23 +1,17 @@ -import { SettingComponent } from './setting/setting.component'; -import { ProbeSelectorComponent } from './setting/probe-selector/probe-selector.component'; -import { ServiceSelectorComponent } from './setting/filter/service-selector/service-selector.component'; -import { FilterComponent } from './setting/filter/filter.component'; -import { ResultComponent } from './setting/result/result.component'; -import { FilterSummaryComponent } from './setting/filter-summary/filter-summary.component'; +import { ProbeSelectorComponent } from './discovery/probe-selector/probe-selector.component'; +import { ServiceSelectorComponent } from './discovery/service-selector/service-selector.component'; import { DiscoveryComponent } from './discovery/discovery.component'; import { SearchConfigComponent } from './discovery/search-config/search-config.component'; import { SearchFilterComponent } from './discovery/search-filter/search-filter.component'; import { SearchResultComponent } from './discovery/search-result/search-result.component'; +import { IpInputComponent } from './discovery/search-config/ip-input.component'; export const COMPONENTS = [ - SettingComponent, - FilterComponent, ServiceSelectorComponent, ProbeSelectorComponent, - ResultComponent, - FilterSummaryComponent, DiscoveryComponent, SearchConfigComponent, SearchFilterComponent, - SearchResultComponent + SearchResultComponent, + IpInputComponent ]; diff --git a/@overflow/discovery/component/setting/filter-summary/filter-summary.component.html b/@overflow/discovery/component/setting/filter-summary/filter-summary.component.html deleted file mode 100644 index 13f3ef0..0000000 --- a/@overflow/discovery/component/setting/filter-summary/filter-summary.component.html +++ /dev/null @@ -1,11 +0,0 @@ -
- - - - TCP - - - UDP - - -
\ No newline at end of file diff --git a/@overflow/discovery/component/setting/filter-summary/filter-summary.component.ts b/@overflow/discovery/component/setting/filter-summary/filter-summary.component.ts deleted file mode 100644 index 712cea5..0000000 --- a/@overflow/discovery/component/setting/filter-summary/filter-summary.component.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { Component, OnInit, Input, AfterContentInit, Output, EventEmitter, OnDestroy, OnChanges, SimpleChanges } from '@angular/core'; -import { DiscoverZone } from '@overflow/commons-typescript/model/discovery'; - -@Component({ - selector: 'of-discovery-filter-summary', - templateUrl: './filter-summary.component.html', -}) -export class FilterSummaryComponent implements OnInit, AfterContentInit, OnDestroy, OnChanges { - - @Output() click = new EventEmitter(); - @Input() data: DiscoverZone; - - private hostRange: string; - private portRange: string; - private includeTCP: boolean; - private includeUDP: boolean; - private services: string; - - constructor( - ) { - this.services = ''; - } - - ngOnInit() { - } - - ngAfterContentInit() { - } - - ngOnChanges(changes: SimpleChanges): void { - if (!this.data) { - return; - } - this.hostRange = this.data.discoverHost.firstScanRangev4 + ' ~ ' + this.data.discoverHost.lastScanRangev4; - if (this.data.discoverHost.discoverPort) { - this.portRange = this.data.discoverHost.discoverPort.firstScanRange + ' ~ ' + this.data.discoverHost.discoverPort.lastScanRange; - this.includeTCP = this.data.discoverHost.discoverPort.includeTCP; - this.includeUDP = this.data.discoverHost.discoverPort.includeUDP; - } - - if (this.data.discoverHost.discoverPort.discoverService) { - const services = this.data.discoverHost.discoverPort.discoverService.includeServices; - if (services.length > 3) { - this.services = String(services.length) + ' services selected.'; - return; - } - for (const service of services) { - this.services += service; - } - } - } - - ngOnDestroy() { - } - - onClick() { - this.click.emit(); - } -} diff --git a/@overflow/discovery/component/setting/filter/filter.component.html b/@overflow/discovery/component/setting/filter/filter.component.html deleted file mode 100644 index 51eb2cb..0000000 --- a/@overflow/discovery/component/setting/filter/filter.component.html +++ /dev/null @@ -1,66 +0,0 @@ -
-
-
-
- -
-
- -
-
- - - - -
-
- - - - -
-
- - -
-
- -
-
-
- TCP   - -
-
- UDP   - -
-
-
- -
-
- - - - -
- -
- - - - -
-
- -
-
- -
- - - -
-
-
\ No newline at end of file diff --git a/@overflow/discovery/component/setting/filter/filter.component.ts b/@overflow/discovery/component/setting/filter/filter.component.ts deleted file mode 100644 index d101bbb..0000000 --- a/@overflow/discovery/component/setting/filter/filter.component.ts +++ /dev/null @@ -1,116 +0,0 @@ -import { Component, OnInit, Input, AfterContentInit, Output, EventEmitter, OnDestroy, OnChanges, SimpleChanges } from '@angular/core'; -import * as CIDR from 'ip-cidr'; -import { Probe } from '@overflow/commons-typescript/model/probe'; -import { DiscoverZone, DiscoverPort, DiscoverService } from '@overflow/commons-typescript/model/discovery'; - -@Component({ - selector: 'of-discovery-filter', - templateUrl: './filter.component.html', -}) -export class FilterComponent implements OnInit, AfterContentInit, OnDestroy, OnChanges { - - @Input() probe: Probe; - @Input() requestStart: boolean; - @Output() discoveryRequested = new EventEmitter(); - - private startIP: string; - private endIP: string; - private startPort: string; - private endPort: string; - private includeServices = []; - - private hostChecked = true; - private portChecked = true; - private serviceChecked = true; - private tcpChecked = true; - private udpChecked = true; - - constructor( - ) { - } - - ngOnInit() { - } - - ngAfterContentInit() { - } - - ngOnDestroy() { - } - - hostRange() { - if (!this.probe || this.probe === undefined) { - return; - } - const cidr = new CIDR(this.probe.cidr); - if (!cidr.isValid()) { - alert('Invalid cidr : ' + this.probe.cidr); - return; - } - this.startIP = cidr.addressStart.address; - this.endIP = cidr.addressEnd.address; - } - - portRange() { - this.startPort = '1'; - this.endPort = '1024'; - } - - ngOnChanges(changes: SimpleChanges): void { - if (changes['probe']) { - this.hostRange(); - this.portRange(); - } - if (changes['requestStart'] && this.requestStart) { - this.onStart(); - } - } - - onPortCheckChange(serviceCheckbox, checked) { - if (!checked) { - serviceCheckbox.checked = false; - this.serviceChecked = false; - } - } - - onServiceCheckChange(portCheckbox, checked) { - if (checked) { - portCheckbox.checked = true; - this.portChecked = true; - } - } - - onStart() { - let discoverPort: DiscoverPort = null; - let discoverService: DiscoverService = null; - - if (this.serviceChecked) { - const services = new Array(); - for (const service of this.includeServices) { - services.push(service.description); // FIXME to const name - } - discoverService = { - includeServices: services, - }; - } - if (this.portChecked) { - discoverPort = { - firstScanRange: Number(this.startPort), - lastScanRange: Number(this.endPort), - includeTCP: this.tcpChecked, - includeUDP: this.udpChecked, - excludePorts: null, - discoverService: discoverService - }; - } - const discoverZone: DiscoverZone = { - discoverHost: { - firstScanRangev4: this.startIP, - lastScanRangev4: this.endIP, - discoverPort: discoverPort - }, - }; - - this.discoveryRequested.emit(discoverZone); - } -} diff --git a/@overflow/discovery/component/setting/result/result.component.1.ts b/@overflow/discovery/component/setting/result/result.component.1.ts deleted file mode 100644 index 83f762a..0000000 --- a/@overflow/discovery/component/setting/result/result.component.1.ts +++ /dev/null @@ -1,190 +0,0 @@ -import { Component, OnInit, Input, AfterContentInit, Output, EventEmitter, OnDestroy } from '@angular/core'; -import { Store, select, StateObservable } from '@ngrx/store'; -import { RPCClientError } from '@loafer/ng-rpc'; -import { Subscription } from 'rxjs/Subscription'; -import { TreeNode } from 'primeng/primeng'; - -import * as DiscoveredStore from '@overflow/discovery/store/setting'; -import { SettingSelector, DiscoverSelector } from '@overflow/discovery/store'; -import * as DiscoverStore from '@overflow/discovery/store/discover'; -import * as RegistStore from '@overflow/discovery/store/regist'; - -import { Zone } from '@overflow/commons-typescript/model/discovery'; -import { Host } from '@overflow/commons-typescript/model/discovery'; -import { Port } from '@overflow/commons-typescript/model/discovery'; -import { Service } from '@overflow/commons-typescript/model/discovery'; - -@Component({ - selector: 'of-discovery-result', - templateUrl: './result.component.html', -}) -export class ResultComponent implements OnInit, AfterContentInit, OnDestroy { - - treeNodes = []; - selectedNodes = []; - zones: Map = null; - checkedSet = new Set(); - - resultSubscription$: Subscription; - result$: any; - startedSubscription$: Subscription; - started$: any; - endedSubscription$: Subscription; - ended$: any; - - inProgress = false; - - - selectedDiscoveryResult: TreeNode[]; - - constructor( - private discoverdStore: Store, - private discoverStore: Store, - private registStore: Store, - ) { - this.result$ = discoverStore.pipe(select(DiscoverSelector.select('zones'))); - this.started$ = discoverStore.pipe(select(DiscoverSelector.select('isStart'))); - this.ended$ = discoverStore.pipe(select(DiscoverSelector.select('isEnd'))); - } - - ngOnInit() { - this.resultSubscription$ = this.result$.subscribe( - (zones: Map) => { - if (zones !== undefined && zones !== null) { - console.log(zones); - this.treeNodes = this.convertTreeViewZone(zones); - this.zones = zones; - } - }, - (error: RPCClientError) => { - console.log(error.response.message); - } - ); - this.startedSubscription$ = this.started$.subscribe( - (isStart: boolean) => { - if (isStart !== undefined && isStart !== null && isStart) { - this.inProgress = true; - console.log('##Discovery has started.##'); - } - }, - (error: RPCClientError) => { - console.log(error.response.message); - } - ); - this.endedSubscription$ = this.ended$.subscribe( - (isEnd: boolean) => { - if (isEnd !== undefined && isEnd !== null && isEnd) { - console.log('##Discovery has done.##'); - } - }, - (error: RPCClientError) => { - console.log(error.response.message); - } - ); - } - - ngAfterContentInit() { - } - - ngOnDestroy() { - if (this.startedSubscription$) { - this.startedSubscription$.unsubscribe(); - } - if (this.endedSubscription$) { - this.endedSubscription$.unsubscribe(); - } - if (this.resultSubscription$) { - this.resultSubscription$.unsubscribe(); - } - } - - save() { - } - - convertTreeViewZone(zones: Map) { - - if (zones === undefined || zones === null) { - return; - } - - const treeNodes: any[] = []; - - zones.forEach((value: Zone, key: string, map) => { - const jZone: any = { - label: 'Zone - ' + value.iface, - // className: 'cn' + value.ip, - expandedIcon: 'fa-folder-open', - collapsedIcon: 'fa-folder', - }; - jZone.obj = value; - jZone.children = this.convertViewHost(value.hosts); - treeNodes.push(jZone); - }); - - return treeNodes; - } - - convertViewHost(hosts): any[] { - if (hosts === undefined || hosts === null) { - return null; - } - const hostNodes: any[] = []; - - hosts.forEach((host, hostKey) => { - - const jHost: any = { - label: 'Host - ' + host.ipv4, - // className: 'cn' + host.ip - expandedIcon: 'fa-folder-open', - collapsedIcon: 'fa-folder', - }; - jHost.obj = host; - jHost.children = this.convertViewPort(host.ports); - hostNodes.push(jHost); - - }); - - return hostNodes; - - } - - convertViewPort(ports): any[] { - if (ports === undefined || ports === null || ports.size < 0) { - return null; - } - const portChildren: any[] = []; - ports.forEach((port, portKey) => { - const jPort: any = { - label: 'Port - ' + port.portNumber, - // className: 'cn' + port.portNumber, - expandedIcon: 'fa-folder-open', - collapsedIcon: 'fa-folder', - }; - jPort.obj = port; - jPort.children = this.convertViewService(port.services); - portChildren.push(jPort); - }); - - return portChildren; - } - - convertViewService(services): any[] { - if (services === undefined || services === null || services.size <= 0) { - return null; - } - const serviceChildren: any[] = []; - services.forEach((service, serviceKey) => { - const jService: any = { - label: 'Service - ' + service.serviceName, - // className: 'cn' + service.serviceName, - }; - jService.obj = service; - - serviceChildren.push(jService); - }); - - return serviceChildren; - } - - -} diff --git a/@overflow/discovery/component/setting/result/result.component.html b/@overflow/discovery/component/setting/result/result.component.html deleted file mode 100644 index 1e05858..0000000 --- a/@overflow/discovery/component/setting/result/result.component.html +++ /dev/null @@ -1,13 +0,0 @@ -
-
- -
- - - -
- result -
- -
-
diff --git a/@overflow/discovery/component/setting/result/result.component.ts b/@overflow/discovery/component/setting/result/result.component.ts deleted file mode 100644 index 6efa341..0000000 --- a/@overflow/discovery/component/setting/result/result.component.ts +++ /dev/null @@ -1,198 +0,0 @@ -import { Component, OnInit, Input, AfterContentInit, Output, EventEmitter, OnDestroy, OnChanges, SimpleChanges } from '@angular/core'; -import { Store, select, StateObservable } from '@ngrx/store'; -import { RPCClientError } from '@loafer/ng-rpc'; -import { Subscription } from 'rxjs/Subscription'; -import { TreeNode } from 'primeng/primeng'; - -import * as DiscoveredStore from '@overflow/discovery/store/setting'; -import { SettingSelector, DiscoverSelector } from '@overflow/discovery/store'; -import * as DiscoverStore from '@overflow/discovery/store/discover'; -import * as RegistStore from '@overflow/discovery/store/regist'; - -import { Zone } from '@overflow/commons-typescript/model/discovery'; -import { Host } from '@overflow/commons-typescript/model/discovery'; -import { Port } from '@overflow/commons-typescript/model/discovery'; -import { Service } from '@overflow/commons-typescript/model/discovery'; - -@Component({ - selector: 'of-discovery-result', - templateUrl: './result.component.html', -}) -export class ResultComponent implements OnInit, AfterContentInit, OnDestroy, OnChanges { - - @Input() started: boolean; - - treeNodes = []; - selectedNodes = []; - zones: Map = null; - checkedSet = new Set(); - - resultSubscription$: Subscription; - result$: any; - startedSubscription$: Subscription; - started$: any; - endedSubscription$: Subscription; - ended$: any; - - inProgress = false; - - - selectedDiscoveryResult: TreeNode[]; - - constructor( - private discoverdStore: Store, - private discoverStore: Store, - private registStore: Store, - ) { - this.result$ = discoverStore.pipe(select(DiscoverSelector.select('zones'))); - this.started$ = discoverStore.pipe(select(DiscoverSelector.select('isStart'))); - this.ended$ = discoverStore.pipe(select(DiscoverSelector.select('isEnd'))); - } - - ngOnInit() { - this.inProgress = true; - this.resultSubscription$ = this.result$.subscribe( - (zones: Map) => { - if (zones !== undefined && zones !== null) { - console.log(zones); - this.treeNodes = this.convertTreeViewZone(zones); - this.zones = zones; - } - }, - (error: RPCClientError) => { - console.log(error.response.message); - } - ); - this.startedSubscription$ = this.started$.subscribe( - (isStart: boolean) => { - if (isStart !== undefined && isStart !== null && isStart) { - console.log('##Discovery has started.##'); - } - }, - (error: RPCClientError) => { - console.log(error.response.message); - } - ); - this.endedSubscription$ = this.ended$.subscribe( - (isEnd: boolean) => { - if (isEnd !== undefined && isEnd !== null && isEnd) { - console.log('##Discovery has done.##'); - } - }, - (error: RPCClientError) => { - console.log(error.response.message); - } - ); - } - - ngAfterContentInit() { - } - - ngOnChanges(changes: SimpleChanges): void { - if (changes['started'] && !changes['started'].currentValue) { - this.inProgress = false; - } - } - - ngOnDestroy() { - if (this.startedSubscription$) { - this.startedSubscription$.unsubscribe(); - } - if (this.endedSubscription$) { - this.endedSubscription$.unsubscribe(); - } - if (this.resultSubscription$) { - this.resultSubscription$.unsubscribe(); - } - } - - save() { - } - - convertTreeViewZone(zones: Map) { - - if (zones === undefined || zones === null) { - return; - } - - const treeNodes: any[] = []; - - zones.forEach((value: Zone, key: string, map) => { - const jZone: any = { - label: 'Zone - ' + value.iface, - // className: 'cn' + value.ip, - expandedIcon: 'fa-folder-open', - collapsedIcon: 'fa-folder', - }; - jZone.obj = value; - jZone.children = this.convertViewHost(value.hosts); - treeNodes.push(jZone); - }); - - return treeNodes; - } - - convertViewHost(hosts): any[] { - if (hosts === undefined || hosts === null) { - return null; - } - const hostNodes: any[] = []; - - hosts.forEach((host, hostKey) => { - - const jHost: any = { - label: 'Host - ' + host.ipv4, - // className: 'cn' + host.ip - expandedIcon: 'fa-folder-open', - collapsedIcon: 'fa-folder', - }; - jHost.obj = host; - jHost.children = this.convertViewPort(host.ports); - hostNodes.push(jHost); - - }); - - return hostNodes; - - } - - convertViewPort(ports): any[] { - if (ports === undefined || ports === null || ports.size < 0) { - return null; - } - const portChildren: any[] = []; - ports.forEach((port, portKey) => { - const jPort: any = { - label: 'Port - ' + port.portNumber, - // className: 'cn' + port.portNumber, - expandedIcon: 'fa-folder-open', - collapsedIcon: 'fa-folder', - }; - jPort.obj = port; - jPort.children = this.convertViewService(port.services); - portChildren.push(jPort); - }); - - return portChildren; - } - - convertViewService(services): any[] { - if (services === undefined || services === null || services.size <= 0) { - return null; - } - const serviceChildren: any[] = []; - services.forEach((service, serviceKey) => { - const jService: any = { - label: 'Service - ' + service.serviceName, - // className: 'cn' + service.serviceName, - }; - jService.obj = service; - - serviceChildren.push(jService); - }); - - return serviceChildren; - } - - -} diff --git a/@overflow/discovery/component/setting/setting.component.html b/@overflow/discovery/component/setting/setting.component.html deleted file mode 100644 index 3592ffd..0000000 --- a/@overflow/discovery/component/setting/setting.component.html +++ /dev/null @@ -1,36 +0,0 @@ - diff --git a/@overflow/discovery/component/setting/setting.component.ts b/@overflow/discovery/component/setting/setting.component.ts deleted file mode 100644 index cb03e40..0000000 --- a/@overflow/discovery/component/setting/setting.component.ts +++ /dev/null @@ -1,156 +0,0 @@ -import { - Component, OnInit, AfterContentInit, Output, EventEmitter, - Input, OnDestroy, OnChanges, SimpleChanges, ViewChild -} from '@angular/core'; -import { Store } from '@ngrx/store'; -import { - DiscoverZone, -} from '@overflow/commons-typescript/model/discovery'; - -import * as DiscoverStore from '../../store/discover'; -import { Probe } from '@overflow/commons-typescript/model/probe'; -import { ResultComponent } from './result/result.component'; -import { ProbeSelectorComponent } from './probe-selector/probe-selector.component'; -import { FilterComponent } from './filter/filter.component'; - -import { trigger, state, transition, style, animate } from '@angular/animations'; - -@Component({ - selector: 'of-discovery-setting', - templateUrl: './setting.component.html', - animations: [ - trigger( - 'discoveryFilter', [ - state('summary', style({ - height: '70px', - opacity: 0.9, - })), - state('full', style({ - height: '500px', - opacity: 1, - })), - transition('* => *', animate('200ms ease-in')), - ]), - trigger( - 'result', [ - state('show', style({ - height: '300px', - opacity: 1, - })), - state('hidden', style({ - height: '0px', - opacity: 0, - })), - transition('* => *', animate('200ms ease-in')), - ] - ) - ] -}) -export class SettingComponent implements OnInit, AfterContentInit, OnDestroy, OnChanges { - - @Input() visible: boolean; - @Input() probe: Probe; - @Output() close = new EventEmitter(); - private requestStart = false; - private started = false; - private filterData: DiscoverZone; - - private selectedProbe: Probe; - private height: number; - - @ViewChild('probeSelectorComponent') probeSelectorComponent: ProbeSelectorComponent; - @ViewChild('filterComponent') filterComponent: FilterComponent; - @ViewChild('resultComponent') resultComponent: ResultComponent; - - constructor( - private discoverStore: Store, - ) { - this.height = window.innerHeight * 0.9; - } - - ngOnInit() { - this.selectedProbe = this.probe; - } - - ngAfterContentInit() { - } - - ngOnChanges(changes: SimpleChanges): void { - if (changes['visible']) { - const change = changes['visible']; - if (!change.previousValue && change.currentValue) { - this.initAll(); - } else if (change.previousValue && !change.currentValue) { - this.destroyAll(); - } - } - } - - ngOnDestroy() { - this.selectedProbe = null; - this.started = false; - this.close.emit(); - this.requestStart = false; - } - - initAll() { - this.ngOnInit(); - if (this.probeSelectorComponent) { - this.probeSelectorComponent.ngOnInit(); - } - if (this.filterComponent) { - this.filterComponent.ngOnInit(); - } - if (this.resultComponent) { - this.resultComponent.ngOnInit(); - } - } - - destroyAll() { - this.ngOnDestroy(); - if (this.probeSelectorComponent) { - this.probeSelectorComponent.ngOnDestroy(); - } - if (this.filterComponent) { - this.filterComponent.ngOnDestroy(); - } - if (this.resultComponent) { - this.resultComponent.ngOnDestroy(); - } - } - - onProbeSelect(probe: Probe) { - this.selectedProbe = probe; - } - - onDiscoveryStart(discoverZone: DiscoverZone) { - this.filterData = discoverZone; - this.discoverStore.dispatch(new DiscoverStore.DiscoverZone( - { probeID: this.selectedProbe.probeKey, discoverZone: discoverZone })); - - setTimeout(() => { - this.started = true; - // this.requestStart = false; - }); - } - - onCancel() { - this.destroyAll(); - } - - onSave() { - this.resultComponent.save(); - } - - onStop() { - this.started = false; - } - - onSummaryClick() { - if (this.started) { - return; - } - this.requestStart = false; - } - -} diff --git a/@overflow/discovery/discovery.module.ts b/@overflow/discovery/discovery.module.ts index 58bb16e..68abde6 100644 --- a/@overflow/discovery/discovery.module.ts +++ b/@overflow/discovery/discovery.module.ts @@ -9,7 +9,6 @@ import { DiscoveryLoggerModule } from './discovery-logger.module'; import { COMPONENTS } from './component'; import { SERVICES } from './service'; import { PrimeNGModules } from '@overflow/commons/prime-ng/prime-ng.module'; -import { BrowserModule } from '@angular/platform-browser'; import { KeyValueModule } from '@overflow/commons/component/key-value/key-value.module'; @NgModule({