DM-516: Fixed breadcrumbs
This commit is contained in:
parent
aa383781f9
commit
4c9a6651bc
@ -1,6 +1,6 @@
|
||||
<section>
|
||||
<iqser-page-header [buttonConfigs]="buttonConfigs" [helpModeKey]="'dossier'">
|
||||
<ng-container slot="beforeFilters">
|
||||
<ng-container *ngIf="isArchiveEnabled" slot="beforeFilters">
|
||||
<redaction-dossiers-type-switch></redaction-dossiers-type-switch>
|
||||
</ng-container>
|
||||
</iqser-page-header>
|
||||
@ -12,6 +12,7 @@
|
||||
<iqser-table
|
||||
(noDataAction)="openAddDossierDialog()"
|
||||
[hasScrollButton]="true"
|
||||
[headerHelpModeKey]="'dossier_list'"
|
||||
[helpModeKey]="'dossier'"
|
||||
[itemSize]="85"
|
||||
[noDataButtonLabel]="'dossier-listing.no-data.action' | translate"
|
||||
@ -19,7 +20,6 @@
|
||||
[noMatchText]="'dossier-listing.no-match.title' | translate"
|
||||
[showNoDataButton]="permissionsService.canCreateDossier(dossierTemplate)"
|
||||
[tableColumnConfigs]="tableColumnConfigs"
|
||||
[headerHelpModeKey]="'dossier_list'"
|
||||
noDataIcon="red:folder"
|
||||
></iqser-table>
|
||||
</div>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { ChangeDetectionStrategy, Component, OnInit, TemplateRef, ViewChild } from '@angular/core';
|
||||
import { Dossier, DOSSIER_TEMPLATE_ID, DossierTemplate } from '@red/domain';
|
||||
import { Dossier, DOSSIER_TEMPLATE_ID, DOSSIERS_ARCHIVE, DossierTemplate } from '@red/domain';
|
||||
import { PermissionsService } from '@services/permissions.service';
|
||||
import { ButtonConfig, ListingComponent, listingProvidersFactory, LoadingService, TableComponent } from '@iqser/common-ui';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
@ -11,6 +11,7 @@ import { UserPreferenceService } from '@users/user-preference.service';
|
||||
import { SharedDialogService } from '@shared/services/dialog.service';
|
||||
import { DossierTemplatesService } from '@services/dossier-templates/dossier-templates.service';
|
||||
import { OnAttach } from '@iqser/common-ui/lib/utils';
|
||||
import { FeaturesService } from '@services/features.service';
|
||||
|
||||
@Component({
|
||||
templateUrl: './dossiers-listing-screen.component.html',
|
||||
@ -19,27 +20,29 @@ import { OnAttach } from '@iqser/common-ui/lib/utils';
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class DossiersListingScreenComponent extends ListingComponent<Dossier> implements OnInit, OnAttach {
|
||||
readonly tableColumnConfigs = this._configService.tableConfig;
|
||||
readonly tableHeaderLabel = _('dossier-listing.table-header.title');
|
||||
readonly buttonConfigs: ButtonConfig[];
|
||||
readonly dossierTemplate: DossierTemplate;
|
||||
readonly computeFilters$ = this._activeDossiersService.all$.pipe(tap(() => this._computeAllFilters()));
|
||||
readonly isArchiveEnabled = this._featuresService.isEnabled(DOSSIERS_ARCHIVE);
|
||||
@ViewChild('needsWorkFilterTemplate', {
|
||||
read: TemplateRef,
|
||||
static: true,
|
||||
})
|
||||
private readonly _needsWorkFilterTemplate: TemplateRef<unknown>;
|
||||
@ViewChild(TableComponent) private readonly _tableComponent: TableComponent<Dossier>;
|
||||
readonly tableColumnConfigs = this._configService.tableConfig;
|
||||
readonly tableHeaderLabel = _('dossier-listing.table-header.title');
|
||||
readonly buttonConfigs: ButtonConfig[];
|
||||
readonly dossierTemplate: DossierTemplate;
|
||||
readonly computeFilters$ = this._activeDossiersService.all$.pipe(tap(() => this._computeAllFilters()));
|
||||
|
||||
constructor(
|
||||
router: Router,
|
||||
readonly router: Router,
|
||||
private readonly _configService: ConfigService,
|
||||
readonly permissionsService: PermissionsService,
|
||||
private readonly _dialogService: SharedDialogService,
|
||||
private readonly _activeDossiersService: ActiveDossiersService,
|
||||
private readonly _userPreferenceService: UserPreferenceService,
|
||||
private readonly _loadingService: LoadingService,
|
||||
dossierTemplatesService: DossierTemplatesService,
|
||||
readonly dossierTemplatesService: DossierTemplatesService,
|
||||
private readonly _featuresService: FeaturesService,
|
||||
) {
|
||||
super();
|
||||
const dossierTemplateId = router.routerState.snapshot.root.firstChild.firstChild.paramMap.get(DOSSIER_TEMPLATE_ID);
|
||||
|
||||
@ -5,10 +5,9 @@ import { BehaviorSubject, Observable, of } from 'rxjs';
|
||||
import { filter, pluck } from 'rxjs/operators';
|
||||
import { FilesMapService } from './files/files-map.service';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { BreadcrumbTypes, DOSSIER_ID, DOSSIER_TEMPLATE_ID, DOSSIERS_ARCHIVE, FILE_ID } from '@red/domain';
|
||||
import { BreadcrumbTypes, DOSSIER_ID, DOSSIER_TEMPLATE_ID, FILE_ID } from '@red/domain';
|
||||
import { DossiersService } from './dossiers/dossiers.service';
|
||||
import { dossiersServiceResolver } from './entity-services/dossiers.service.provider';
|
||||
import { FeaturesService } from './features.service';
|
||||
import { DashboardStatsService } from './dossier-templates/dashboard-stats.service';
|
||||
|
||||
export type RouterLinkActiveOptions = { exact: boolean } | IsActiveMatchOptions;
|
||||
@ -32,25 +31,8 @@ export type Breadcrumbs = List<Breadcrumb>;
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class BreadcrumbsService {
|
||||
readonly #store$ = new BehaviorSubject<Breadcrumbs>([]);
|
||||
readonly breadcrumbs$: Observable<Breadcrumbs>;
|
||||
|
||||
constructor(
|
||||
private readonly _injector: Injector,
|
||||
private readonly _router: Router,
|
||||
private readonly _translateService: TranslateService,
|
||||
private readonly _filesMapService: FilesMapService,
|
||||
private readonly _dashboardStatsService: DashboardStatsService,
|
||||
private readonly _featuresService: FeaturesService,
|
||||
) {
|
||||
this.breadcrumbs$ = this.#store$.asObservable();
|
||||
|
||||
_router.events.pipe(filter(event => event instanceof NavigationEnd)).subscribe(() => {
|
||||
const root = _router.routerState.snapshot.root;
|
||||
this._clear();
|
||||
this._addBreadcrumbs(root);
|
||||
});
|
||||
}
|
||||
readonly #store$ = new BehaviorSubject<Breadcrumbs>([]);
|
||||
|
||||
get breadcrumbs() {
|
||||
return this.#store$.value;
|
||||
@ -71,6 +53,22 @@ export class BreadcrumbsService {
|
||||
};
|
||||
}
|
||||
|
||||
constructor(
|
||||
private readonly _injector: Injector,
|
||||
private readonly _router: Router,
|
||||
private readonly _translateService: TranslateService,
|
||||
private readonly _filesMapService: FilesMapService,
|
||||
private readonly _dashboardStatsService: DashboardStatsService,
|
||||
) {
|
||||
this.breadcrumbs$ = this.#store$.asObservable();
|
||||
|
||||
_router.events.pipe(filter(event => event instanceof NavigationEnd)).subscribe(() => {
|
||||
const root = _router.routerState.snapshot.root;
|
||||
this._clear();
|
||||
this._addBreadcrumbs(root);
|
||||
});
|
||||
}
|
||||
|
||||
private _append(breadcrumb: Breadcrumb) {
|
||||
this.#store$.next([...this.#store$.value, breadcrumb]);
|
||||
}
|
||||
@ -87,7 +85,7 @@ export class BreadcrumbsService {
|
||||
|
||||
const breadcrumbs = route.data.breadcrumbs || [];
|
||||
|
||||
if (breadcrumbs.length === 1 && this._featuresService.isEnabled(DOSSIERS_ARCHIVE)) {
|
||||
if (breadcrumbs.length === 1) {
|
||||
if (breadcrumbs[0] === BreadcrumbTypes.dossierTemplate) {
|
||||
this._addDossierTemplateDropdown(params);
|
||||
return;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user