,
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);
}