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 | 26x 26x 26x 26x 26x 26x 26x 26x 26x 26x 26x 26x 26x 9x 26x 7x 7x 7x 7x 1x 1x 7x 6x 14x 3x 3x 14x 9x 7x | import { createSelector, createSelectorFactory, resultMemoize } from '@ngrx/store'; import { isEqual } from 'lodash-es'; import { BreadcrumbItem } from 'ish-core/models/breadcrumb-item/breadcrumb-item.interface'; import { createContentPageTreeView } from 'ish-core/models/content-page-tree-view/content-page-tree-view.model'; import { ContentPageTree } from 'ish-core/models/content-page-tree/content-page-tree.model'; import { ContentPageletEntryPointView, createContentPageletEntryPointView, } from 'ish-core/models/content-view/content-view.model'; import { generateContentPageUrl } from 'ish-core/routing/content-page/content-page.route'; import { getContentState } from 'ish-core/store/content/content-store'; import { getPageTree } from 'ish-core/store/content/page-tree'; import { selectRouteParam } from 'ish-core/store/core/router'; import { pagesAdapter } from './pages.reducer'; const getPagesState = createSelector(getContentState, state => state.pages); const { selectEntities: getPageEntities } = pagesAdapter.getSelectors(getPagesState); export const getContentPageLoading = createSelector(getPagesState, state => state.loading); export const getSelectedContentPage = createSelector(getPageEntities, selectRouteParam('contentPageId'), (pages, id) => createContentPageletEntryPointView(pages[id]) ); export const getBreadcrumbForContentPage = (rootId: string) => createSelectorFactory<object, BreadcrumbItem[]>(projector => resultMemoize(projector, isEqual))( getSelectedContentPage, getPageTree, (contentPage: ContentPageletEntryPointView, pagetree: ContentPageTree) => { // set default breadcrumb data: just the selected content page name let breadcrumbData = [{ key: contentPage?.displayName }] as BreadcrumbItem[]; // initialize root flag (no root yet) let gotRoot = false; // if 'COMPLETE' is used as rootId the complete available page path is returned as breadcrumb data // (in case we have no explicit root information but the full path is wanted) if (rootId === 'COMPLETE') { gotRoot = true; breadcrumbData = []; } // determine if pagetree information is available for the selected content page if (pagetree.nodes[contentPage?.id]) { pagetree.nodes[contentPage.id].path.forEach((item, i, path) => { // check if we are at the wanted path element for the root if (item === rootId) { gotRoot = true; breadcrumbData = []; } // push breadcrumb data once we have a root if (gotRoot) { breadcrumbData.push({ key: pagetree.nodes[item].name, link: i !== path.length - 1 ? generateContentPageUrl(createContentPageTreeView(pagetree, item, item)) : undefined, }); } }); } return breadcrumbData; } ); |