Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 3x 5x 5x 2x 1x 1x 5x 5x 3x 2x 2x 2x 2x | import { Injectable } from "@angular/core" import { Actions, createEffect, ofType } from "@ngrx/effects" import { Store } from "@ngrx/store" import { map, filter, withLatestFrom, tap, take, share } from "rxjs" import { BlacklistType, CcState } from "../../../../codeCharta.model" import { AddBlacklistItemsIfNotResultsInEmptyMapEffect } from "../../../../state/effects/addBlacklistItemsIfNotResultsInEmptyMap/addBlacklistItemsIfNotResultsInEmptyMap.effect" import { setSearchPattern } from "../../../../state/store/dynamicSettings/searchPattern/searchPattern.actions" import { searchPatternSelector } from "../../../../state/store/dynamicSettings/searchPattern/searchPattern.selector" import { addBlacklistItems, addBlacklistItemsIfNotResultsInEmptyMap } from "../../../../state/store/fileSettings/blacklist/blacklist.actions" import { parseBlacklistItems } from "./utils/parseBlacklistItems" type BlacklistSearchPatternAction = { type: "BlacklistSearchPatternAction" action: { type: BlacklistType } } export const blacklistSearchPattern = (type: BlacklistType): BlacklistSearchPatternAction => ({ type: "BlacklistSearchPatternAction", action: { type } }) @Injectable() export class BlacklistSearchPatternEffect { constructor( private actions$: Actions, private store: Store<CcState>, private addBlacklistItemsIfNotResultsInEmptyMapEffect: AddBlacklistItemsIfNotResultsInEmptyMapEffect ) {} private searchPattern2BlacklistItems$ = this.actions$.pipe( ofType<BlacklistSearchPatternAction>("BlacklistSearchPatternAction"), withLatestFrom(this.store.select(searchPatternSelector)), map(([blacklistSearchPatternAction, searchPattern]) => ({ type: blacklistSearchPatternAction.action.type, blacklistItems: parseBlacklistItems(blacklistSearchPatternAction.action.type, searchPattern) })), share() ) flattenSearchPattern$ = createEffect( () => this.searchPattern2BlacklistItems$.pipe( filter(searchPattern2BlacklistItems => searchPattern2BlacklistItems.type === "flatten"), tap(searchPattern2BlacklistItems => { this.store.dispatch(addBlacklistItems({ items: searchPattern2BlacklistItems.blacklistItems })) this.store.dispatch(setSearchPattern({ value: "" })) }) ), { dispatch: false } ) excludeSearchPattern$ = createEffect(() => this.searchPattern2BlacklistItems$.pipe( filter(searchPattern2BlacklistItems => searchPattern2BlacklistItems.type === "exclude"), tap(() => { this.addBlacklistItemsIfNotResultsInEmptyMapEffect.doBlacklistItemsResultInEmptyMap$ .pipe( take(1), filter(doBlacklistItemsResultInEmptyMap => !doBlacklistItemsResultInEmptyMap.resultsInEmptyMap), tap(() => { this.store.dispatch(setSearchPattern({ value: "" })) }) ) .subscribe() }), map(searchPattern2BlacklistItems => addBlacklistItemsIfNotResultsInEmptyMap({ items: searchPattern2BlacklistItems.blacklistItems }) ) ) ) } |