diff --git a/@overflow/discovery/component/discovery/search-config.component.html b/@overflow/discovery/component/discovery/search-config.component.html
index fb35d62..1b23511 100644
--- a/@overflow/discovery/component/discovery/search-config.component.html
+++ b/@overflow/discovery/component/discovery/search-config.component.html
@@ -84,7 +84,7 @@
-
+
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 99b49ef..cee3283 100644
--- a/@overflow/discovery/component/discovery/service-selector/service-selector.component.html
+++ b/@overflow/discovery/component/discovery/service-selector/service-selector.component.html
@@ -1,7 +1,7 @@
();
@Input() includeServices;
@Input() disabled: boolean;
constructor(
- private listStore: Store,
+ protected store: Store,
+ protected metaCrawlerService: MetaCrawlerService,
) {
- // this.crawlers$ = listStore.pipe(select(ReadAllCrawlerSelector.select('metaCrawlerList')));
+ super(store, metaCrawlerService);
}
ngOnInit() {
- // this.crawlersSubscription$ = this.crawlers$.subscribe(
- // (list: MetaCrawler[]) => {
- // if (list !== null) {
- // this.crawlers = [];
- // this.crawlers = list;
- // }
- // },
- // (error: RPCClientError) => {
- // console.log(error);
- // }
- // );
+ super.ngOnInit();
+ }
+
+ ngOnDestroy() {
+ super.ngOnDestroy();
}
ngAfterContentInit() {
// this.listStore.dispatch(new ListStore.ReadAll());
}
- ngOnDestroy() {
- if (this.crawlersSubscription$) {
- this.crawlersSubscription$.unsubscribe();
- }
- }
}
diff --git a/@overflow/meta/component/abstract/meta-crawler.component.ts b/@overflow/meta/component/abstract/meta-crawler.component.ts
new file mode 100644
index 0000000..eeed1f8
--- /dev/null
+++ b/@overflow/meta/component/abstract/meta-crawler.component.ts
@@ -0,0 +1,43 @@
+import { Component, OnInit, OnDestroy } from '@angular/core';
+import { Store, select } from '@ngrx/store';
+import { Observable, of, Subscription } from 'rxjs';
+import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
+
+import { RPCClientError } from '@loafer/ng-rpc';
+
+import { MetaCrawler } from '@overflow/commons-typescript/model/meta';
+
+import { MetaCrawlerEntitySelector } from '../../store';
+import * as MetaCrawlerEntityStore from '../../store/entity/meta-crawler';
+import { MetaCrawlerService } from '../../service/meta-crawler.service';
+
+export abstract class MetaCrawlerComponent implements OnInit, OnDestroy {
+ metaCrawlers$: Observable;
+ pending$: Observable;
+ error$: Observable;
+
+ constructor(
+ protected store: Store,
+ protected metaCrawlerService: MetaCrawlerService,
+ ) {
+ }
+
+ ngOnInit() {
+ this.metaCrawlers$ = this.store.pipe(select(MetaCrawlerEntitySelector.selectAll));
+ this.pending$ = this.store.pipe(select(MetaCrawlerEntitySelector.selectPending));
+ this.error$ = this.store.pipe(select(MetaCrawlerEntitySelector.selectError));
+
+ this.store.pipe(
+ select(MetaCrawlerEntitySelector.selectAll),
+ map((metaCrawlers: MetaCrawler[]) => {
+ if (0 < metaCrawlers.length) {
+ return;
+ }
+ this.store.dispatch(new MetaCrawlerEntityStore.ReadAll());
+ }),
+ ).take(1).subscribe();
+ }
+
+ ngOnDestroy(): void {
+ }
+}
diff --git a/@overflow/meta/component/index.ts b/@overflow/meta/component/index.ts
index a9debd2..033775b 100644
--- a/@overflow/meta/component/index.ts
+++ b/@overflow/meta/component/index.ts
@@ -1,2 +1,3 @@
export const COMPONENTS = [
+
];
diff --git a/@overflow/meta/container/index.ts b/@overflow/meta/container/index.ts
deleted file mode 100644
index 77bab2a..0000000
--- a/@overflow/meta/container/index.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-import { MetaCrawlerContainerComponent } from './meta-crawler-container.component';
-
-export const CONTAINER_COMPONENTS = [
- MetaCrawlerContainerComponent,
-];
diff --git a/@overflow/meta/container/meta-crawler-container.component.html b/@overflow/meta/container/meta-crawler-container.component.html
deleted file mode 100644
index e69de29..0000000
diff --git a/@overflow/meta/container/meta-crawler-container.component.spec.ts b/@overflow/meta/container/meta-crawler-container.component.spec.ts
deleted file mode 100644
index fd64276..0000000
--- a/@overflow/meta/container/meta-crawler-container.component.spec.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { async, ComponentFixture, TestBed } from '@angular/core/testing';
-
-import { MetaCrawlerContainerComponent } from './meta-crawler-container.component';
-
-describe('MetaCrawlerContainerComponent', () => {
- let component: MetaCrawlerContainerComponent;
- let fixture: ComponentFixture;
-
- beforeEach(async(() => {
- TestBed.configureTestingModule({
- declarations: [ MetaCrawlerContainerComponent ]
- })
- .compileComponents();
- }));
-
- beforeEach(() => {
- fixture = TestBed.createComponent(MetaCrawlerContainerComponent);
- component = fixture.componentInstance;
- fixture.detectChanges();
- });
-
- it('should create', () => {
- expect(component).toBeTruthy();
- });
-});
diff --git a/@overflow/meta/container/meta-crawler-container.component.ts b/@overflow/meta/container/meta-crawler-container.component.ts
deleted file mode 100644
index 068f2b1..0000000
--- a/@overflow/meta/container/meta-crawler-container.component.ts
+++ /dev/null
@@ -1,34 +0,0 @@
-import { Component, OnInit, OnDestroy } from '@angular/core';
-import { Store, select } from '@ngrx/store';
-import { Observable, Subscription } from 'rxjs';
-
-import { NoAuthProbe } from '@overflow/commons-typescript/model/noauth';
-import { AuthContainerSelector } from '@overflow/shared/auth/store';
-import { Domain, DomainMember } from '@overflow/commons-typescript/model/domain';
-import { ConfirmationService } from 'primeng/primeng';
-import { MessageService } from 'primeng/components/common/messageservice';
-import { RPCClientError } from '@loafer/ng-rpc';
-
-import { MetaCrawler } from '@overflow/commons-typescript/model/meta';
-
-import { MetaCrawlerEntitySelector } from '../store';
-
-@Component({
- selector: 'of-meta-crawler-container',
- templateUrl: './meta-crawler-container.component.html'
-})
-export class MetaCrawlerContainerComponent implements OnInit, OnDestroy {
- metaCrawlers$: Observable;
-
- constructor(
- private store: Store,
- ) {
- }
-
- ngOnInit() {
- this.metaCrawlers$ = this.store.pipe(select(MetaCrawlerEntitySelector.selectAll));
- }
-
- ngOnDestroy(): void {
- }
-}
diff --git a/@overflow/meta/meta.module.ts b/@overflow/meta/meta.module.ts
index 6ffd65e..9cf95ea 100644
--- a/@overflow/meta/meta.module.ts
+++ b/@overflow/meta/meta.module.ts
@@ -1,8 +1,9 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
+import { UIModule } from '@overflow/shared/ui/ui.module';
+
import { COMPONENTS } from './component';
-import { CONTAINER_COMPONENTS } from './container';
import { SERVICES } from './service';
import { MetaStoreModule } from './meta-store.module';
@@ -10,15 +11,14 @@ import { MetaStoreModule } from './meta-store.module';
@NgModule({
imports: [
CommonModule,
+ UIModule,
MetaStoreModule,
],
declarations: [
COMPONENTS,
- CONTAINER_COMPONENTS
],
exports: [
COMPONENTS,
- CONTAINER_COMPONENTS
],
providers: [
SERVICES,
diff --git a/@overflow/meta/store/entity/meta-crawler/meta-crawler.state.ts b/@overflow/meta/store/entity/meta-crawler/meta-crawler.state.ts
index e04b78e..1e76af3 100644
--- a/@overflow/meta/store/entity/meta-crawler/meta-crawler.state.ts
+++ b/@overflow/meta/store/entity/meta-crawler/meta-crawler.state.ts
@@ -6,12 +6,15 @@ import { MetaCrawler } from '@overflow/commons-typescript/model/meta';
export const metaCrawlerEntityAdapter = createEntityAdapter();
export interface State extends EntityState {
+ pending: boolean;
}
export const initialState: State = metaCrawlerEntityAdapter.getInitialState({
+ pending: false,
});
export function getSelectors(selector: Selector) {
return {
...metaCrawlerEntityAdapter.getSelectors(selector),
+ selectPending: createSelector(selector, (state: State) => state.pending),
};
}