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 | 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 3x 6x 6x 3x 1x 6x 6x 3x 2x | import { Injectable } from "@angular/core"
import { MatDialog } from "@angular/material/dialog"
import { Actions, createEffect, ofType } from "@ngrx/effects"
import { filter, map, share, tap, withLatestFrom } from "rxjs"
import { addBlacklistItems, addBlacklistItemsIfNotResultsInEmptyMap } from "../../store/fileSettings/blacklist/blacklist.actions"
import { visibleFileStatesSelector } from "../../selectors/visibleFileStates/visibleFileStates.selector"
import { blacklistSelector } from "../../store/fileSettings/blacklist/blacklist.selector"
import { resultsInEmptyMap } from "./resultsInEmptyMap"
import { ErrorDialogComponent } from "../../../ui/dialogs/errorDialog/errorDialog.component"
import { Store } from "@ngrx/store"
import { CcState } from "../../../codeCharta.model"
@Injectable()
export class AddBlacklistItemsIfNotResultsInEmptyMapEffect {
constructor(
private actions$: Actions,
private store: Store<CcState>,
private dialog: MatDialog
) {}
doBlacklistItemsResultInEmptyMap$ = this.actions$.pipe(
ofType(addBlacklistItemsIfNotResultsInEmptyMap),
withLatestFrom(this.store.select(visibleFileStatesSelector), this.store.select(blacklistSelector)),
map(([action, visibleFiles, blacklist]) => ({
items: action.items,
resultsInEmptyMap: resultsInEmptyMap(visibleFiles, blacklist, action.items)
})),
share()
)
showErrorDialogIfBlacklistItemsResultInEmptyMap$ = createEffect(
() =>
this.doBlacklistItemsResultInEmptyMap$.pipe(
filter(event => event.resultsInEmptyMap),
tap(() => {
this.dialog.open(ErrorDialogComponent, {
data: { title: "Blacklist Error", message: "Excluding all buildings is not possible." }
})
})
),
{ dispatch: false }
)
addBlacklistItems$ = createEffect(() =>
this.doBlacklistItemsResultInEmptyMap$.pipe(
filter(event => !event.resultsInEmptyMap),
map(event => addBlacklistItems({ items: event.items }))
)
)
}
|