This commit is contained in:
crusader 2018-05-29 19:49:29 +09:00
parent 10e14d5edb
commit 8f6bae5586
23 changed files with 49 additions and 35 deletions

View File

@ -3,6 +3,8 @@ import { Effect, Actions, ofType } from '@ngrx/effects';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { catchError, exhaustMap, map, tap } from 'rxjs/operators'; import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
import { MetaCrawler, MetaCrawlerInputItem } from '@overflow/commons-typescript/model/meta';
import { MetaCrawlerInputItemService } from '../../../service/meta-crawler-input-item.service'; import { MetaCrawlerInputItemService } from '../../../service/meta-crawler-input-item.service';
import { import {
@ -11,7 +13,6 @@ import {
ReadAllByMetaCrawlerFailure, ReadAllByMetaCrawlerFailure,
ActionType, ActionType,
} from './meta-crawler-input-item.action'; } from './meta-crawler-input-item.action';
import { MetaCrawler, MetaCrawlerInputItem } from '@overflow/commons-typescript/model/meta';
@Injectable() @Injectable()
export class Effects { export class Effects {

View File

@ -1,8 +1,7 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Store } from '@ngrx/store'; import { of } from 'rxjs';
import { Effect, Actions, ofType } from '@ngrx/effects'; import { Effect, Actions, ofType } from '@ngrx/effects';
import { of, Observable } from 'rxjs'; import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
import { catchError, exhaustMap, map, tap, withLatestFrom } from 'rxjs/operators';
import { MetaCrawler } from '@overflow/commons-typescript/model/meta'; import { MetaCrawler } from '@overflow/commons-typescript/model/meta';
@ -24,28 +23,21 @@ export class Effects {
constructor( constructor(
private actions$: Actions, private actions$: Actions,
private store$: Store<any>,
private metaCrawlerService: MetaCrawlerService, private metaCrawlerService: MetaCrawlerService,
) { } ) { }
@Effect() @Effect()
readAll$ = this.actions$.pipe( readAll$ = this.actions$.pipe(
ofType(ActionType.ReadAll), ofType(ActionType.ReadAll),
withLatestFrom(this.store$.select(MetaCrawlerEntitySelector.selectAll)), exhaustMap(() =>
exhaustMap(([action, results]) => { this.metaCrawlerService
if (0 < results.length) {
return of(new ReadAllSuccess(results));
}
return this.metaCrawlerService
.readAll() .readAll()
.pipe( .pipe(
map((result: MetaCrawler[]) => { map((result: MetaCrawler[]) => {
return new ReadAllSuccess(result); return new ReadAllSuccess(result);
}), }),
catchError(error => of(new ReadAllFailure(error))) catchError(error => of(new ReadAllFailure(error)))
); )
}
) )
); );
} }

View File

@ -3,6 +3,8 @@ import { Effect, Actions, ofType } from '@ngrx/effects';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { catchError, exhaustMap, map, tap } from 'rxjs/operators'; import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
import { MetaHistoryType } from '@overflow/commons-typescript/model/meta';
import { MetaHistoryTypeService } from '../../../service/meta-history-type.service'; import { MetaHistoryTypeService } from '../../../service/meta-history-type.service';
import { import {
@ -11,7 +13,6 @@ import {
ReadAllFailure, ReadAllFailure,
ActionType, ActionType,
} from './meta-history-type.action'; } from './meta-history-type.action';
import { MetaHistoryType } from '@overflow/commons-typescript/model/meta';
@Injectable() @Injectable()
export class Effects { export class Effects {

View File

@ -3,6 +3,8 @@ import { Effect, Actions, ofType } from '@ngrx/effects';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { catchError, exhaustMap, map, tap } from 'rxjs/operators'; import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
import { MetaInfraType } from '@overflow/commons-typescript/model/meta';
import { MetaInfraTypeService } from '../../../service/meta-infra-type.service'; import { MetaInfraTypeService } from '../../../service/meta-infra-type.service';
import { import {
@ -11,7 +13,6 @@ import {
ReadAllFailure, ReadAllFailure,
ActionType, ActionType,
} from './meta-infra-type.action'; } from './meta-infra-type.action';
import { MetaInfraType } from '@overflow/commons-typescript/model/meta';
@Injectable() @Injectable()
export class Effects { export class Effects {

View File

@ -3,6 +3,8 @@ import { Effect, Actions, ofType } from '@ngrx/effects';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { catchError, exhaustMap, map, tap } from 'rxjs/operators'; import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
import { MetaInfraVendor, MetaInfraType } from '@overflow/commons-typescript/model/meta';
import { MetaInfraVendorService } from '../../../service/meta-infra-vendor.service'; import { MetaInfraVendorService } from '../../../service/meta-infra-vendor.service';
import { import {
@ -11,7 +13,6 @@ import {
ReadAllByMetaInfraTypeFailure, ReadAllByMetaInfraTypeFailure,
ActionType, ActionType,
} from './meta-infra-vendor.action'; } from './meta-infra-vendor.action';
import { MetaInfraVendor, MetaInfraType } from '@overflow/commons-typescript/model/meta';
@Injectable() @Injectable()
export class Effects { export class Effects {

View File

@ -3,6 +3,8 @@ import { Effect, Actions, ofType } from '@ngrx/effects';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { catchError, exhaustMap, map, tap } from 'rxjs/operators'; import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
import { MetaInputType } from '@overflow/commons-typescript/model/meta';
import { MetaInputTypeService } from '../../../service/meta-input-type.service'; import { MetaInputTypeService } from '../../../service/meta-input-type.service';
import { import {
@ -11,7 +13,6 @@ import {
ReadAllFailure, ReadAllFailure,
ActionType, ActionType,
} from './meta-input-type.action'; } from './meta-input-type.action';
import { MetaInputType } from '@overflow/commons-typescript/model/meta';
@Injectable() @Injectable()
export class Effects { export class Effects {

View File

@ -3,6 +3,8 @@ import { Effect, Actions, ofType } from '@ngrx/effects';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { catchError, exhaustMap, map, tap } from 'rxjs/operators'; import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
import { MetaMemberStatus } from '@overflow/commons-typescript/model/meta';
import { MetaMemberStatusService } from '../../../service/meta-member-status.service'; import { MetaMemberStatusService } from '../../../service/meta-member-status.service';
import { import {
@ -11,7 +13,6 @@ import {
ReadAllFailure, ReadAllFailure,
ActionType, ActionType,
} from './meta-member-status.action'; } from './meta-member-status.action';
import { MetaMemberStatus } from '@overflow/commons-typescript/model/meta';
@Injectable() @Injectable()
export class Effects { export class Effects {

View File

@ -3,6 +3,8 @@ import { Effect, Actions, ofType } from '@ngrx/effects';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { catchError, exhaustMap, map, tap } from 'rxjs/operators'; import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
import { MetaNoAuthProbeStatus } from '@overflow/commons-typescript/model/meta';
import { MetaNoAuthProbeStatusService } from '../../../service/meta-noauth-probe-status.service'; import { MetaNoAuthProbeStatusService } from '../../../service/meta-noauth-probe-status.service';
import { import {
@ -11,7 +13,6 @@ import {
ReadAllFailure, ReadAllFailure,
ActionType, ActionType,
} from './meta-noauth-probe-status.action'; } from './meta-noauth-probe-status.action';
import { MetaNoAuthProbeStatus } from '@overflow/commons-typescript/model/meta';
@Injectable() @Injectable()
export class Effects { export class Effects {

View File

@ -3,6 +3,8 @@ import { Effect, Actions, ofType } from '@ngrx/effects';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { catchError, exhaustMap, map, tap } from 'rxjs/operators'; import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
import { MetaProbeArchitecture } from '@overflow/commons-typescript/model/meta';
import { MetaProbeArchitectureService } from '../../../service/meta-probe-architecture.service'; import { MetaProbeArchitectureService } from '../../../service/meta-probe-architecture.service';
import { import {
@ -11,7 +13,6 @@ import {
ReadAllFailure, ReadAllFailure,
ActionType, ActionType,
} from './meta-probe-architecture.action'; } from './meta-probe-architecture.action';
import { MetaProbeArchitecture } from '@overflow/commons-typescript/model/meta';
@Injectable() @Injectable()
export class Effects { export class Effects {

View File

@ -3,6 +3,8 @@ import { Effect, Actions, ofType } from '@ngrx/effects';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { catchError, exhaustMap, map, tap } from 'rxjs/operators'; import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
import { MetaProbeOs } from '@overflow/commons-typescript/model/meta';
import { MetaProbeOsService } from '../../../service/meta-probe-os.service'; import { MetaProbeOsService } from '../../../service/meta-probe-os.service';
import { import {
@ -11,7 +13,6 @@ import {
ReadAllFailure, ReadAllFailure,
ActionType, ActionType,
} from './meta-probe-os.action'; } from './meta-probe-os.action';
import { MetaProbeOs } from '@overflow/commons-typescript/model/meta';
@Injectable() @Injectable()
export class Effects { export class Effects {

View File

@ -3,6 +3,8 @@ import { Effect, Actions, ofType } from '@ngrx/effects';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { catchError, exhaustMap, map, tap } from 'rxjs/operators'; import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
import { MetaProbePackage, MetaProbeOs } from '@overflow/commons-typescript/model/meta';
import { MetaProbePackageService } from '../../../service/meta-probe-package.service'; import { MetaProbePackageService } from '../../../service/meta-probe-package.service';
import { import {
@ -11,7 +13,6 @@ import {
ReadAllByOsFailure, ReadAllByOsFailure,
ActionType, ActionType,
} from './meta-probe-package.action'; } from './meta-probe-package.action';
import { MetaProbePackage, MetaProbeOs } from '@overflow/commons-typescript/model/meta';
@Injectable() @Injectable()
export class Effects { export class Effects {

View File

@ -3,6 +3,8 @@ import { Effect, Actions, ofType } from '@ngrx/effects';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { catchError, exhaustMap, map, tap } from 'rxjs/operators'; import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
import { MetaProbeStatus } from '@overflow/commons-typescript/model/meta';
import { MetaProbeStatusService } from '../../../service/meta-probe-status.service'; import { MetaProbeStatusService } from '../../../service/meta-probe-status.service';
import { import {
@ -11,7 +13,6 @@ import {
ReadAllFailure, ReadAllFailure,
ActionType, ActionType,
} from './meta-probe-status.action'; } from './meta-probe-status.action';
import { MetaProbeStatus } from '@overflow/commons-typescript/model/meta';
@Injectable() @Injectable()
export class Effects { export class Effects {

View File

@ -3,6 +3,8 @@ import { Effect, Actions, ofType } from '@ngrx/effects';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { catchError, exhaustMap, map, tap } from 'rxjs/operators'; import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
import { MetaProbeTaskType } from '@overflow/commons-typescript/model/meta';
import { MetaProbeTaskTypeService } from '../../../service/meta-probe-task-type.service'; import { MetaProbeTaskTypeService } from '../../../service/meta-probe-task-type.service';
import { import {
@ -11,7 +13,6 @@ import {
ReadAllFailure, ReadAllFailure,
ActionType, ActionType,
} from './meta-probe-task-type.action'; } from './meta-probe-task-type.action';
import { MetaProbeTaskType } from '@overflow/commons-typescript/model/meta';
@Injectable() @Injectable()
export class Effects { export class Effects {

View File

@ -3,6 +3,8 @@ import { Effect, Actions, ofType } from '@ngrx/effects';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { catchError, exhaustMap, map, tap } from 'rxjs/operators'; import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
import { MetaProbeVersion } from '@overflow/commons-typescript/model/meta';
import { MetaProbeVersionService } from '../../../service/meta-probe-version.service'; import { MetaProbeVersionService } from '../../../service/meta-probe-version.service';
import { import {
@ -11,7 +13,6 @@ import {
ReadAllFailure, ReadAllFailure,
ActionType, ActionType,
} from './meta-probe-version.action'; } from './meta-probe-version.action';
import { MetaProbeVersion } from '@overflow/commons-typescript/model/meta';
@Injectable() @Injectable()
export class Effects { export class Effects {

View File

@ -3,6 +3,8 @@ import { Effect, Actions, ofType } from '@ngrx/effects';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { catchError, exhaustMap, map, tap } from 'rxjs/operators'; import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
import { MetaSensorDisplayItem, MetaCrawler } from '@overflow/commons-typescript/model/meta';
import { MetaSensorDisplayItemService } from '../../../service/meta-sensor-display-item.service'; import { MetaSensorDisplayItemService } from '../../../service/meta-sensor-display-item.service';
import { import {
@ -11,7 +13,6 @@ import {
ReadAllByCrawlerFailure, ReadAllByCrawlerFailure,
ActionType, ActionType,
} from './meta-sensor-display-item.action'; } from './meta-sensor-display-item.action';
import { MetaSensorDisplayItem, MetaCrawler } from '@overflow/commons-typescript/model/meta';
@Injectable() @Injectable()
export class Effects { export class Effects {

View File

@ -3,6 +3,8 @@ import { Effect, Actions, ofType } from '@ngrx/effects';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { catchError, exhaustMap, map, tap } from 'rxjs/operators'; import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
import { MetaSensorDisplayMapping, MetaSensorDisplayItem, MetaSensorItemKey } from '@overflow/commons-typescript/model/meta';
import { MetaSensorDisplayMappingService } from '../../../service/meta-sensor-display-mapping.service'; import { MetaSensorDisplayMappingService } from '../../../service/meta-sensor-display-mapping.service';
import { import {
@ -11,7 +13,6 @@ import {
ReadAllMetaSensorItemKeyByDisplayItemFailure, ReadAllMetaSensorItemKeyByDisplayItemFailure,
ActionType, ActionType,
} from './meta-sensor-display-mapping.action'; } from './meta-sensor-display-mapping.action';
import { MetaSensorDisplayMapping, MetaSensorDisplayItem, MetaSensorItemKey } from '@overflow/commons-typescript/model/meta';
@Injectable() @Injectable()
export class Effects { export class Effects {

View File

@ -3,6 +3,8 @@ import { Effect, Actions, ofType } from '@ngrx/effects';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { catchError, exhaustMap, map, tap } from 'rxjs/operators'; import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
import { MetaSensorItemKey, MetaCrawler } from '@overflow/commons-typescript/model/meta';
import { MetaSensorItemKeyService } from '../../../service/meta-sensor-item-key.service'; import { MetaSensorItemKeyService } from '../../../service/meta-sensor-item-key.service';
import { import {
@ -16,7 +18,6 @@ import {
ActionType, ActionType,
} from './meta-sensor-item-key.action'; } from './meta-sensor-item-key.action';
import { MetaSensorItemKey, MetaCrawler } from '@overflow/commons-typescript/model/meta';
@Injectable() @Injectable()
export class Effects { export class Effects {

View File

@ -3,6 +3,8 @@ import { Effect, Actions, ofType } from '@ngrx/effects';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { catchError, exhaustMap, map, tap } from 'rxjs/operators'; import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
import { MetaSensorItemType } from '@overflow/commons-typescript/model/meta';
import { MetaSensorItemTypeService } from '../../../service/meta-sensor-item-type.service'; import { MetaSensorItemTypeService } from '../../../service/meta-sensor-item-type.service';
import { import {
@ -11,7 +13,6 @@ import {
ReadAllFailure, ReadAllFailure,
ActionType, ActionType,
} from './meta-sensor-item-type.action'; } from './meta-sensor-item-type.action';
import { MetaSensorItemType } from '@overflow/commons-typescript/model/meta';
@Injectable() @Injectable()
export class Effects { export class Effects {

View File

@ -3,6 +3,8 @@ import { Effect, Actions, ofType } from '@ngrx/effects';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { catchError, exhaustMap, map, tap } from 'rxjs/operators'; import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
import { MetaSensorItemUnit } from '@overflow/commons-typescript/model/meta';
import { MetaSensorItemUnitService } from '../../../service/meta-sensor-item-unit.service'; import { MetaSensorItemUnitService } from '../../../service/meta-sensor-item-unit.service';
import { import {
@ -11,7 +13,6 @@ import {
ReadAllFailure, ReadAllFailure,
ActionType, ActionType,
} from './meta-sensor-item-unit.action'; } from './meta-sensor-item-unit.action';
import { MetaSensorItemUnit } from '@overflow/commons-typescript/model/meta';
@Injectable() @Injectable()
export class Effects { export class Effects {

View File

@ -3,6 +3,8 @@ import { Effect, Actions, ofType } from '@ngrx/effects';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { catchError, exhaustMap, map, tap } from 'rxjs/operators'; import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
import { MetaSensorItem } from '@overflow/commons-typescript/model/meta';
import { MetaSensorItemService } from '../../../service/meta-sensor-item.service'; import { MetaSensorItemService } from '../../../service/meta-sensor-item.service';
import { import {
@ -11,7 +13,6 @@ import {
ReadAllFailure, ReadAllFailure,
ActionType, ActionType,
} from './meta-sensor-item.action'; } from './meta-sensor-item.action';
import { MetaSensorItem } from '@overflow/commons-typescript/model/meta';
@Injectable() @Injectable()
export class Effects { export class Effects {

View File

@ -3,6 +3,8 @@ import { Effect, Actions, ofType } from '@ngrx/effects';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { catchError, exhaustMap, map, tap } from 'rxjs/operators'; import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
import { MetaSensorStatus } from '@overflow/commons-typescript/model/meta';
import { MetaSensorStatusService } from '../../../service/meta-sensor-status.service'; import { MetaSensorStatusService } from '../../../service/meta-sensor-status.service';
import { import {
@ -11,7 +13,6 @@ import {
ReadAllFailure, ReadAllFailure,
ActionType, ActionType,
} from './meta-sensor-status.action'; } from './meta-sensor-status.action';
import { MetaSensorStatus } from '@overflow/commons-typescript/model/meta';
@Injectable() @Injectable()
export class Effects { export class Effects {

View File

@ -3,6 +3,8 @@ import { Effect, Actions, ofType } from '@ngrx/effects';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { catchError, exhaustMap, map, tap } from 'rxjs/operators'; import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
import { MetaVendorCrawlerSensorItem } from '@overflow/commons-typescript/model/meta';
import { MetaVendorCrawlerSensorItemService } from '../../../service/meta-vendor-crawler-sensor-item.service'; import { MetaVendorCrawlerSensorItemService } from '../../../service/meta-vendor-crawler-sensor-item.service';
import { import {
@ -11,7 +13,6 @@ import {
ReadAllFailure, ReadAllFailure,
ActionType, ActionType,
} from './meta-vendor-crawler-sensor-item.action'; } from './meta-vendor-crawler-sensor-item.action';
import { MetaVendorCrawlerSensorItem } from '@overflow/commons-typescript/model/meta';
@Injectable() @Injectable()
export class Effects { export class Effects {

View File

@ -3,6 +3,8 @@ import { Effect, Actions, ofType } from '@ngrx/effects';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { catchError, exhaustMap, map, tap } from 'rxjs/operators'; import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
import { MetaVendorCrawler, MetaInfraVendor } from '@overflow/commons-typescript/model/meta';
import { MetaVendorCrawlerService } from '../../../service/meta-vendor-crawler.service'; import { MetaVendorCrawlerService } from '../../../service/meta-vendor-crawler.service';
import { import {
@ -11,7 +13,6 @@ import {
ReadAllByInfraVendorFailure, ReadAllByInfraVendorFailure,
ActionType, ActionType,
} from './meta-vendor-crawler.action'; } from './meta-vendor-crawler.action';
import { MetaVendorCrawler, MetaInfraVendor } from '@overflow/commons-typescript/model/meta';
@Injectable() @Injectable()
export class Effects { export class Effects {