diff --git a/@overflow/discovery/component/discovery/service-selector/service-selector.component.html b/@overflow/discovery/component/discovery/service-selector/service-selector.component.html index 6298863..b0e210d 100644 --- a/@overflow/discovery/component/discovery/service-selector/service-selector.component.html +++ b/@overflow/discovery/component/discovery/service-selector/service-selector.component.html @@ -1,3 +1,21 @@ - - +
+ + + + + + + + + + {{rowData.description}} + + + + + +
\ No newline at end of file diff --git a/@overflow/discovery/component/discovery/service-selector/service-selector.component.ts b/@overflow/discovery/component/discovery/service-selector/service-selector.component.ts index 516457b..ca9ddd2 100644 --- a/@overflow/discovery/component/discovery/service-selector/service-selector.component.ts +++ b/@overflow/discovery/component/discovery/service-selector/service-selector.component.ts @@ -14,38 +14,37 @@ import { catchError, exhaustMap, map, tap } from 'rxjs/operators'; import { RPCClientError } from '@loafer/ng-rpc'; import { MetaCrawler } from '@overflow/commons-typescript/model/meta'; -import { MetaCrawlerService } from '../../../../meta/service/meta-crawler.service'; +import { MetaCrawlerService } from '@overflow/meta/service/meta-crawler.service'; @Component({ selector: 'of-service-selector', templateUrl: './service-selector.component.html', }) export class ServiceSelectorComponent implements OnInit, AfterContentInit, OnDestroy { - @Output() crawlerSelected = new EventEmitter(); - @Input() includeServices; + includeServices: MetaCrawler[]; + + @Output() change = new EventEmitter(); @Input() disabled: boolean; - metaCrawlers$: Observable; + metaCrawlers: MetaCrawler[]; pending$: Observable; error$: Observable; - selected = []; - constructor( protected store: Store, protected metaCrawlerService: MetaCrawlerService, ) { - + this.includeServices = []; } ngOnInit() { - this.metaCrawlers$ = this.metaCrawlerService.readAll() + this.metaCrawlerService.readAll() .pipe( tap(() => { this.pending$ = of(true); }), map((metaCrawlers: MetaCrawler[]) => { - return metaCrawlers; + this.metaCrawlers = metaCrawlers; }), catchError(error => { this.error$ = of(error); @@ -53,8 +52,10 @@ export class ServiceSelectorComponent implements OnInit, AfterContentInit, OnDes }), tap(() => { this.pending$ = of(false); + this.includeServices = this.metaCrawlers.slice(); + this.change.emit(this.includeServices); }), - ).take(1); + ).take(1).subscribe(); } ngOnDestroy() { @@ -65,9 +66,24 @@ export class ServiceSelectorComponent implements OnInit, AfterContentInit, OnDes // this.listStore.dispatch(new ListStore.ReadAll()); } - onChange(e) { - this.selected.push(e.value); - console.log(e); + onSelectAll() { + this.includeServices = []; + this.metaCrawlers.forEach((value) => { + this.includeServices.push(value); + }); + this.change.emit(this.includeServices); + } + + onUnselectAll() { + this.includeServices = []; + this.change.emit(this.includeServices); + } + + onSelect(crawler: MetaCrawler) { + this.change.emit(this.includeServices); + } + onUnselect(crawler: MetaCrawler) { + this.change.emit(this.includeServices); } } diff --git a/@overflow/discovery/component/search-config.component.html b/@overflow/discovery/component/search-config.component.html index 1b23511..e361962 100644 --- a/@overflow/discovery/component/search-config.component.html +++ b/@overflow/discovery/component/search-config.component.html @@ -84,7 +84,7 @@
- +
diff --git a/@overflow/discovery/component/search-config.component.ts b/@overflow/discovery/component/search-config.component.ts index c00f988..78361fd 100644 --- a/@overflow/discovery/component/search-config.component.ts +++ b/@overflow/discovery/component/search-config.component.ts @@ -7,6 +7,7 @@ import * as CIDR from 'ip-cidr'; import * as ipRangeCheck from 'ip-range-check'; import { DiscoverPort, DiscoverService, DiscoverZone } from '@overflow/commons-typescript/model/discovery'; import { Checkbox } from 'primeng/primeng'; +import { MetaCrawler } from '@overflow/commons-typescript/model/meta'; @Component({ selector: 'of-discovery-search-config', @@ -101,7 +102,7 @@ export class SearchConfigComponent implements OnChanges { let discoverService: DiscoverService = null; if (this.serviceChecked) { - const services = new Array(); + const services = []; for (const service of this.includeServices) { services.push(service.description); } @@ -128,6 +129,7 @@ export class SearchConfigComponent implements OnChanges { }, }; + console.log(discoverZone); this.requestDiscovery.emit(discoverZone); }