RED-7200, rewrite loading service with signals, specifically call stop when needed, remove catch all stop from composite guard postcheck. Update common-ui.
This commit is contained in:
parent
9a20b6dbce
commit
990c52ad6d
@ -1,8 +1,8 @@
|
||||
import { ChangeDetectionStrategy, ChangeDetectorRef, Component } from '@angular/core';
|
||||
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit } from '@angular/core';
|
||||
import { PreferencesKeys, UserPreferenceService } from '@users/user-preference.service';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { BaseFormComponent, IqserPermissionsService } from '@iqser/common-ui';
|
||||
import { BaseFormComponent, IqserPermissionsService, LoadingService } from '@iqser/common-ui';
|
||||
import { Roles } from '@users/roles';
|
||||
import { AsControl } from '@iqser/common-ui/lib/utils';
|
||||
|
||||
@ -31,7 +31,7 @@ const Screens = {
|
||||
styleUrls: ['./preferences.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class PreferencesComponent extends BaseFormComponent {
|
||||
export class PreferencesComponent extends BaseFormComponent implements OnInit {
|
||||
readonly form: FormGroup<AsControl<PreferencesForm>>;
|
||||
readonly currentScreen: Screen;
|
||||
readonly screens = Screens;
|
||||
@ -44,6 +44,7 @@ export class PreferencesComponent extends BaseFormComponent {
|
||||
private readonly _permissionsService: IqserPermissionsService,
|
||||
private readonly _route: ActivatedRoute,
|
||||
private readonly _changeRef: ChangeDetectorRef,
|
||||
private readonly _loadingService: LoadingService,
|
||||
) {
|
||||
super();
|
||||
this.form = this._formBuilder.group({
|
||||
@ -66,6 +67,10 @@ export class PreferencesComponent extends BaseFormComponent {
|
||||
this.currentScreen = _route.snapshot.data.screen;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this._loadingService.stop();
|
||||
}
|
||||
|
||||
async save(): Promise<any> {
|
||||
if (this.form.controls.autoExpandFiltersOnActions.value !== this.userPreferenceService.getAutoExpandFiltersOnActions()) {
|
||||
await this.userPreferenceService.toggleAutoExpandFiltersOnActions();
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
||||
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
|
||||
import { DOSSIER_TEMPLATE_ID, ENTITY_TYPE } from '@red/domain';
|
||||
import { Router } from '@angular/router';
|
||||
import { firstValueFrom, Observable } from 'rxjs';
|
||||
@ -16,7 +16,7 @@ import { TenantsService } from '@iqser/common-ui/lib/tenants';
|
||||
templateUrl: './base-entity-screen.component.html',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class BaseEntityScreenComponent {
|
||||
export class BaseEntityScreenComponent implements OnInit {
|
||||
readonly #dossierTemplateId = getParam(DOSSIER_TEMPLATE_ID);
|
||||
readonly #entityType = getParam(ENTITY_TYPE);
|
||||
readonly disabledItems$: Observable<string[]>;
|
||||
@ -39,6 +39,10 @@ export class BaseEntityScreenComponent {
|
||||
);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this._loadingService.stop();
|
||||
}
|
||||
|
||||
openDeleteDictionariesDialog() {
|
||||
this._dialogService.openDialog('confirm', null, async () => {
|
||||
this._loadingService.start();
|
||||
|
||||
@ -1,7 +1,14 @@
|
||||
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
||||
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
|
||||
import { DefaultColorTypes, DOSSIER_TEMPLATE_ID, User } from '@red/domain';
|
||||
import { AdminDialogService } from '../../services/admin-dialog.service';
|
||||
import { CircleButtonTypes, IListable, ListingComponent, listingProvidersFactory, TableColumnConfig } from '@iqser/common-ui';
|
||||
import {
|
||||
CircleButtonTypes,
|
||||
IListable,
|
||||
ListingComponent,
|
||||
listingProvidersFactory,
|
||||
LoadingService,
|
||||
TableColumnConfig,
|
||||
} from '@iqser/common-ui';
|
||||
import { defaultColorsTranslations } from '@translations/default-colors-translations';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { combineLatest } from 'rxjs';
|
||||
@ -22,7 +29,7 @@ interface ListItem extends IListable {
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
providers: listingProvidersFactory(DefaultColorsScreenComponent),
|
||||
})
|
||||
export class DefaultColorsScreenComponent extends ListingComponent<ListItem> {
|
||||
export class DefaultColorsScreenComponent extends ListingComponent<ListItem> implements OnInit {
|
||||
readonly #dossierTemplateId = getParam(DOSSIER_TEMPLATE_ID);
|
||||
readonly circleButtonTypes = CircleButtonTypes;
|
||||
readonly currentUser = getCurrentUser<User>();
|
||||
@ -35,7 +42,11 @@ export class DefaultColorsScreenComponent extends ListingComponent<ListItem> {
|
||||
];
|
||||
readonly context$;
|
||||
|
||||
constructor(private readonly _dialogService: AdminDialogService, private readonly _defaultColorsService: DefaultColorsService) {
|
||||
constructor(
|
||||
private readonly _dialogService: AdminDialogService,
|
||||
private readonly _defaultColorsService: DefaultColorsService,
|
||||
private readonly _loadingService: LoadingService,
|
||||
) {
|
||||
super();
|
||||
|
||||
this.context$ = combineLatest([this._defaultColorsService.all$]).pipe(
|
||||
@ -47,6 +58,10 @@ export class DefaultColorsScreenComponent extends ListingComponent<ListItem> {
|
||||
);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this._loadingService.stop();
|
||||
}
|
||||
|
||||
openEditColorDialog(color: ListItem) {
|
||||
this._dialogService.openDialog('editColor', { colorKey: color.key, dossierTemplateId: this.#dossierTemplateId });
|
||||
}
|
||||
|
||||
@ -1,5 +1,12 @@
|
||||
import { Component, OnDestroy, OnInit } from '@angular/core';
|
||||
import { defaultDialogConfig, IconButtonTypes, ListingComponent, listingProvidersFactory, TableColumnConfig } from '@iqser/common-ui';
|
||||
import {
|
||||
defaultDialogConfig,
|
||||
IconButtonTypes,
|
||||
ListingComponent,
|
||||
listingProvidersFactory,
|
||||
LoadingService,
|
||||
TableColumnConfig,
|
||||
} from '@iqser/common-ui';
|
||||
import { type DonutChartConfig, DOSSIER_TEMPLATE_ID, type DossierState } from '@red/domain';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { firstValueFrom, Observable } from 'rxjs';
|
||||
@ -35,6 +42,7 @@ export class DossierStatesListingScreenComponent extends ListingComponent<Dossie
|
||||
private readonly _dialog: MatDialog,
|
||||
private readonly _dossierStatesMapService: DossierStatesMapService,
|
||||
private readonly _dossierStatesService: DossierStatesService,
|
||||
private readonly _loadingService: LoadingService,
|
||||
readonly permissionsService: PermissionsService,
|
||||
) {
|
||||
super();
|
||||
@ -50,6 +58,7 @@ export class DossierStatesListingScreenComponent extends ListingComponent<Dossie
|
||||
order: SortingOrders.asc,
|
||||
});
|
||||
await firstValueFrom(this._dossierStatesService.loadAllForTemplate(this.#dossierTemplateId));
|
||||
this._loadingService.stop();
|
||||
}
|
||||
|
||||
openAddStateDialog() {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
||||
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
|
||||
import { UserPreferenceService } from '@users/user-preference.service';
|
||||
import { AdminDialogService } from '../../../services/admin-dialog.service';
|
||||
import { DossierTemplate, User } from '@red/domain';
|
||||
@ -27,7 +27,7 @@ import { getCurrentUser } from '@iqser/common-ui/lib/users';
|
||||
component: DossierTemplatesListingScreenComponent,
|
||||
}),
|
||||
})
|
||||
export class DossierTemplatesListingScreenComponent extends ListingComponent<DossierTemplate> {
|
||||
export class DossierTemplatesListingScreenComponent extends ListingComponent<DossierTemplate> implements OnInit {
|
||||
readonly iconButtonTypes = IconButtonTypes;
|
||||
readonly circleButtonTypes = CircleButtonTypes;
|
||||
readonly roles = Roles;
|
||||
@ -54,6 +54,10 @@ export class DossierTemplatesListingScreenComponent extends ListingComponent<Dos
|
||||
super();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this._loadingService.stop();
|
||||
}
|
||||
|
||||
openBulkDeleteTemplatesDialog() {
|
||||
return this._dialogService.openDialog('confirm', null, () => {
|
||||
this._loadingService.loadWhile(this._deleteTemplates());
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import {
|
||||
CircleButtonTypes,
|
||||
IconButtonTypes,
|
||||
@ -23,7 +23,7 @@ import { getParam } from '@iqser/common-ui/lib/utils';
|
||||
styleUrls: ['./entities-listing-screen.component.scss'],
|
||||
providers: listingProvidersFactory(EntitiesListingScreenComponent),
|
||||
})
|
||||
export class EntitiesListingScreenComponent extends ListingComponent<Dictionary> {
|
||||
export class EntitiesListingScreenComponent extends ListingComponent<Dictionary> implements OnInit {
|
||||
readonly #dossierTemplateId = getParam(DOSSIER_TEMPLATE_ID);
|
||||
readonly iconButtonTypes = IconButtonTypes;
|
||||
readonly circleButtonTypes = CircleButtonTypes;
|
||||
@ -48,6 +48,10 @@ export class EntitiesListingScreenComponent extends ListingComponent<Dictionary>
|
||||
this.templateStats$ = this._dossierTemplateStatsService.watch$(this.#dossierTemplateId).pipe(tap(() => this._loadDictionaryData()));
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this._loadingService.stop();
|
||||
}
|
||||
|
||||
openDeleteEntitiesDialog(types = this.listingService.selected) {
|
||||
this._dialogService.openDialog('confirm', null, async () => {
|
||||
this._loadingService.start();
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Component, OnDestroy } from '@angular/core';
|
||||
import { Component, OnDestroy, OnInit } from '@angular/core';
|
||||
import { IqserPermissionsService, ListingComponent, listingProvidersFactory, LoadingService, TableColumnConfig } from '@iqser/common-ui';
|
||||
import { PermissionsMapping, User } from '@red/domain';
|
||||
import { ConfigService } from '../config.service';
|
||||
@ -20,7 +20,7 @@ import { SortingOrders } from '@iqser/common-ui/lib/sorting';
|
||||
styleUrls: ['./permissions-screen.component.scss'],
|
||||
providers: listingProvidersFactory(PermissionsScreenComponent),
|
||||
})
|
||||
export class PermissionsScreenComponent extends ListingComponent<PermissionsMapping> implements OnDestroy {
|
||||
export class PermissionsScreenComponent extends ListingComponent<PermissionsMapping> implements OnInit, OnDestroy {
|
||||
readonly #subscription: Subscription = new Subscription();
|
||||
readonly roles = Roles;
|
||||
readonly currentUser = getCurrentUser<User>();
|
||||
@ -65,6 +65,10 @@ export class PermissionsScreenComponent extends ListingComponent<PermissionsMapp
|
||||
);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this._loadingService.stop();
|
||||
}
|
||||
|
||||
async togglePermission(targetPermission: string, changedPermission: string): Promise<void> {
|
||||
this._loadingService.start();
|
||||
await this._entityPermissionsService.togglePermission(this.targetObject, targetPermission, changedPermission);
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import {
|
||||
CircleButtonTypes,
|
||||
IconButtonTypes,
|
||||
@ -24,7 +24,7 @@ import { getParam } from '@iqser/common-ui/lib/utils';
|
||||
styleUrls: ['./watermarks-listing-screen.component.scss'],
|
||||
providers: listingProvidersFactory(WatermarksListingScreenComponent),
|
||||
})
|
||||
export class WatermarksListingScreenComponent extends ListingComponent<Watermark> {
|
||||
export class WatermarksListingScreenComponent extends ListingComponent<Watermark> implements OnInit {
|
||||
readonly #dossierTemplateId = getParam(DOSSIER_TEMPLATE_ID);
|
||||
readonly iconButtonTypes = IconButtonTypes;
|
||||
readonly circleButtonTypes = CircleButtonTypes;
|
||||
@ -51,6 +51,10 @@ export class WatermarksListingScreenComponent extends ListingComponent<Watermark
|
||||
this.entitiesService.setEntities(this._watermarksMapService.get(this.#dossierTemplateId));
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this._loadingService.stop();
|
||||
}
|
||||
|
||||
async openConfirmDeleteWatermarkDialog(watermark: Watermark) {
|
||||
const isUsed = await this._watermarkService.isWatermarkUsed(watermark.id);
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { ChangeDetectionStrategy, Component, OnInit, TemplateRef, ViewChild } from '@angular/core';
|
||||
import { Dossier, DOSSIER_TEMPLATE_ID, DossierTemplate } from '@red/domain';
|
||||
import { PermissionsService } from '@services/permissions.service';
|
||||
import { ButtonConfig, ListingComponent, listingProvidersFactory, TableComponent } from '@iqser/common-ui';
|
||||
import { ButtonConfig, ListingComponent, listingProvidersFactory, LoadingService, TableComponent } from '@iqser/common-ui';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { ConfigService } from '../config.service';
|
||||
import { ActiveDossiersService } from '@services/dossiers/active-dossiers.service';
|
||||
@ -38,6 +38,7 @@ export class DossiersListingScreenComponent extends ListingComponent<Dossier> im
|
||||
private readonly _dialogService: SharedDialogService,
|
||||
private readonly _activeDossiersService: ActiveDossiersService,
|
||||
private readonly _userPreferenceService: UserPreferenceService,
|
||||
private readonly _loadingService: LoadingService,
|
||||
dossierTemplatesService: DossierTemplatesService,
|
||||
) {
|
||||
super();
|
||||
@ -56,10 +57,12 @@ export class DossiersListingScreenComponent extends ListingComponent<Dossier> im
|
||||
this.addSubscription = this._activeDossiersService.all$
|
||||
.pipe(tap(dossiers => this.entitiesService.setEntities(dossiers.filter(d => d.dossierTemplateId === this.dossierTemplate.id))))
|
||||
.subscribe();
|
||||
this._loadingService.stop();
|
||||
}
|
||||
|
||||
ngOnAttach(): void {
|
||||
this._tableComponent?.scrollToLastIndex();
|
||||
this._loadingService.stop();
|
||||
}
|
||||
|
||||
private _computeAllFilters() {
|
||||
|
||||
@ -31,7 +31,7 @@ export function webViewerLoadedGuard(): CanActivateFn | ResolveFn<boolean> {
|
||||
} catch (e) {
|
||||
const redirectUrl = state.url.split('/').slice(0, -2).join('/');
|
||||
logger.warn('[PDF] WebViewerGuard error: ', e, 'redirecting to', redirectUrl);
|
||||
return router.navigateByUrl(redirectUrl); // redirect to dissier page
|
||||
return router.navigateByUrl(redirectUrl); // redirect to dossier page
|
||||
}
|
||||
|
||||
annotationManager.init(instance.Core.annotationManager);
|
||||
|
||||
@ -97,7 +97,7 @@
|
||||
[label]="'dictionary-overview.save-changes' | translate"
|
||||
[type]="iconButtonTypes.primary"
|
||||
icon="iqser:check"
|
||||
[disabled]="!!(_loadingService.isLoading$ | async)"
|
||||
[disabled]="!!_loadingService.isLoading()"
|
||||
></iqser-icon-button>
|
||||
<div (click)="revert()" class="all-caps-label cancel" translate="dictionary-overview.revert-changes"></div>
|
||||
</div>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
||||
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
|
||||
import { CircleButtonTypes, ListingComponent, listingProvidersFactory, LoadingService, TableColumnConfig } from '@iqser/common-ui';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { firstValueFrom, Observable } from 'rxjs';
|
||||
@ -17,7 +17,7 @@ import { SortingOrders } from '@iqser/common-ui/lib/sorting';
|
||||
component: TrashScreenComponent,
|
||||
}),
|
||||
})
|
||||
export class TrashScreenComponent extends ListingComponent<TrashItem> {
|
||||
export class TrashScreenComponent extends ListingComponent<TrashItem> implements OnInit {
|
||||
readonly circleButtonTypes = CircleButtonTypes;
|
||||
readonly tableHeaderLabel = _('trash.table-header.title');
|
||||
readonly canRestoreSelected$ = this._canRestoreSelected$;
|
||||
@ -44,6 +44,10 @@ export class TrashScreenComponent extends ListingComponent<TrashItem> {
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this._loadingService.stop();
|
||||
}
|
||||
|
||||
private get _canRestoreSelected$(): Observable<boolean> {
|
||||
return this.listingService.selectedEntities$.pipe(
|
||||
map(entities => entities.length && !entities.find(dossier => !(dossier.canRestore && dossier.hasRestoreRights))),
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit 2524896f460594d7766a7c572b63cd3199eac7db
|
||||
Subproject commit d40f839365d62af8893cb529020702949ffeca33
|
||||
Loading…
x
Reference in New Issue
Block a user