Fixed entity reload, other updates
This commit is contained in:
parent
4b7cfadfa6
commit
db7524d48c
@ -2,7 +2,7 @@ import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||
import { AppStateService } from '@state/app-state.service';
|
||||
import { Router } from '@angular/router';
|
||||
import { AdminDialogService } from '../../services/admin-dialog.service';
|
||||
import { CircleButtonTypes, LoadingService, Toaster } from '@iqser/common-ui';
|
||||
import { CircleButtonTypes, CONFLICT, LoadingService, Toaster } from '@iqser/common-ui';
|
||||
import { UserService } from '@services/user.service';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
|
||||
@ -57,7 +57,7 @@ export class DossierTemplateActionsComponent implements OnInit {
|
||||
await this._router.navigate(['main', 'admin']);
|
||||
})
|
||||
.catch(error => {
|
||||
if (error.status === 409) {
|
||||
if (error.status === CONFLICT) {
|
||||
this._toaster.error(_('dossier-templates-listing.error.conflict'));
|
||||
} else {
|
||||
this._toaster.error(_('dossier-templates-listing.error.generic'));
|
||||
|
||||
@ -2,7 +2,7 @@ import { ChangeDetectionStrategy, Component, Inject } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import { Observable } from 'rxjs';
|
||||
import { BaseDialogComponent, shareDistinctLast, Toaster } from '@iqser/common-ui';
|
||||
import { BAD_REQUEST, BaseDialogComponent, CONFLICT, shareDistinctLast, Toaster } from '@iqser/common-ui';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { AppStateService } from '@state/app-state.service';
|
||||
@ -105,9 +105,9 @@ export class AddEditDictionaryDialogComponent extends BaseDialogComponent {
|
||||
.toPromise()
|
||||
.then(() => this._dialogRef.close(true))
|
||||
.catch(error => {
|
||||
if (error.status === 409) {
|
||||
if (error.status === CONFLICT) {
|
||||
this._toaster.error(_('add-edit-dictionary.error.dictionary-already-exists'));
|
||||
} else if (error.status === 400) {
|
||||
} else if (error.status === BAD_REQUEST) {
|
||||
this._toaster.error(_('add-edit-dictionary.error.invalid-color-or-rank'));
|
||||
} else {
|
||||
this._toaster.error(_('add-edit-dictionary.error.generic'));
|
||||
|
||||
@ -7,7 +7,7 @@ import { Moment } from 'moment';
|
||||
import { applyIntervalConstraints } from '@utils/date-inputs-utils';
|
||||
import { downloadTypesTranslations } from '../../../../translations/download-types-translations';
|
||||
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
|
||||
import { BaseDialogComponent, CONFLICT_ERROR_CODE, Toaster } from '@iqser/common-ui';
|
||||
import { BaseDialogComponent, CONFLICT, Toaster } from '@iqser/common-ui';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { DownloadFileType, IDossierTemplate } from '@red/domain';
|
||||
|
||||
@ -108,9 +108,7 @@ export class AddEditDossierTemplateDialogComponent extends BaseDialogComponent {
|
||||
this.dialogRef.close(true);
|
||||
} catch (error: any) {
|
||||
const message =
|
||||
error.status === CONFLICT_ERROR_CODE
|
||||
? _('add-edit-dossier-template.error.conflict')
|
||||
: _('add-edit-dossier-template.error.generic');
|
||||
error.status === CONFLICT ? _('add-edit-dossier-template.error.conflict') : _('add-edit-dossier-template.error.generic');
|
||||
this._toaster.error(message, { error });
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
import { AdminDialogService } from '../../../services/admin-dialog.service';
|
||||
import { IconButtonTypes, LoadingService, Toaster } from '@iqser/common-ui';
|
||||
import { CONFLICT, IconButtonTypes, LoadingService, Toaster } from '@iqser/common-ui';
|
||||
import { rolesTranslations } from '../../../../../translations/roles-translations';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { User } from '@red/domain';
|
||||
@ -119,7 +119,7 @@ export class UserDetailsComponent implements OnInit {
|
||||
this.closeDialog.emit(true);
|
||||
})
|
||||
.catch(error => {
|
||||
if (error.status === 409) {
|
||||
if (error.status === CONFLICT) {
|
||||
this._toaster.error(_('add-edit-user.error.email-already-used'));
|
||||
} else {
|
||||
this._toaster.error(_('add-edit-user.error.generic'));
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { Component, OnDestroy } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
import { lastIndexOfEnd } from '@utils/functions';
|
||||
import { AutoUnsubscribe, IconButtonTypes, LoadingService, Toaster } from '@iqser/common-ui';
|
||||
import { AutoUnsubscribe, BAD_REQUEST, IconButtonTypes, LoadingService, Toaster } from '@iqser/common-ui';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { UserService } from '@services/user.service';
|
||||
import { RouterHistoryService } from '@services/router-history.service';
|
||||
@ -55,7 +55,7 @@ export class DigitalSignatureScreenComponent extends AutoUnsubscribe implements
|
||||
this._toaster.success(_('digital-signature-screen.action.save-success'));
|
||||
},
|
||||
error => {
|
||||
if (error.status === 400) {
|
||||
if (error.status === BAD_REQUEST) {
|
||||
this._toaster.error(_('digital-signature-screen.action.certificate-not-valid-error'));
|
||||
} else {
|
||||
this._toaster.error(_('digital-signature-screen.action.save-error'));
|
||||
|
||||
@ -5,6 +5,7 @@ import { AdminDialogService } from '../../services/admin-dialog.service';
|
||||
import { DossierTemplate } from '@red/domain';
|
||||
import {
|
||||
CircleButtonTypes,
|
||||
CONFLICT,
|
||||
DefaultListingServicesTmp,
|
||||
EntitiesService,
|
||||
IconButtonTypes,
|
||||
@ -89,7 +90,7 @@ export class DossierTemplatesListingScreenComponent extends ListingComponent<Dos
|
||||
.delete(templateIds)
|
||||
.toPromise()
|
||||
.catch(error => {
|
||||
if (error.status === 409) {
|
||||
if (error.status === CONFLICT) {
|
||||
this._toaster.error(_('dossier-templates-listing.error.conflict'));
|
||||
} else {
|
||||
this._toaster.error(_('dossier-templates-listing.error.generic'));
|
||||
|
||||
@ -3,6 +3,7 @@ import { AppStateService } from '@state/app-state.service';
|
||||
import { AdminDialogService } from '../../services/admin-dialog.service';
|
||||
import {
|
||||
CircleButtonTypes,
|
||||
CONFLICT,
|
||||
DefaultListingServices,
|
||||
IconButtonTypes,
|
||||
ListingComponent,
|
||||
@ -117,7 +118,8 @@ export class FileAttributesListingScreenComponent extends ListingComponent<FileA
|
||||
.setFileAttributesConfig(newValue, this._dossierTemplatesService.activeDossierTemplateId)
|
||||
.toPromise()
|
||||
.catch(error => {
|
||||
if (error.status === 409) {
|
||||
console.log('error');
|
||||
if (error.status === CONFLICT) {
|
||||
this._toaster.error(_('file-attributes-listing.error.conflict'));
|
||||
} else {
|
||||
this._toaster.error(_('file-attributes-listing.error.generic'));
|
||||
|
||||
@ -188,7 +188,7 @@ export class DossierOverviewScreenComponent extends ListingComponent<File> imple
|
||||
|
||||
async ngOnAttach() {
|
||||
await this.ngOnInit();
|
||||
this._tableComponent.tableContent.scrollToLastIndex();
|
||||
this._tableComponent?.scrollToLastIndex();
|
||||
}
|
||||
|
||||
ngOnDetach() {
|
||||
|
||||
@ -78,7 +78,7 @@ export class DossiersListingScreenComponent extends ListingComponent<Dossier> im
|
||||
|
||||
ngOnAttach(): void {
|
||||
this.ngOnInit();
|
||||
this._tableComponent.tableContent.scrollToLastIndex();
|
||||
this._tableComponent?.scrollToLastIndex();
|
||||
}
|
||||
|
||||
ngOnDetach(): void {
|
||||
|
||||
@ -11,7 +11,7 @@ import {
|
||||
IResizeRequest,
|
||||
} from '@red/domain';
|
||||
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
||||
import { CONFLICT_ERROR_CODE, GenericService, RequiredParam, Toaster, Validate } from '@iqser/common-ui';
|
||||
import { CONFLICT, GenericService, RequiredParam, Toaster, Validate } from '@iqser/common-ui';
|
||||
import { map, tap } from 'rxjs/operators';
|
||||
import { PermissionsService } from '@services/permissions.service';
|
||||
import { AnnotationActionMode } from '../models/annotation-action-mode.model';
|
||||
@ -60,7 +60,7 @@ export class ManualAnnotationService extends GenericService<IManualAddResponse>
|
||||
tap(
|
||||
() => this._toaster.success(this._getMessage(mode, modifyDictionary), { positionClass: 'toast-file-preview' }),
|
||||
(error: HttpErrorResponse) => {
|
||||
const isConflict = error.status === CONFLICT_ERROR_CODE;
|
||||
const isConflict = error.status === CONFLICT;
|
||||
this._toaster.error(this._getMessage(mode, modifyDictionary, true, isConflict), {
|
||||
error,
|
||||
params: {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { Injectable, Injector } from '@angular/core';
|
||||
import { EntitiesService, List, mapEach, QueryParam, RequiredParam, shareLast, Toaster, Validate } from '@iqser/common-ui';
|
||||
import { CONFLICT, EntitiesService, List, mapEach, QueryParam, RequiredParam, shareLast, Toaster, Validate } from '@iqser/common-ui';
|
||||
import { Dossier, IDossier, IDossierRequest } from '@red/domain';
|
||||
import { catchError, filter, map, mapTo, switchMap, tap } from 'rxjs/operators';
|
||||
import { combineLatest, iif, Observable, of, throwError } from 'rxjs';
|
||||
@ -35,7 +35,7 @@ export class DossiersService extends EntitiesService<Dossier, IDossier> {
|
||||
mapEach(entity => new Dossier(entity)),
|
||||
/* Load stats before updating entities */
|
||||
switchMap(dossiers => this._dossierStatsService.getFor(dossierIds(dossiers)).pipe(mapTo(dossiers))),
|
||||
tap(dossiers => this.replace(dossiers)),
|
||||
tap(dossiers => this.setEntities(dossiers)),
|
||||
);
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@ export class DossiersService extends EntitiesService<Dossier, IDossier> {
|
||||
@Validate()
|
||||
createOrUpdate(@RequiredParam() dossier: IDossierRequest): Observable<Dossier | undefined> {
|
||||
const showToast = (error: HttpErrorResponse) => {
|
||||
this._toaster.error(error.status === 409 ? DOSSIER_EXISTS_MSG : GENERIC_MGS);
|
||||
this._toaster.error(error.status === CONFLICT ? DOSSIER_EXISTS_MSG : GENERIC_MGS);
|
||||
return throwError(error);
|
||||
};
|
||||
|
||||
|
||||
@ -56,7 +56,7 @@ export class UserService extends EntitiesService<User, IUser> {
|
||||
const userId = (<{ sub: string }>decoded).sub;
|
||||
|
||||
const roles = this._keycloakService.getUserRoles(true).filter(role => role.startsWith('RED_'));
|
||||
this.replace([new User(await this._keycloakService.loadUserProfile(true), roles, userId)]);
|
||||
this.replace(new User(await this._keycloakService.loadUserProfile(true), roles, userId));
|
||||
|
||||
this._currentUser$.next(this.find(userId));
|
||||
}
|
||||
|
||||
@ -154,7 +154,7 @@ export class AppStateService {
|
||||
await this._fileAttributesService.getFileAttributesConfig(dossierTemplateId).toPromise();
|
||||
|
||||
const newDossierTemplate = new DossierTemplate(dossierTemplate);
|
||||
this._dossierTemplatesService.replace([newDossierTemplate]);
|
||||
this._dossierTemplatesService.replace(newDossierTemplate);
|
||||
|
||||
await this.refreshDossierTemplateDictionaryData(dossierTemplateId);
|
||||
}
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit 5b26f76f0e48f4ead6d6f5dfe9a3d76e4a429bfc
|
||||
Subproject commit b338dd9baa8fd67a83d2f8c5710f8b56b0e360cd
|
||||
Loading…
x
Reference in New Issue
Block a user