Pull request #336: FirstValueFrom
Merge in RED/ui from firstValueFrom to master * commit '880318f352daf831a5e7efd6e9dbb5fa2a39c9fe': fixed removed imports from rebase added dossier-template-listing ts file update common firstValueFrom instead of toPromise() in red-ui wip shared module firstValueFrom instead of toPromise() in dossier module firstValueFrom instead of toPromise() in account module firstValueFrom instead of toPromise() in admin module
This commit is contained in:
commit
0abd8e9e49
@ -11,7 +11,7 @@ import {
|
|||||||
} from '@iqser/common-ui';
|
} from '@iqser/common-ui';
|
||||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||||
import { RouterHistoryService } from '@services/router-history.service';
|
import { RouterHistoryService } from '@services/router-history.service';
|
||||||
import { interval } from 'rxjs';
|
import { firstValueFrom, interval } from 'rxjs';
|
||||||
import { switchMap } from 'rxjs/operators';
|
import { switchMap } from 'rxjs/operators';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -60,11 +60,11 @@ export class DownloadsListScreenComponent extends ListingComponent<DownloadStatu
|
|||||||
|
|
||||||
private async _deleteItems(downloads?: DownloadStatus[]) {
|
private async _deleteItems(downloads?: DownloadStatus[]) {
|
||||||
const storageIds = (downloads || this.listingService.selected).map(d => d.storageId);
|
const storageIds = (downloads || this.listingService.selected).map(d => d.storageId);
|
||||||
await this.fileDownloadService.delete({ storageIds }).toPromise();
|
await firstValueFrom(this.fileDownloadService.delete({ storageIds }));
|
||||||
await this._loadData();
|
await this._loadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _loadData() {
|
private async _loadData() {
|
||||||
await this.fileDownloadService.loadAll().toPromise();
|
await firstValueFrom(this.fileDownloadService.loadAll());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import { DossiersService } from '@services/entity-services/dossiers.service';
|
|||||||
import { NotificationsService } from '@services/notifications.service';
|
import { NotificationsService } from '@services/notifications.service';
|
||||||
import { Notification } from '@red/domain';
|
import { Notification } from '@red/domain';
|
||||||
import { distinctUntilChanged, map, switchMap, tap } from 'rxjs/operators';
|
import { distinctUntilChanged, map, switchMap, tap } from 'rxjs/operators';
|
||||||
import { BehaviorSubject, Observable, timer } from 'rxjs';
|
import { BehaviorSubject, firstValueFrom, Observable, timer } from 'rxjs';
|
||||||
import { AutoUnsubscribe, List, shareLast } from '@iqser/common-ui';
|
import { AutoUnsubscribe, List, shareLast } from '@iqser/common-ui';
|
||||||
import { CHANGED_CHECK_INTERVAL } from '@utils/constants';
|
import { CHANGED_CHECK_INTERVAL } from '@utils/constants';
|
||||||
|
|
||||||
@ -63,12 +63,12 @@ export class NotificationsComponent extends AutoUnsubscribe implements OnInit {
|
|||||||
|
|
||||||
async markRead($event, notifications: List<string> = this._notifications$.getValue().map(n => n.id), isRead = true): Promise<void> {
|
async markRead($event, notifications: List<string> = this._notifications$.getValue().map(n => n.id), isRead = true): Promise<void> {
|
||||||
$event.stopPropagation();
|
$event.stopPropagation();
|
||||||
await this._notificationsService.toggleNotificationRead(notifications, isRead).toPromise();
|
await firstValueFrom(this._notificationsService.toggleNotificationRead(notifications, isRead));
|
||||||
await this._loadData();
|
await this._loadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _loadData(): Promise<void> {
|
private async _loadData(): Promise<void> {
|
||||||
const notifications = await this._notificationsService.getNotifications(INCLUDE_SEEN).toPromise();
|
const notifications = await firstValueFrom(this._notificationsService.getNotifications(INCLUDE_SEEN));
|
||||||
this._notifications$.next(notifications);
|
this._notifications$.next(notifications);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import { ActivatedRouteSnapshot, CanActivate, Router } from '@angular/router';
|
|||||||
import { DossiersService } from '@services/entity-services/dossiers.service';
|
import { DossiersService } from '@services/entity-services/dossiers.service';
|
||||||
import { FilesMapService } from '@services/entity-services/files-map.service';
|
import { FilesMapService } from '@services/entity-services/files-map.service';
|
||||||
import { FilesService } from '@services/entity-services/files.service';
|
import { FilesService } from '@services/entity-services/files.service';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
@Injectable({ providedIn: 'root' })
|
@Injectable({ providedIn: 'root' })
|
||||||
export class DossierFilesGuard implements CanActivate {
|
export class DossierFilesGuard implements CanActivate {
|
||||||
@ -22,7 +23,7 @@ export class DossierFilesGuard implements CanActivate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!this._filesMapService.has(dossierId)) {
|
if (!this._filesMapService.has(dossierId)) {
|
||||||
await this._filesService.loadAll(dossierId).toPromise();
|
await firstValueFrom(this._filesService.loadAll(dossierId));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import { Injectable } from '@angular/core';
|
|||||||
import { CanActivate, Router } from '@angular/router';
|
import { CanActivate, Router } from '@angular/router';
|
||||||
import { DossiersService } from '@services/entity-services/dossiers.service';
|
import { DossiersService } from '@services/entity-services/dossiers.service';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
@Injectable({ providedIn: 'root' })
|
@Injectable({ providedIn: 'root' })
|
||||||
export class DossiersGuard implements CanActivate {
|
export class DossiersGuard implements CanActivate {
|
||||||
@ -12,7 +13,7 @@ export class DossiersGuard implements CanActivate {
|
|||||||
) {}
|
) {}
|
||||||
|
|
||||||
async canActivate(): Promise<boolean> {
|
async canActivate(): Promise<boolean> {
|
||||||
await this._dossiersService.loadAll().toPromise();
|
await firstValueFrom(this._dossiersService.loadAll());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { UserPreferenceService } from '@services/user-preference.service';
|
import { UserPreferenceService } from '@services/user-preference.service';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
@ -27,12 +28,12 @@ export class LanguageService {
|
|||||||
}
|
}
|
||||||
document.documentElement.lang = defaultLang;
|
document.documentElement.lang = defaultLang;
|
||||||
this._translateService.setDefaultLang(defaultLang);
|
this._translateService.setDefaultLang(defaultLang);
|
||||||
this._translateService.use(defaultLang).toPromise().then();
|
firstValueFrom(this._translateService.use(defaultLang)).then();
|
||||||
}
|
}
|
||||||
|
|
||||||
async changeLanguage(language: string) {
|
async changeLanguage(language: string) {
|
||||||
await this._userPreferenceService.saveLanguage(language);
|
await this._userPreferenceService.saveLanguage(language);
|
||||||
document.documentElement.lang = language;
|
document.documentElement.lang = language;
|
||||||
await this._translateService.use(language).toPromise();
|
await firstValueFrom(this._translateService.use(language));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import {
|
|||||||
NotificationGroupsKeys,
|
NotificationGroupsKeys,
|
||||||
NotificationGroupsValues,
|
NotificationGroupsValues,
|
||||||
} from '@red/domain';
|
} from '@red/domain';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-notifications-screen',
|
selector: 'redaction-notifications-screen',
|
||||||
@ -67,7 +68,7 @@ export class NotificationsScreenComponent implements OnInit {
|
|||||||
async save() {
|
async save() {
|
||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
try {
|
try {
|
||||||
await this._notificationPreferencesService.update(this.formGroup.value).toPromise();
|
await firstValueFrom(this._notificationPreferencesService.update(this.formGroup.value));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this._toaster.error(_('notifications-screen.error.generic'));
|
this._toaster.error(_('notifications-screen.error.generic'));
|
||||||
}
|
}
|
||||||
@ -87,7 +88,7 @@ export class NotificationsScreenComponent implements OnInit {
|
|||||||
private async _initializeForm() {
|
private async _initializeForm() {
|
||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
|
|
||||||
const notificationPreferences = await this._notificationPreferencesService.get().toPromise();
|
const notificationPreferences = await firstValueFrom(this._notificationPreferencesService.get());
|
||||||
this.formGroup.patchValue(notificationPreferences);
|
this.formGroup.patchValue(notificationPreferences);
|
||||||
|
|
||||||
this._loadingService.stop();
|
this._loadingService.stop();
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import { PermissionsService } from '@services/permissions.service';
|
|||||||
import { UserService } from '@services/user.service';
|
import { UserService } from '@services/user.service';
|
||||||
import { ConfigService } from '../../../../../services/config.service';
|
import { ConfigService } from '../../../../../services/config.service';
|
||||||
import { LanguageService } from '../../../../../i18n/language.service';
|
import { LanguageService } from '../../../../../i18n/language.service';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-user-profile-screen',
|
selector: 'redaction-user-profile-screen',
|
||||||
@ -76,14 +77,14 @@ export class UserProfileScreenComponent implements OnInit {
|
|||||||
const value = this.form.getRawValue() as IProfile;
|
const value = this.form.getRawValue() as IProfile;
|
||||||
delete value.language;
|
delete value.language;
|
||||||
|
|
||||||
await this._userService
|
await firstValueFrom(
|
||||||
.updateMyProfile({
|
this._userService.updateMyProfile({
|
||||||
...value,
|
...value,
|
||||||
})
|
}),
|
||||||
.toPromise();
|
);
|
||||||
|
|
||||||
await this._userService.loadCurrentUser();
|
await this._userService.loadCurrentUser();
|
||||||
await this._userService.loadAll().toPromise();
|
await firstValueFrom(this._userService.loadAll());
|
||||||
}
|
}
|
||||||
|
|
||||||
this._initializeForm();
|
this._initializeForm();
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { ChangeDetectionStrategy, Component, Inject, Injector } from '@angular/core';
|
import { ChangeDetectionStrategy, Component, Inject, Injector } from '@angular/core';
|
||||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||||
import { Observable } from 'rxjs';
|
import { firstValueFrom, Observable } from 'rxjs';
|
||||||
import { BaseDialogComponent, shareDistinctLast, Toaster } from '@iqser/common-ui';
|
import { BaseDialogComponent, shareDistinctLast, Toaster } from '@iqser/common-ui';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||||
@ -77,8 +77,7 @@ export class AddEditDictionaryDialogComponent extends BaseDialogComponent {
|
|||||||
observable = this._dictionaryService.addDictionary({ ...dictionary, dossierTemplateId });
|
observable = this._dictionaryService.addDictionary({ ...dictionary, dossierTemplateId });
|
||||||
}
|
}
|
||||||
|
|
||||||
return observable
|
return firstValueFrom(observable)
|
||||||
.toPromise()
|
|
||||||
.then(() => this._dialogRef.close(true))
|
.then(() => this._dialogRef.close(true))
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
if (error.status === HttpStatusCode.Conflict) {
|
if (error.status === HttpStatusCode.Conflict) {
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import { BaseDialogComponent, LoadingService, Toaster } from '@iqser/common-ui';
|
|||||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||||
import { DownloadFileType, IDossierTemplate } from '@red/domain';
|
import { DownloadFileType, IDossierTemplate } from '@red/domain';
|
||||||
import { HttpStatusCode } from '@angular/common/http';
|
import { HttpStatusCode } from '@angular/common/http';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: './add-edit-dossier-template-dialog.component.html',
|
templateUrl: './add-edit-dossier-template-dialog.component.html',
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import { UserService } from '@services/user.service';
|
|||||||
import { LoadingService, Toaster } from '@iqser/common-ui';
|
import { LoadingService, Toaster } from '@iqser/common-ui';
|
||||||
import { User } from '@red/domain';
|
import { User } from '@red/domain';
|
||||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-reset-password',
|
selector: 'redaction-reset-password',
|
||||||
@ -25,15 +26,15 @@ export class ResetPasswordComponent {
|
|||||||
async save() {
|
async save() {
|
||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
try {
|
try {
|
||||||
await this._userService
|
await firstValueFrom(
|
||||||
.resetPassword(
|
this._userService.resetPassword(
|
||||||
{
|
{
|
||||||
password: this.form.get('temporaryPassword').value,
|
password: this.form.get('temporaryPassword').value,
|
||||||
temporary: true,
|
temporary: true,
|
||||||
},
|
},
|
||||||
this.user.id,
|
this.user.id,
|
||||||
)
|
),
|
||||||
.toPromise();
|
);
|
||||||
this.toggleResetPassword.emit();
|
this.toggleResetPassword.emit();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this._toaster.error(_('reset-password-dialog.error.password-policy'));
|
this._toaster.error(_('reset-password-dialog.error.password-policy'));
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
|||||||
import { User } from '@red/domain';
|
import { User } from '@red/domain';
|
||||||
import { UserService } from '@services/user.service';
|
import { UserService } from '@services/user.service';
|
||||||
import { HttpStatusCode } from '@angular/common/http';
|
import { HttpStatusCode } from '@angular/common/http';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-user-details',
|
selector: 'redaction-user-details',
|
||||||
@ -107,9 +108,7 @@ export class UserDetailsComponent extends AutoUnsubscribe implements OnChanges,
|
|||||||
const userData = { ...this.form.getRawValue(), roles: this.activeRoles };
|
const userData = { ...this.form.getRawValue(), roles: this.activeRoles };
|
||||||
|
|
||||||
if (!this.user) {
|
if (!this.user) {
|
||||||
await this.userService
|
await firstValueFrom(this.userService.create(userData))
|
||||||
.create(userData)
|
|
||||||
.toPromise()
|
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.closeDialog.emit(true);
|
this.closeDialog.emit(true);
|
||||||
})
|
})
|
||||||
@ -122,7 +121,7 @@ export class UserDetailsComponent extends AutoUnsubscribe implements OnChanges,
|
|||||||
this._loadingService.stop();
|
this._loadingService.stop();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
await this.userService.updateProfile(userData, this.user.id).toPromise();
|
await firstValueFrom(this.userService.updateProfile(userData, this.user.id));
|
||||||
this.closeDialog.emit(true);
|
this.closeDialog.emit(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import { List, LoadingService } from '@iqser/common-ui';
|
|||||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||||
import { DossiersService } from '@services/entity-services/dossiers.service';
|
import { DossiersService } from '@services/entity-services/dossiers.service';
|
||||||
import { UserService } from '@services/user.service';
|
import { UserService } from '@services/user.service';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-confirm-delete-users-dialog',
|
selector: 'redaction-confirm-delete-users-dialog',
|
||||||
@ -40,7 +41,7 @@ export class ConfirmDeleteUsersDialogComponent {
|
|||||||
async deleteUser() {
|
async deleteUser() {
|
||||||
if (this.valid) {
|
if (this.valid) {
|
||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
await this._userService.delete(this.userIds).toPromise();
|
await firstValueFrom(this._userService.delete(this.userIds));
|
||||||
this.dialogRef.close(true);
|
this.dialogRef.close(true);
|
||||||
} else {
|
} else {
|
||||||
this.showToast = true;
|
this.showToast = true;
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import { TranslateService } from '@ngx-translate/core';
|
|||||||
import { defaultColorsTranslations } from '../../translations/default-colors-translations';
|
import { defaultColorsTranslations } from '../../translations/default-colors-translations';
|
||||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||||
import { DictionaryService } from '@shared/services/dictionary.service';
|
import { DictionaryService } from '@shared/services/dictionary.service';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
interface IEditColorData {
|
interface IEditColorData {
|
||||||
colors: IColors;
|
colors: IColors;
|
||||||
@ -46,7 +47,7 @@ export class EditColorDialogComponent extends BaseDialogComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await this._dictionaryService.setColors(colors, this._dossierTemplateId).toPromise();
|
await firstValueFrom(this._dictionaryService.setColors(colors, this._dossierTemplateId));
|
||||||
this._dialogRef.close(true);
|
this._dialogRef.close(true);
|
||||||
const color = this._translateService.instant(defaultColorsTranslations[this.data.colorKey]);
|
const color = this._translateService.instant(defaultColorsTranslations[this.data.colorKey]);
|
||||||
this._toaster.info(_('edit-color-dialog.success'), { params: { color: color } });
|
this._toaster.info(_('edit-color-dialog.success'), { params: { color: color } });
|
||||||
|
|||||||
@ -2,9 +2,9 @@ import { ChangeDetectionStrategy, Component, Inject, Injector } from '@angular/c
|
|||||||
import { AbstractControl, FormBuilder, FormGroup, ValidatorFn, Validators } from '@angular/forms';
|
import { AbstractControl, FormBuilder, FormGroup, ValidatorFn, Validators } from '@angular/forms';
|
||||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||||
import * as Papa from 'papaparse';
|
import * as Papa from 'papaparse';
|
||||||
import { Observable } from 'rxjs';
|
import { firstValueFrom, Observable } from 'rxjs';
|
||||||
import { map, startWith } from 'rxjs/operators';
|
import { map, startWith } from 'rxjs/operators';
|
||||||
import { DefaultListingServices, ListingComponent, TableColumnConfig, Toaster, trackBy } from '@iqser/common-ui';
|
import { DefaultListingServices, ListingComponent, TableColumnConfig, Toaster, trackByFactory } from '@iqser/common-ui';
|
||||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||||
import { FileAttributeConfig, FileAttributeConfigTypes, IField, IFileAttributesConfig } from '@red/domain';
|
import { FileAttributeConfig, FileAttributeConfigTypes, IField, IFileAttributesConfig } from '@red/domain';
|
||||||
import { FileAttributesService } from '@services/entity-services/file-attributes.service';
|
import { FileAttributesService } from '@services/entity-services/file-attributes.service';
|
||||||
@ -34,7 +34,7 @@ export class FileAttributesCsvImportDialogComponent extends ListingComponent<IFi
|
|||||||
columnSample = [];
|
columnSample = [];
|
||||||
initialParseConfig: { delimiter?: string; encoding?: string } = {};
|
initialParseConfig: { delimiter?: string; encoding?: string } = {};
|
||||||
readonly tableHeaderLabel = '';
|
readonly tableHeaderLabel = '';
|
||||||
readonly trackBy = trackBy();
|
readonly trackBy = trackByFactory();
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly _toaster: Toaster,
|
private readonly _toaster: Toaster,
|
||||||
@ -56,14 +56,6 @@ export class FileAttributesCsvImportDialogComponent extends ListingComponent<IFi
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private _getForm(): FormGroup {
|
|
||||||
return this._formBuilder.group({
|
|
||||||
filenameMappingColumnHeaderName: ['', [Validators.required, this._autocompleteStringValidator()]],
|
|
||||||
delimiter: [undefined, Validators.required],
|
|
||||||
encoding: ['UTF-8', Validators.required],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
readFile() {
|
readFile() {
|
||||||
const reader = new FileReader();
|
const reader = new FileReader();
|
||||||
reader.addEventListener('load', event => {
|
reader.addEventListener('load', event => {
|
||||||
@ -183,7 +175,7 @@ export class FileAttributesCsvImportDialogComponent extends ListingComponent<IFi
|
|||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await this._fileAttributesService.setFileAttributeConfig(fileAttributes, this.data.dossierTemplateId).toPromise();
|
await firstValueFrom(this._fileAttributesService.setFileAttributeConfig(fileAttributes, this.data.dossierTemplateId));
|
||||||
this._toaster.success(_('file-attributes-csv-import.save.success'), { params: { count: this.activeFields.length } });
|
this._toaster.success(_('file-attributes-csv-import.save.success'), { params: { count: this.activeFields.length } });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this._toaster.error(_('file-attributes-csv-import.save.error'));
|
this._toaster.error(_('file-attributes-csv-import.save.error'));
|
||||||
@ -207,6 +199,14 @@ export class FileAttributesCsvImportDialogComponent extends ListingComponent<IFi
|
|||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _getForm(): FormGroup {
|
||||||
|
return this._formBuilder.group({
|
||||||
|
filenameMappingColumnHeaderName: ['', [Validators.required, this._autocompleteStringValidator()]],
|
||||||
|
delimiter: [undefined, Validators.required],
|
||||||
|
encoding: ['UTF-8', Validators.required],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private _autocompleteStringValidator(): ValidatorFn {
|
private _autocompleteStringValidator(): ValidatorFn {
|
||||||
return (control: AbstractControl): { [key: string]: any } | null => {
|
return (control: AbstractControl): { [key: string]: any } | null => {
|
||||||
if ((this.parseResult?.meta?.fields || []).indexOf(control.value) !== -1) {
|
if ((this.parseResult?.meta?.fields || []).indexOf(control.value) !== -1) {
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
|||||||
import { UserService } from '@services/user.service';
|
import { UserService } from '@services/user.service';
|
||||||
import { Audit, IAudit, IAuditResponse, IAuditSearchRequest } from '@red/domain';
|
import { Audit, IAudit, IAuditResponse, IAuditSearchRequest } from '@red/domain';
|
||||||
import { AuditService } from '../../services/audit.service';
|
import { AuditService } from '../../services/audit.service';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
const PAGE_SIZE = 50;
|
const PAGE_SIZE = 50;
|
||||||
|
|
||||||
@ -52,15 +53,6 @@ export class AuditScreenComponent extends ListingComponent<Audit> implements OnD
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private _getForm(): FormGroup {
|
|
||||||
return this._formBuilder.group({
|
|
||||||
category: [this.ALL_CATEGORIES],
|
|
||||||
userId: [this.ALL_USERS],
|
|
||||||
from: [],
|
|
||||||
to: [],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
get totalPages(): number {
|
get totalPages(): number {
|
||||||
if (!this.logs) {
|
if (!this.logs) {
|
||||||
return 0;
|
return 0;
|
||||||
@ -76,6 +68,15 @@ export class AuditScreenComponent extends ListingComponent<Audit> implements OnD
|
|||||||
await this._fetchData();
|
await this._fetchData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _getForm(): FormGroup {
|
||||||
|
return this._formBuilder.group({
|
||||||
|
category: [this.ALL_CATEGORIES],
|
||||||
|
userId: [this.ALL_USERS],
|
||||||
|
from: [],
|
||||||
|
to: [],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private _updateDateFilters(value): boolean {
|
private _updateDateFilters(value): boolean {
|
||||||
if (applyIntervalConstraints(value, this._previousFrom, this._previousTo, this.form, 'from', 'to')) {
|
if (applyIntervalConstraints(value, this._previousFrom, this._previousTo, this.form, 'from', 'to')) {
|
||||||
return true;
|
return true;
|
||||||
@ -105,8 +106,8 @@ export class AuditScreenComponent extends ListingComponent<Audit> implements OnD
|
|||||||
to,
|
to,
|
||||||
};
|
};
|
||||||
|
|
||||||
promises.push(this._auditService.getCategories().toPromise());
|
promises.push(firstValueFrom(this._auditService.getCategories()));
|
||||||
promises.push(this._auditService.searchAuditLog(logsRequestBody).toPromise());
|
promises.push(firstValueFrom(this._auditService.searchAuditLog(logsRequestBody)));
|
||||||
|
|
||||||
const data = await Promise.all(promises);
|
const data = await Promise.all(promises);
|
||||||
this.categories = data[0].map(c => c.category);
|
this.categories = data[0].map(c => c.category);
|
||||||
|
|||||||
@ -15,6 +15,7 @@ import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
|||||||
import { UserService } from '@services/user.service';
|
import { UserService } from '@services/user.service';
|
||||||
import { DictionaryService } from '@shared/services/dictionary.service';
|
import { DictionaryService } from '@shared/services/dictionary.service';
|
||||||
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
|
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
interface ListItem extends IListable {
|
interface ListItem extends IListable {
|
||||||
readonly key: string;
|
readonly key: string;
|
||||||
@ -72,7 +73,7 @@ export class DefaultColorsScreenComponent extends ListingComponent<ListItem> imp
|
|||||||
|
|
||||||
private async _loadColors() {
|
private async _loadColors() {
|
||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
const data = await this._appStateService.loadColors(this._dossierTemplatesService.activeDossierTemplateId).toPromise();
|
const data = await firstValueFrom(this._appStateService.loadColors(this._dossierTemplatesService.activeDossierTemplateId));
|
||||||
this._colorsObj = data;
|
this._colorsObj = data;
|
||||||
const entities = Object.keys(data)
|
const entities = Object.keys(data)
|
||||||
.map(key => ({
|
.map(key => ({
|
||||||
|
|||||||
@ -16,7 +16,7 @@ import { UserService } from '@services/user.service';
|
|||||||
import { DictionaryService } from '@shared/services/dictionary.service';
|
import { DictionaryService } from '@shared/services/dictionary.service';
|
||||||
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
|
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
|
||||||
import { Dictionary, DossierTemplateStats } from '@red/domain';
|
import { Dictionary, DossierTemplateStats } from '@red/domain';
|
||||||
import { Observable } from 'rxjs';
|
import { firstValueFrom, Observable } from 'rxjs';
|
||||||
import { DossierTemplateStatsService } from '@services/entity-services/dossier-template-stats.service';
|
import { DossierTemplateStatsService } from '@services/entity-services/dossier-template-stats.service';
|
||||||
import { ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute } from '@angular/router';
|
||||||
import { tap } from 'rxjs/operators';
|
import { tap } from 'rxjs/operators';
|
||||||
@ -66,12 +66,12 @@ export class DictionaryListingScreenComponent extends ListingComponent<Dictionar
|
|||||||
openDeleteDictionariesDialog($event?: MouseEvent, types = this.listingService.selected) {
|
openDeleteDictionariesDialog($event?: MouseEvent, types = this.listingService.selected) {
|
||||||
this._dialogService.openDialog('confirm', $event, null, async () => {
|
this._dialogService.openDialog('confirm', $event, null, async () => {
|
||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
await this._dictionaryService
|
await firstValueFrom(
|
||||||
.deleteDictionaries(
|
this._dictionaryService.deleteDictionaries(
|
||||||
types.map(t => t.type),
|
types.map(t => t.type),
|
||||||
this._dossierTemplatesService.activeDossierTemplateId,
|
this._dossierTemplatesService.activeDossierTemplateId,
|
||||||
)
|
),
|
||||||
.toPromise();
|
);
|
||||||
await this._loadDictionaryData();
|
await this._loadDictionaryData();
|
||||||
this._loadingService.stop();
|
this._loadingService.stop();
|
||||||
});
|
});
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import { CircleButtonTypes, LoadingService } from '@iqser/common-ui';
|
|||||||
import { UserService } from '@services/user.service';
|
import { UserService } from '@services/user.service';
|
||||||
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
|
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
|
||||||
import { Dictionary } from '@red/domain';
|
import { Dictionary } from '@red/domain';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: './dictionary-overview-screen.component.html',
|
templateUrl: './dictionary-overview-screen.component.html',
|
||||||
@ -72,7 +73,7 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple
|
|||||||
$event?.stopPropagation();
|
$event?.stopPropagation();
|
||||||
|
|
||||||
this._dialogService.openDialog('confirm', $event, null, async () => {
|
this._dialogService.openDialog('confirm', $event, null, async () => {
|
||||||
await this._dictionaryService.deleteDictionaries([this.dictionary.type], this.dictionary.dossierTemplateId).toPromise();
|
await firstValueFrom(this._dictionaryService.deleteDictionaries([this.dictionary.type], this.dictionary.dossierTemplateId));
|
||||||
await this._appStateService.loadDictionaryData();
|
await this._appStateService.loadDictionaryData();
|
||||||
await this._router.navigate([
|
await this._router.navigate([
|
||||||
'/main',
|
'/main',
|
||||||
@ -149,9 +150,7 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple
|
|||||||
|
|
||||||
private async _loadEntries() {
|
private async _loadEntries() {
|
||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
await this._dictionaryService
|
await firstValueFrom(this._dictionaryService.getForType(this.dictionary.dossierTemplateId, this.dictionary.type))
|
||||||
.getForType(this.dictionary.dossierTemplateId, this.dictionary.type)
|
|
||||||
.toPromise()
|
|
||||||
.then(
|
.then(
|
||||||
data => {
|
data => {
|
||||||
this._loadingService.stop();
|
this._loadingService.stop();
|
||||||
|
|||||||
@ -15,6 +15,7 @@ import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
|||||||
import { UserService } from '@services/user.service';
|
import { UserService } from '@services/user.service';
|
||||||
import { DossierAttributeConfig, IDossierAttributeConfig } from '@red/domain';
|
import { DossierAttributeConfig, IDossierAttributeConfig } from '@red/domain';
|
||||||
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
|
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: './dossier-attributes-listing-screen.component.html',
|
templateUrl: './dossier-attributes-listing-screen.component.html',
|
||||||
@ -56,7 +57,7 @@ export class DossierAttributesListingScreenComponent extends ListingComponent<Do
|
|||||||
this._dialogService.openDialog('confirm', $event, null, async () => {
|
this._dialogService.openDialog('confirm', $event, null, async () => {
|
||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
const ids = dossierAttribute ? [dossierAttribute.id] : this.listingService.selected.map(item => item.id);
|
const ids = dossierAttribute ? [dossierAttribute.id] : this.listingService.selected.map(item => item.id);
|
||||||
await this._dossierAttributesService.delete(ids).toPromise();
|
await firstValueFrom(this._dossierAttributesService.delete(ids));
|
||||||
await this._loadData();
|
await this._loadData();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -71,7 +72,7 @@ export class DossierAttributesListingScreenComponent extends ListingComponent<Do
|
|||||||
|
|
||||||
private async _loadData() {
|
private async _loadData() {
|
||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
await this._dossierAttributesService.loadAll().toPromise();
|
await firstValueFrom(this._dossierAttributesService.loadAll());
|
||||||
this._loadingService.stop();
|
this._loadingService.stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,6 +18,7 @@ import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
|||||||
import { RouterHistoryService } from '@services/router-history.service';
|
import { RouterHistoryService } from '@services/router-history.service';
|
||||||
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
|
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
|
||||||
import { HttpStatusCode } from '@angular/common/http';
|
import { HttpStatusCode } from '@angular/common/http';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: './dossier-templates-listing-screen.component.html',
|
templateUrl: './dossier-templates-listing-screen.component.html',
|
||||||
@ -66,16 +67,13 @@ export class DossierTemplatesListingScreenComponent extends ListingComponent<Dos
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async _deleteTemplates(templateIds = this.listingService.selected.map(d => d.dossierTemplateId)) {
|
private async _deleteTemplates(templateIds = this.listingService.selected.map(d => d.dossierTemplateId)) {
|
||||||
await this._dossierTemplatesService
|
await firstValueFrom(this._dossierTemplatesService.delete(templateIds)).catch(error => {
|
||||||
.delete(templateIds)
|
if (error.status === HttpStatusCode.Conflict) {
|
||||||
.toPromise()
|
this._toaster.error(_('dossier-templates-listing.error.conflict'));
|
||||||
.catch(error => {
|
} else {
|
||||||
if (error.status === HttpStatusCode.Conflict) {
|
this._toaster.error(_('dossier-templates-listing.error.generic'));
|
||||||
this._toaster.error(_('dossier-templates-listing.error.conflict'));
|
}
|
||||||
} else {
|
});
|
||||||
this._toaster.error(_('dossier-templates-listing.error.generic'));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
await this._appStateService.loadDictionaryData();
|
await this._appStateService.loadDictionaryData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,6 +17,7 @@ import { FileAttributeConfig, IFileAttributeConfig, IFileAttributesConfig } from
|
|||||||
import { FileAttributesService } from '@services/entity-services/file-attributes.service';
|
import { FileAttributesService } from '@services/entity-services/file-attributes.service';
|
||||||
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
|
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
|
||||||
import { HttpStatusCode } from '@angular/common/http';
|
import { HttpStatusCode } from '@angular/common/http';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: './file-attributes-listing-screen.component.html',
|
templateUrl: './file-attributes-listing-screen.component.html',
|
||||||
@ -92,14 +93,14 @@ export class FileAttributesListingScreenComponent extends ListingComponent<FileA
|
|||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
const dossierTemplateId = this._dossierTemplatesService.activeDossierTemplateId;
|
const dossierTemplateId = this._dossierTemplatesService.activeDossierTemplateId;
|
||||||
if (fileAttribute) {
|
if (fileAttribute) {
|
||||||
await this._fileAttributesService.deleteFileAttributes([fileAttribute.id], dossierTemplateId).toPromise();
|
await firstValueFrom(this._fileAttributesService.deleteFileAttributes([fileAttribute.id], dossierTemplateId));
|
||||||
} else {
|
} else {
|
||||||
await this._fileAttributesService
|
await firstValueFrom(
|
||||||
.deleteFileAttributes(
|
this._fileAttributesService.deleteFileAttributes(
|
||||||
this.listingService.selected.map(f => f.id),
|
this.listingService.selected.map(f => f.id),
|
||||||
dossierTemplateId,
|
dossierTemplateId,
|
||||||
)
|
),
|
||||||
.toPromise();
|
);
|
||||||
}
|
}
|
||||||
await this._appStateService.refreshDossierTemplate(dossierTemplateId);
|
await this._appStateService.refreshDossierTemplate(dossierTemplateId);
|
||||||
await this._loadData();
|
await this._loadData();
|
||||||
@ -123,17 +124,16 @@ export class FileAttributesListingScreenComponent extends ListingComponent<FileA
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async _createNewFileAttributeAndRefreshView(newValue: IFileAttributeConfig): Promise<void> {
|
private async _createNewFileAttributeAndRefreshView(newValue: IFileAttributeConfig): Promise<void> {
|
||||||
await this._fileAttributesService
|
await firstValueFrom(
|
||||||
.setFileAttributesConfig(newValue, this._dossierTemplatesService.activeDossierTemplateId)
|
this._fileAttributesService.setFileAttributesConfig(newValue, this._dossierTemplatesService.activeDossierTemplateId),
|
||||||
.toPromise()
|
).catch(error => {
|
||||||
.catch(error => {
|
if (error.status === HttpStatusCode.Conflict) {
|
||||||
if (error.status === HttpStatusCode.Conflict) {
|
this._toaster.error(_('file-attributes-listing.error.conflict'));
|
||||||
this._toaster.error(_('file-attributes-listing.error.conflict'));
|
} else {
|
||||||
} else {
|
this._toaster.error(_('file-attributes-listing.error.generic'));
|
||||||
this._toaster.error(_('file-attributes-listing.error.generic'));
|
}
|
||||||
}
|
this._loadingService.stop();
|
||||||
this._loadingService.stop();
|
});
|
||||||
});
|
|
||||||
await this._appStateService.refreshDossierTemplate(this._dossierTemplatesService.activeDossierTemplateId);
|
await this._appStateService.refreshDossierTemplate(this._dossierTemplatesService.activeDossierTemplateId);
|
||||||
await this._loadData();
|
await this._loadData();
|
||||||
}
|
}
|
||||||
@ -142,9 +142,9 @@ export class FileAttributesListingScreenComponent extends ListingComponent<FileA
|
|||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await this._fileAttributesService
|
const response = await firstValueFrom(
|
||||||
.getFileAttributesConfig(this._dossierTemplatesService.activeDossierTemplateId)
|
this._fileAttributesService.getFileAttributesConfig(this._dossierTemplatesService.activeDossierTemplateId),
|
||||||
.toPromise();
|
);
|
||||||
this._existingConfiguration = response;
|
this._existingConfiguration = response;
|
||||||
const fileAttributeConfig = response?.fileAttributeConfigs.map(item => new FileAttributeConfig(item)) || [];
|
const fileAttributeConfig = response?.fileAttributeConfigs.map(item => new FileAttributeConfig(item)) || [];
|
||||||
this.entitiesService.setEntities(fileAttributeConfig);
|
this.entitiesService.setEntities(fileAttributeConfig);
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import { GeneralSettingsService } from '@services/general-settings.service';
|
|||||||
import { IGeneralConfiguration } from '@red/domain';
|
import { IGeneralConfiguration } from '@red/domain';
|
||||||
import { ConfigService } from '@services/config.service';
|
import { ConfigService } from '@services/config.service';
|
||||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-general-config-form',
|
selector: 'redaction-general-config-form',
|
||||||
@ -11,8 +12,8 @@ import { FormBuilder, FormGroup } from '@angular/forms';
|
|||||||
styleUrls: ['./general-config-form.component.scss'],
|
styleUrls: ['./general-config-form.component.scss'],
|
||||||
})
|
})
|
||||||
export class GeneralConfigFormComponent extends AutoUnsubscribe implements OnInit, OnDestroy {
|
export class GeneralConfigFormComponent extends AutoUnsubscribe implements OnInit, OnDestroy {
|
||||||
private _initialConfiguration: IGeneralConfiguration;
|
|
||||||
readonly form: FormGroup = this._getForm();
|
readonly form: FormGroup = this._getForm();
|
||||||
|
private _initialConfiguration: IGeneralConfiguration;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly _loadingService: LoadingService,
|
private readonly _loadingService: LoadingService,
|
||||||
@ -23,28 +24,6 @@ export class GeneralConfigFormComponent extends AutoUnsubscribe implements OnIni
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
private _getForm(): FormGroup {
|
|
||||||
return this._formBuilder.group({
|
|
||||||
forgotPasswordFunctionEnabled: [false],
|
|
||||||
auxiliaryName: [undefined],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async ngOnInit(): Promise<void> {
|
|
||||||
await this._loadData();
|
|
||||||
}
|
|
||||||
|
|
||||||
async saveGeneralConfig() {
|
|
||||||
this._loadingService.start();
|
|
||||||
|
|
||||||
const configFormValues = this.form.getRawValue();
|
|
||||||
|
|
||||||
await this._generalSettingsService.updateGeneralConfigurations(configFormValues).toPromise();
|
|
||||||
this._initialConfiguration = await this._generalSettingsService.getGeneralConfigurations().toPromise();
|
|
||||||
this._configService.updateDisplayName(this._initialConfiguration.displayName);
|
|
||||||
this._loadingService.stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
get generalConfigurationChanged(): boolean {
|
get generalConfigurationChanged(): boolean {
|
||||||
if (!this._initialConfiguration) {
|
if (!this._initialConfiguration) {
|
||||||
return true;
|
return true;
|
||||||
@ -59,10 +38,32 @@ export class GeneralConfigFormComponent extends AutoUnsubscribe implements OnIni
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async ngOnInit(): Promise<void> {
|
||||||
|
await this._loadData();
|
||||||
|
}
|
||||||
|
|
||||||
|
async saveGeneralConfig() {
|
||||||
|
this._loadingService.start();
|
||||||
|
|
||||||
|
const configFormValues = this.form.getRawValue();
|
||||||
|
|
||||||
|
await firstValueFrom(this._generalSettingsService.updateGeneralConfigurations(configFormValues));
|
||||||
|
this._initialConfiguration = await firstValueFrom(this._generalSettingsService.getGeneralConfigurations());
|
||||||
|
this._configService.updateDisplayName(this._initialConfiguration.displayName);
|
||||||
|
this._loadingService.stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
private _getForm(): FormGroup {
|
||||||
|
return this._formBuilder.group({
|
||||||
|
forgotPasswordFunctionEnabled: [false],
|
||||||
|
auxiliaryName: [undefined],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private async _loadData() {
|
private async _loadData() {
|
||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
try {
|
try {
|
||||||
this._initialConfiguration = await this._generalSettingsService.getGeneralConfigurations().toPromise();
|
this._initialConfiguration = await firstValueFrom(this._generalSettingsService.getGeneralConfigurations());
|
||||||
this.form.patchValue(this._initialConfiguration, { emitEvent: false });
|
this.form.patchValue(this._initialConfiguration, { emitEvent: false });
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
|
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import { AutoUnsubscribe, IconButtonTypes, LoadingService, Toaster } from '@iqse
|
|||||||
import { AdminDialogService } from '../../../services/admin-dialog.service';
|
import { AdminDialogService } from '../../../services/admin-dialog.service';
|
||||||
import { SmtpConfigService } from '../../../services/smtp-config.service';
|
import { SmtpConfigService } from '../../../services/smtp-config.service';
|
||||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-smtp-form',
|
selector: 'redaction-smtp-form',
|
||||||
@ -13,8 +14,8 @@ import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
|||||||
})
|
})
|
||||||
export class SmtpFormComponent extends AutoUnsubscribe implements OnInit, OnDestroy {
|
export class SmtpFormComponent extends AutoUnsubscribe implements OnInit, OnDestroy {
|
||||||
readonly iconButtonTypes = IconButtonTypes;
|
readonly iconButtonTypes = IconButtonTypes;
|
||||||
private _initialConfiguration: ISmtpConfiguration;
|
|
||||||
readonly form: FormGroup = this._getForm();
|
readonly form: FormGroup = this._getForm();
|
||||||
|
private _initialConfiguration: ISmtpConfiguration;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly _formBuilder: FormBuilder,
|
private readonly _formBuilder: FormBuilder,
|
||||||
@ -31,10 +32,53 @@ export class SmtpFormComponent extends AutoUnsubscribe implements OnInit, OnDest
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get smtpConfigurationChanged(): boolean {
|
||||||
|
if (!this._initialConfiguration) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const key of Object.keys(this.form.getRawValue())) {
|
||||||
|
if (this._initialConfiguration[key] !== this.form.get(key).value) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
async ngOnInit(): Promise<void> {
|
async ngOnInit(): Promise<void> {
|
||||||
await this._loadData();
|
await this._loadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
openAuthConfigDialog(skipDisableOnCancel?: boolean) {
|
||||||
|
this._dialogService.openDialog('smtpAuthConfig', null, this.form.getRawValue(), null, authConfig => {
|
||||||
|
if (authConfig) {
|
||||||
|
this.form.patchValue(authConfig);
|
||||||
|
} else if (!skipDisableOnCancel) {
|
||||||
|
this.form.patchValue({ auth: false }, { emitEvent: false });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async save() {
|
||||||
|
this._loadingService.start();
|
||||||
|
await firstValueFrom(this._smtpConfigService.updateSMTPConfiguration(this.form.getRawValue()));
|
||||||
|
this._initialConfiguration = this.form.getRawValue();
|
||||||
|
this._loadingService.stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
async testConnection() {
|
||||||
|
this._loadingService.start();
|
||||||
|
try {
|
||||||
|
await firstValueFrom(this._smtpConfigService.testSMTPConfiguration(this.form.getRawValue()));
|
||||||
|
this._toaster.success(_('general-config-screen.test.success'));
|
||||||
|
} catch (e) {
|
||||||
|
this._toaster.error(_('general-config-screen.test.error'));
|
||||||
|
} finally {
|
||||||
|
this._loadingService.stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private _getForm(): FormGroup {
|
private _getForm(): FormGroup {
|
||||||
return this._formBuilder.group({
|
return this._formBuilder.group({
|
||||||
host: [undefined, Validators.required],
|
host: [undefined, Validators.required],
|
||||||
@ -52,54 +96,11 @@ export class SmtpFormComponent extends AutoUnsubscribe implements OnInit, OnDest
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
openAuthConfigDialog(skipDisableOnCancel?: boolean) {
|
|
||||||
this._dialogService.openDialog('smtpAuthConfig', null, this.form.getRawValue(), null, authConfig => {
|
|
||||||
if (authConfig) {
|
|
||||||
this.form.patchValue(authConfig);
|
|
||||||
} else if (!skipDisableOnCancel) {
|
|
||||||
this.form.patchValue({ auth: false }, { emitEvent: false });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async save() {
|
|
||||||
this._loadingService.start();
|
|
||||||
await this._smtpConfigService.updateSMTPConfiguration(this.form.getRawValue()).toPromise();
|
|
||||||
this._initialConfiguration = this.form.getRawValue();
|
|
||||||
this._loadingService.stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
get smtpConfigurationChanged(): boolean {
|
|
||||||
if (!this._initialConfiguration) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const key of Object.keys(this.form.getRawValue())) {
|
|
||||||
if (this._initialConfiguration[key] !== this.form.get(key).value) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
async testConnection() {
|
|
||||||
this._loadingService.start();
|
|
||||||
try {
|
|
||||||
await this._smtpConfigService.testSMTPConfiguration(this.form.getRawValue()).toPromise();
|
|
||||||
this._toaster.success(_('general-config-screen.test.success'));
|
|
||||||
} catch (e) {
|
|
||||||
this._toaster.error(_('general-config-screen.test.error'));
|
|
||||||
} finally {
|
|
||||||
this._loadingService.stop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async _loadData() {
|
private async _loadData() {
|
||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this._initialConfiguration = await this._smtpConfigService.getCurrentSMTPConfiguration().toPromise();
|
this._initialConfiguration = await firstValueFrom(this._smtpConfigService.getCurrentSMTPConfiguration());
|
||||||
this.form.patchValue(this._initialConfiguration, { emitEvent: false });
|
this.form.patchValue(this._initialConfiguration, { emitEvent: false });
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
|
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import { Justification } from '@red/domain';
|
|||||||
import { JustificationsService } from '@services/entity-services/justifications.service';
|
import { JustificationsService } from '@services/entity-services/justifications.service';
|
||||||
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
|
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
|
||||||
import { LoadingService } from '@iqser/common-ui';
|
import { LoadingService } from '@iqser/common-ui';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-add-edit-justification-dialog',
|
selector: 'redaction-add-edit-justification-dialog',
|
||||||
@ -35,8 +36,8 @@ export class AddEditJustificationDialogComponent {
|
|||||||
const dossierTemplateId = this._dossierTemplatesService.activeDossierTemplateId;
|
const dossierTemplateId = this._dossierTemplatesService.activeDossierTemplateId;
|
||||||
|
|
||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
await this._justificationService.createOrUpdate(this.form.getRawValue(), dossierTemplateId).toPromise();
|
await firstValueFrom(this._justificationService.createOrUpdate(this.form.getRawValue(), dossierTemplateId));
|
||||||
await this._justificationService.loadAll(dossierTemplateId).toPromise();
|
await firstValueFrom(this._justificationService.loadAll(dossierTemplateId));
|
||||||
this._loadingService.stop();
|
this._loadingService.stop();
|
||||||
this.dialogRef.close(true);
|
this.dialogRef.close(true);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,6 +13,7 @@ import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
|||||||
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
|
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
|
||||||
import { JustificationsService } from '@services/entity-services/justifications.service';
|
import { JustificationsService } from '@services/entity-services/justifications.service';
|
||||||
import { Justification } from '@red/domain';
|
import { Justification } from '@red/domain';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
type DialogType = 'confirm' | 'addEditJustification';
|
type DialogType = 'confirm' | 'addEditJustification';
|
||||||
|
|
||||||
@ -51,8 +52,8 @@ export class JustificationsDialogService extends DialogService<DialogType> {
|
|||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
const dossierTemplateId = this._dossierTemplatesService.activeDossierTemplateId;
|
const dossierTemplateId = this._dossierTemplatesService.activeDossierTemplateId;
|
||||||
const justificationIds = justifications.map(j => j.id);
|
const justificationIds = justifications.map(j => j.id);
|
||||||
await this._justificationService.delete(justificationIds, dossierTemplateId).toPromise();
|
await firstValueFrom(this._justificationService.delete(justificationIds, dossierTemplateId));
|
||||||
await this._justificationService.loadAll(dossierTemplateId).toPromise();
|
await firstValueFrom(this._justificationService.loadAll(dossierTemplateId));
|
||||||
this._loadingService.stop();
|
this._loadingService.stop();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,6 +15,7 @@ import { DossierTemplatesService } from '@services/entity-services/dossier-templ
|
|||||||
import { JustificationsDialogService } from '../justifications-dialog.service';
|
import { JustificationsDialogService } from '../justifications-dialog.service';
|
||||||
import { UserService } from '@services/user.service';
|
import { UserService } from '@services/user.service';
|
||||||
import { UserPreferenceService } from '@services/user-preference.service';
|
import { UserPreferenceService } from '@services/user-preference.service';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-justifications-screen',
|
selector: 'redaction-justifications-screen',
|
||||||
@ -52,7 +53,7 @@ export class JustificationsScreenComponent extends ListingComponent<Justificatio
|
|||||||
|
|
||||||
async ngOnInit(): Promise<void> {
|
async ngOnInit(): Promise<void> {
|
||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
await this._justificationService.loadAll(this._dossierTemplatesService.activeDossierTemplateId).toPromise();
|
await firstValueFrom(this._justificationService.loadAll(this._dossierTemplatesService.activeDossierTemplateId));
|
||||||
this._loadingService.stop();
|
this._loadingService.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import { RouterHistoryService } from '@services/router-history.service';
|
|||||||
import { LicenseReportService } from '../../services/licence-report.service';
|
import { LicenseReportService } from '../../services/licence-report.service';
|
||||||
import { ILicenseReport } from '@red/domain';
|
import { ILicenseReport } from '@red/domain';
|
||||||
import { Color, ScaleType } from '@swimlane/ngx-charts';
|
import { Color, ScaleType } from '@swimlane/ngx-charts';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-license-information-screen',
|
selector: 'redaction-license-information-screen',
|
||||||
@ -72,15 +73,15 @@ export class LicenseInformationScreenComponent implements OnInit {
|
|||||||
endDate: endDate.toDate(),
|
endDate: endDate.toDate(),
|
||||||
};
|
};
|
||||||
const promises = [
|
const promises = [
|
||||||
this._licenseReportService.licenseReport(currentConfig).toPromise(),
|
firstValueFrom(this._licenseReportService.licenseReport(currentConfig)),
|
||||||
this._licenseReportService.licenseReport({}).toPromise(),
|
firstValueFrom(this._licenseReportService.licenseReport({})),
|
||||||
];
|
];
|
||||||
|
|
||||||
if (endDate.isBefore(moment())) {
|
if (endDate.isBefore(moment())) {
|
||||||
const unlicensedConfig = {
|
const unlicensedConfig = {
|
||||||
startDate: endDate.toDate(),
|
startDate: endDate.toDate(),
|
||||||
};
|
};
|
||||||
promises.push(this._licenseReportService.licenseReport(unlicensedConfig).toPromise());
|
promises.push(firstValueFrom(this._licenseReportService.licenseReport(unlicensedConfig)));
|
||||||
}
|
}
|
||||||
|
|
||||||
Promise.all(promises).then(reports => {
|
Promise.all(promises).then(reports => {
|
||||||
@ -135,12 +136,12 @@ export class LicenseInformationScreenComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
promises.push(
|
promises.push(
|
||||||
this._licenseReportService
|
firstValueFrom(
|
||||||
.licenseReport({
|
this._licenseReportService.licenseReport({
|
||||||
startDate: moment(`01-${m + 1}-${y}`, 'DD-MM-YYYY').toDate(),
|
startDate: moment(`01-${m + 1}-${y}`, 'DD-MM-YYYY').toDate(),
|
||||||
endDate: moment(`01-${nm + 1}-${ny}`, 'DD-MM-YYYY').toDate(),
|
endDate: moment(`01-${nm + 1}-${ny}`, 'DD-MM-YYYY').toDate(),
|
||||||
})
|
}),
|
||||||
.toPromise(),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
y = ny;
|
y = ny;
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
|||||||
import { AdminDialogService } from '../../services/admin-dialog.service';
|
import { AdminDialogService } from '../../services/admin-dialog.service';
|
||||||
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
|
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
|
||||||
import { ReportTemplateService } from '@services/report-template.service';
|
import { ReportTemplateService } from '@services/report-template.service';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
interface Placeholder {
|
interface Placeholder {
|
||||||
placeholder: string;
|
placeholder: string;
|
||||||
@ -56,9 +57,9 @@ export class ReportsScreenComponent implements OnInit {
|
|||||||
async download(template: IReportTemplate) {
|
async download(template: IReportTemplate) {
|
||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
try {
|
try {
|
||||||
const data = await this._reportTemplateService
|
const data = await firstValueFrom(
|
||||||
.downloadReportTemplate(template.dossierTemplateId, template.templateId, 'response')
|
this._reportTemplateService.downloadReportTemplate(template.dossierTemplateId, template.templateId, 'response'),
|
||||||
.toPromise();
|
);
|
||||||
this._loadingService.stop();
|
this._loadingService.stop();
|
||||||
download(data, template.fileName);
|
download(data, template.fileName);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -130,31 +131,31 @@ export class ReportsScreenComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
this._dialogService.openDialog('confirm', null, data, null, async result => {
|
this._dialogService.openDialog('confirm', null, data, null, async result => {
|
||||||
if (result) {
|
if (result) {
|
||||||
await this._reportTemplateService.uploadTemplateForm(dossierTemplateId, result > 1, file).toPromise();
|
await firstValueFrom(this._reportTemplateService.uploadTemplateForm(dossierTemplateId, result > 1, file));
|
||||||
await this._loadReportTemplates();
|
await this._loadReportTemplates();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
await this._reportTemplateService.uploadTemplateForm(dossierTemplateId, false, file).toPromise();
|
await firstValueFrom(this._reportTemplateService.uploadTemplateForm(dossierTemplateId, false, file));
|
||||||
await this._loadReportTemplates();
|
await this._loadReportTemplates();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _deleteTemplate(template: IReportTemplate) {
|
private async _deleteTemplate(template: IReportTemplate) {
|
||||||
await this._reportTemplateService.delete(template.dossierTemplateId, template.templateId).toPromise();
|
await firstValueFrom(this._reportTemplateService.delete(template.dossierTemplateId, template.templateId));
|
||||||
await this._loadReportTemplates();
|
await this._loadReportTemplates();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _loadReportTemplates() {
|
private async _loadReportTemplates() {
|
||||||
this.availableTemplates = await this._reportTemplateService
|
this.availableTemplates = await firstValueFrom(
|
||||||
.getAvailableReportTemplates(this._dossierTemplatesService.activeDossierTemplateId)
|
this._reportTemplateService.getAvailableReportTemplates(this._dossierTemplatesService.activeDossierTemplateId),
|
||||||
.toPromise();
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _loadPlaceholders() {
|
private async _loadPlaceholders() {
|
||||||
const placeholdersResponse: IPlaceholdersResponse = await this._reportTemplateService
|
const placeholdersResponse: IPlaceholdersResponse = await firstValueFrom(
|
||||||
.getAvailablePlaceholders(this._dossierTemplatesService.activeDossierTemplateId)
|
this._reportTemplateService.getAvailablePlaceholders(this._dossierTemplatesService.activeDossierTemplateId),
|
||||||
.toPromise();
|
);
|
||||||
this.placeholders = placeholderTypes.flatMap(type =>
|
this.placeholders = placeholderTypes.flatMap(type =>
|
||||||
placeholdersResponse[type].map(placeholder => ({
|
placeholdersResponse[type].map(placeholder => ({
|
||||||
placeholder,
|
placeholder,
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import { ComponentHasChanges } from '@guards/can-deactivate.guard';
|
|||||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||||
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
|
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
|
||||||
import { RulesService } from '../../services/rules.service';
|
import { RulesService } from '../../services/rules.service';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
import ICodeEditor = monaco.editor.ICodeEditor;
|
import ICodeEditor = monaco.editor.ICodeEditor;
|
||||||
import IModelDeltaDecoration = monaco.editor.IModelDeltaDecoration;
|
import IModelDeltaDecoration = monaco.editor.IModelDeltaDecoration;
|
||||||
import IStandaloneEditorConstructionOptions = monaco.editor.IStandaloneEditorConstructionOptions;
|
import IStandaloneEditorConstructionOptions = monaco.editor.IStandaloneEditorConstructionOptions;
|
||||||
@ -87,22 +88,21 @@ export class RulesScreenComponent extends ComponentHasChanges implements OnInit
|
|||||||
|
|
||||||
async save(): Promise<void> {
|
async save(): Promise<void> {
|
||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
await this._rulesService
|
await firstValueFrom(
|
||||||
.uploadRules({
|
this._rulesService.uploadRules({
|
||||||
rules: this._codeEditor.getModel().getValue(),
|
rules: this._codeEditor.getModel().getValue(),
|
||||||
dossierTemplateId: this._dossierTemplatesService.activeDossierTemplateId,
|
dossierTemplateId: this._dossierTemplatesService.activeDossierTemplateId,
|
||||||
})
|
}),
|
||||||
.toPromise()
|
).then(
|
||||||
.then(
|
async () => {
|
||||||
async () => {
|
await this._initialize();
|
||||||
await this._initialize();
|
this._toaster.success(_('rules-screen.success.generic'));
|
||||||
this._toaster.success(_('rules-screen.success.generic'));
|
},
|
||||||
},
|
() => {
|
||||||
() => {
|
this._loadingService.stop();
|
||||||
this._loadingService.stop();
|
this._toaster.error(_('rules-screen.error.generic'));
|
||||||
this._toaster.error(_('rules-screen.error.generic'));
|
},
|
||||||
},
|
);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
revert(): void {
|
revert(): void {
|
||||||
@ -148,15 +148,12 @@ export class RulesScreenComponent extends ComponentHasChanges implements OnInit
|
|||||||
|
|
||||||
private async _initialize() {
|
private async _initialize() {
|
||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
await this._rulesService
|
await firstValueFrom(this._rulesService.download(this._dossierTemplatesService.activeDossierTemplateId)).then(
|
||||||
.download(this._dossierTemplatesService.activeDossierTemplateId)
|
rules => {
|
||||||
.toPromise()
|
this.currentLines = this.initialLines = rules.rules.split('\n');
|
||||||
.then(
|
this.revert();
|
||||||
rules => {
|
},
|
||||||
this.currentLines = this.initialLines = rules.rules.split('\n');
|
() => this._loadingService.stop(),
|
||||||
this.revert();
|
);
|
||||||
},
|
|
||||||
() => this._loadingService.stop(),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,7 +14,7 @@ import {
|
|||||||
NestedFilter,
|
NestedFilter,
|
||||||
TableColumnConfig,
|
TableColumnConfig,
|
||||||
} from '@iqser/common-ui';
|
} from '@iqser/common-ui';
|
||||||
import { Observable } from 'rxjs';
|
import { firstValueFrom, Observable } from 'rxjs';
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
import { rolesTranslations } from '../../../../translations/roles-translations';
|
import { rolesTranslations } from '../../../../translations/roles-translations';
|
||||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||||
@ -96,7 +96,7 @@ export class UserListingScreenComponent extends ListingComponent<User> implement
|
|||||||
async toggleActive(user: User) {
|
async toggleActive(user: User) {
|
||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
const requestBody = { ...user, roles: user.isActive ? [] : ['RED_USER'] };
|
const requestBody = { ...user, roles: user.isActive ? [] : ['RED_USER'] };
|
||||||
await this.userService.updateProfile(requestBody, user.id).toPromise();
|
await firstValueFrom(this.userService.updateProfile(requestBody, user.id));
|
||||||
await this._loadData();
|
await this._loadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ export class UserListingScreenComponent extends ListingComponent<User> implement
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async _loadData() {
|
private async _loadData() {
|
||||||
await this.userService.loadAll().toPromise();
|
await firstValueFrom(this.userService.loadAll());
|
||||||
this._computeStats();
|
this._computeStats();
|
||||||
this._loadingService.stop();
|
this._loadingService.stop();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import { stampPDFPage } from '@utils/page-stamper';
|
|||||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||||
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
|
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
|
||||||
import { WatermarkService } from '@shared/services/watermark.service';
|
import { WatermarkService } from '@shared/services/watermark.service';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
export const DEFAULT_WATERMARK: IWatermark = {
|
export const DEFAULT_WATERMARK: IWatermark = {
|
||||||
text: null,
|
text: null,
|
||||||
@ -80,7 +81,7 @@ export class WatermarkScreenComponent implements OnInit {
|
|||||||
? this._watermarkService.saveWatermark(watermark, dossierTemplateId)
|
? this._watermarkService.saveWatermark(watermark, dossierTemplateId)
|
||||||
: this._watermarkService.deleteWatermark(dossierTemplateId);
|
: this._watermarkService.deleteWatermark(dossierTemplateId);
|
||||||
|
|
||||||
observable.toPromise().then(
|
firstValueFrom(observable).then(
|
||||||
() => {
|
() => {
|
||||||
this._loadWatermark();
|
this._loadWatermark();
|
||||||
this._toaster.success(
|
this._toaster.success(
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import { UserService } from '@services/user.service';
|
|||||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||||
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
|
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
|
||||||
import { HttpStatusCode } from '@angular/common/http';
|
import { HttpStatusCode } from '@angular/common/http';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-dossier-template-actions',
|
selector: 'redaction-dossier-template-actions',
|
||||||
@ -45,11 +46,9 @@ export class DossierTemplateActionsComponent implements OnInit {
|
|||||||
this._dialogService.openDialog('confirm', $event, null, async () => {
|
this._dialogService.openDialog('confirm', $event, null, async () => {
|
||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
|
|
||||||
await this._dossierTemplatesService
|
await firstValueFrom(this._dossierTemplatesService.delete([this.dossierTemplateId]))
|
||||||
.delete([this.dossierTemplateId])
|
|
||||||
.toPromise()
|
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
await this._dossierTemplatesService.loadAll().toPromise();
|
await firstValueFrom(this._dossierTemplatesService.loadAll());
|
||||||
await this._appStateService.loadDictionaryData();
|
await this._appStateService.loadDictionaryData();
|
||||||
await this._router.navigate(['main', 'admin']);
|
await this._router.navigate(['main', 'admin']);
|
||||||
})
|
})
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import { HttpClientModule } from '@angular/common/http';
|
|||||||
import { KeycloakAngularModule, KeycloakOptions, KeycloakService } from 'keycloak-angular';
|
import { KeycloakAngularModule, KeycloakOptions, KeycloakService } from 'keycloak-angular';
|
||||||
import { ConfigService } from '@services/config.service';
|
import { ConfigService } from '@services/config.service';
|
||||||
import { BASE_HREF } from '../../tokens';
|
import { BASE_HREF } from '../../tokens';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
function getKeycloakOptions(configService: ConfigService, baseUrl: string) {
|
function getKeycloakOptions(configService: ConfigService, baseUrl: string) {
|
||||||
let url: string = configService.values.OAUTH_URL;
|
let url: string = configService.values.OAUTH_URL;
|
||||||
@ -36,14 +37,11 @@ function configureAutomaticRedirectToLoginScreen(keyCloakService: KeycloakServic
|
|||||||
|
|
||||||
export function keycloakInitializer(keycloakService: KeycloakService, configService: ConfigService, baseUrl: string): () => Promise<void> {
|
export function keycloakInitializer(keycloakService: KeycloakService, configService: ConfigService, baseUrl: string): () => Promise<void> {
|
||||||
return () =>
|
return () =>
|
||||||
configService
|
firstValueFrom(configService.loadAppConfig()).then(() =>
|
||||||
.loadAppConfig()
|
keycloakService
|
||||||
.toPromise()
|
.init(getKeycloakOptions(configService, baseUrl))
|
||||||
.then(() =>
|
.then(() => configureAutomaticRedirectToLoginScreen(keycloakService)),
|
||||||
keycloakService
|
);
|
||||||
.init(getKeycloakOptions(configService, baseUrl))
|
|
||||||
.then(() => configureAutomaticRedirectToLoginScreen(keycloakService)),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import { BaseDialogComponent, IconButtonTypes, SaveOptions } from '@iqser/common
|
|||||||
import { DossiersService } from '@services/entity-services/dossiers.service';
|
import { DossiersService } from '@services/entity-services/dossiers.service';
|
||||||
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
|
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
|
||||||
import { ReportTemplateService } from '@services/report-template.service';
|
import { ReportTemplateService } from '@services/report-template.service';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: './add-dossier-dialog.component.html',
|
templateUrl: './add-dossier-dialog.component.html',
|
||||||
@ -38,27 +39,6 @@ export class AddDossierDialogComponent extends BaseDialogComponent {
|
|||||||
this.initialFormValue = this.form.getRawValue();
|
this.initialFormValue = this.form.getRawValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
private _getForm(): FormGroup {
|
|
||||||
return this._formBuilder.group(
|
|
||||||
{
|
|
||||||
dossierName: [null, Validators.required],
|
|
||||||
dossierTemplateId: [null, Validators.required],
|
|
||||||
downloadFileTypes: [null],
|
|
||||||
reportTemplateIds: [null],
|
|
||||||
description: [null],
|
|
||||||
dueDate: [null],
|
|
||||||
watermarkEnabled: [true],
|
|
||||||
watermarkPreviewEnabled: [false],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
validators: control =>
|
|
||||||
control.value.reportTemplateIds?.length > 0 || control.value.downloadFileTypes?.length > 0
|
|
||||||
? null
|
|
||||||
: { downloadPackage: true },
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
get reportTemplateIdsLength() {
|
get reportTemplateIdsLength() {
|
||||||
return this.form.controls['reportTemplateIds']?.value?.length || 0;
|
return this.form.controls['reportTemplateIds']?.value?.length || 0;
|
||||||
}
|
}
|
||||||
@ -78,7 +58,7 @@ export class AddDossierDialogComponent extends BaseDialogComponent {
|
|||||||
reportTemplateValueMapper = (reportTemplate: IReportTemplate) => reportTemplate.templateId;
|
reportTemplateValueMapper = (reportTemplate: IReportTemplate) => reportTemplate.templateId;
|
||||||
|
|
||||||
async save(options?: SaveOptions) {
|
async save(options?: SaveOptions) {
|
||||||
const savedDossier = await this._dossiersService.createOrUpdate(this._formToObject()).toPromise();
|
const savedDossier = await firstValueFrom(this._dossiersService.createOrUpdate(this._formToObject()));
|
||||||
if (savedDossier) {
|
if (savedDossier) {
|
||||||
this._dialogRef.close({ dossier: savedDossier, addMembers: options?.addMembers });
|
this._dialogRef.close({ dossier: savedDossier, addMembers: options?.addMembers });
|
||||||
}
|
}
|
||||||
@ -90,7 +70,7 @@ export class AddDossierDialogComponent extends BaseDialogComponent {
|
|||||||
|
|
||||||
if (dossierTemplate) {
|
if (dossierTemplate) {
|
||||||
this.availableReportTypes =
|
this.availableReportTypes =
|
||||||
(await this._reportTemplateController.getAvailableReportTemplates(dossierTemplate.dossierTemplateId).toPromise()) || [];
|
(await firstValueFrom(this._reportTemplateController.getAvailableReportTemplates(dossierTemplate.dossierTemplateId))) || [];
|
||||||
// update dropdown values
|
// update dropdown values
|
||||||
this.form.patchValue(
|
this.form.patchValue(
|
||||||
{
|
{
|
||||||
@ -111,6 +91,27 @@ export class AddDossierDialogComponent extends BaseDialogComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _getForm(): FormGroup {
|
||||||
|
return this._formBuilder.group(
|
||||||
|
{
|
||||||
|
dossierName: [null, Validators.required],
|
||||||
|
dossierTemplateId: [null, Validators.required],
|
||||||
|
downloadFileTypes: [null],
|
||||||
|
reportTemplateIds: [null],
|
||||||
|
description: [null],
|
||||||
|
dueDate: [null],
|
||||||
|
watermarkEnabled: [true],
|
||||||
|
watermarkPreviewEnabled: [false],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
validators: control =>
|
||||||
|
control.value.reportTemplateIds?.length > 0 || control.value.downloadFileTypes?.length > 0
|
||||||
|
? null
|
||||||
|
: { downloadPackage: true },
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
private _getDossierTemplates() {
|
private _getDossierTemplates() {
|
||||||
this.dossierTemplates = this._dossierTemplatesService.all
|
this.dossierTemplates = this._dossierTemplatesService.all
|
||||||
.filter(r => {
|
.filter(r => {
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
|||||||
import { FilesService } from '@services/entity-services/files.service';
|
import { FilesService } from '@services/entity-services/files.service';
|
||||||
import { DossiersService } from '@services/entity-services/dossiers.service';
|
import { DossiersService } from '@services/entity-services/dossiers.service';
|
||||||
import { PermissionsService } from '@services/permissions.service';
|
import { PermissionsService } from '@services/permissions.service';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
class DialogData {
|
class DialogData {
|
||||||
mode: 'approver' | 'reviewer';
|
mode: 'approver' | 'reviewer';
|
||||||
@ -101,28 +102,28 @@ export class AssignReviewerApproverDialogComponent {
|
|||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
try {
|
try {
|
||||||
if (!this.selectedUser) {
|
if (!this.selectedUser) {
|
||||||
await this._filesService
|
await firstValueFrom(
|
||||||
.setUnassigned(
|
this._filesService.setUnassigned(
|
||||||
this.data.files.map(f => f.fileId),
|
this.data.files.map(f => f.fileId),
|
||||||
this.dossier.id,
|
this.dossier.id,
|
||||||
)
|
),
|
||||||
.toPromise();
|
);
|
||||||
} else if (this.data.mode === 'reviewer') {
|
} else if (this.data.mode === 'reviewer') {
|
||||||
await this._filesService
|
await firstValueFrom(
|
||||||
.setReviewerFor(
|
this._filesService.setReviewerFor(
|
||||||
this.data.files.map(f => f.fileId),
|
this.data.files.map(f => f.fileId),
|
||||||
this.dossier.id,
|
this.dossier.id,
|
||||||
this.selectedUser,
|
this.selectedUser,
|
||||||
)
|
),
|
||||||
.toPromise();
|
);
|
||||||
} else {
|
} else {
|
||||||
await this._filesService
|
await firstValueFrom(
|
||||||
.setUnderApprovalFor(
|
this._filesService.setUnderApprovalFor(
|
||||||
this.data.files.map(f => f.fileId),
|
this.data.files.map(f => f.fileId),
|
||||||
this.dossier.id,
|
this.dossier.id,
|
||||||
this.selectedUser,
|
this.selectedUser,
|
||||||
)
|
),
|
||||||
.toPromise();
|
);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this._toaster.error(_('error.http.generic'), { params: error });
|
this._toaster.error(_('error.http.generic'), { params: error });
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import { DossiersService } from '@services/entity-services/dossiers.service';
|
|||||||
import { JustificationsService } from '@services/entity-services/justifications.service';
|
import { JustificationsService } from '@services/entity-services/justifications.service';
|
||||||
import { Dossier } from '@red/domain';
|
import { Dossier } from '@red/domain';
|
||||||
import { BaseDialogComponent } from '@iqser/common-ui';
|
import { BaseDialogComponent } from '@iqser/common-ui';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
export interface LegalBasisOption {
|
export interface LegalBasisOption {
|
||||||
label?: string;
|
label?: string;
|
||||||
@ -40,7 +41,7 @@ export class ChangeLegalBasisDialogComponent extends BaseDialogComponent impleme
|
|||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
super.ngOnInit();
|
super.ngOnInit();
|
||||||
const data = await this._justificationsService.getForDossierTemplate(this._data.dossier.dossierTemplateId).toPromise();
|
const data = await firstValueFrom(this._justificationsService.getForDossierTemplate(this._data.dossier.dossierTemplateId));
|
||||||
|
|
||||||
this.legalOptions = data
|
this.legalOptions = data
|
||||||
.map<LegalBasisOption>(lbm => ({
|
.map<LegalBasisOption>(lbm => ({
|
||||||
@ -56,6 +57,15 @@ export class ChangeLegalBasisDialogComponent extends BaseDialogComponent impleme
|
|||||||
this.initialFormValue = this.form.getRawValue();
|
this.initialFormValue = this.form.getRawValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
save() {
|
||||||
|
this._dialogRef.close({
|
||||||
|
legalBasis: this.form.get('reason').value.legalBasis,
|
||||||
|
section: this.form.get('section').value,
|
||||||
|
comment: this.form.get('comment').value,
|
||||||
|
value: this.form.get('classification').value,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private _getForm(): FormGroup {
|
private _getForm(): FormGroup {
|
||||||
this.isDocumentAdmin = this._permissionsService.isApprover(this._data.dossier);
|
this.isDocumentAdmin = this._permissionsService.isApprover(this._data.dossier);
|
||||||
return this._formBuilder.group({
|
return this._formBuilder.group({
|
||||||
@ -65,13 +75,4 @@ export class ChangeLegalBasisDialogComponent extends BaseDialogComponent impleme
|
|||||||
section: [this._data.annotations[0].section],
|
section: [this._data.annotations[0].section],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
save() {
|
|
||||||
this._dialogRef.close({
|
|
||||||
legalBasis: this.form.get('reason').value.legalBasis,
|
|
||||||
section: this.form.get('section').value,
|
|
||||||
comment: this.form.get('comment').value,
|
|
||||||
value: this.form.get('classification').value,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import { FileAttributesService } from '@services/entity-services/file-attributes
|
|||||||
import { DossiersService } from '@services/entity-services/dossiers.service';
|
import { DossiersService } from '@services/entity-services/dossiers.service';
|
||||||
import { FilesService } from '@services/entity-services/files.service';
|
import { FilesService } from '@services/entity-services/files.service';
|
||||||
import { BaseDialogComponent } from '@iqser/common-ui';
|
import { BaseDialogComponent } from '@iqser/common-ui';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: './document-info-dialog.component.html',
|
templateUrl: './document-info-dialog.component.html',
|
||||||
@ -33,7 +34,7 @@ export class DocumentInfoDialogComponent extends BaseDialogComponent implements
|
|||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
super.ngOnInit();
|
super.ngOnInit();
|
||||||
this.attributes = (
|
this.attributes = (
|
||||||
await this._fileAttributesService.getFileAttributesConfig(this._dossier.dossierTemplateId).toPromise()
|
await firstValueFrom(this._fileAttributesService.getFileAttributesConfig(this._dossier.dossierTemplateId))
|
||||||
).fileAttributeConfigs.filter(attr => attr.editable);
|
).fileAttributeConfigs.filter(attr => attr.editable);
|
||||||
this.form = this._getForm();
|
this.form = this._getForm();
|
||||||
this.initialFormValue = this.form.getRawValue();
|
this.initialFormValue = this.form.getRawValue();
|
||||||
@ -44,7 +45,7 @@ export class DocumentInfoDialogComponent extends BaseDialogComponent implements
|
|||||||
...this.data.fileAttributes?.attributeIdToValue,
|
...this.data.fileAttributes?.attributeIdToValue,
|
||||||
...this.form.getRawValue(),
|
...this.form.getRawValue(),
|
||||||
};
|
};
|
||||||
await this._fileAttributesService.setFileAttributes({ attributeIdToValue }, this.data.dossierId, this.data.fileId).toPromise();
|
await firstValueFrom(this._fileAttributesService.setFileAttributes({ attributeIdToValue }, this.data.dossierId, this.data.fileId));
|
||||||
this._filesService.reload(this.data.dossierId, this.data.fileId);
|
this._filesService.reload(this.data.dossierId, this.data.fileId);
|
||||||
this._dialogRef.close(true);
|
this._dialogRef.close(true);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import { FormBuilder, FormGroup } from '@angular/forms';
|
|||||||
import * as moment from 'moment';
|
import * as moment from 'moment';
|
||||||
import { DossierAttributesService } from '@shared/services/controller-wrappers/dossier-attributes.service';
|
import { DossierAttributesService } from '@shared/services/controller-wrappers/dossier-attributes.service';
|
||||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-edit-dossier-attributes',
|
selector: 'redaction-edit-dossier-attributes',
|
||||||
@ -72,7 +73,7 @@ export class EditDossierAttributesComponent implements EditDossierSectionInterfa
|
|||||||
: this.currentAttrValue(attr),
|
: this.currentAttrValue(attr),
|
||||||
}));
|
}));
|
||||||
try {
|
try {
|
||||||
await this._dossierAttributesService.setAttributes(this.dossier, dossierAttributeList).toPromise();
|
await firstValueFrom(this._dossierAttributesService.setAttributes(this.dossier, dossierAttributeList));
|
||||||
await this._loadAttributes();
|
await this._loadAttributes();
|
||||||
return { success: true };
|
return { success: true };
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@ -16,7 +16,7 @@ import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
|||||||
import * as moment from 'moment';
|
import * as moment from 'moment';
|
||||||
import { ConfigService } from '@services/config.service';
|
import { ConfigService } from '@services/config.service';
|
||||||
import { getLeftDateTime } from '@utils/functions';
|
import { getLeftDateTime } from '@utils/functions';
|
||||||
import { Observable, of } from 'rxjs';
|
import { firstValueFrom, Observable, of } from 'rxjs';
|
||||||
import { distinctUntilChanged, map } from 'rxjs/operators';
|
import { distinctUntilChanged, map } from 'rxjs/operators';
|
||||||
import { DossiersDialogService } from '../../../services/dossiers-dialog.service';
|
import { DossiersDialogService } from '../../../services/dossiers-dialog.service';
|
||||||
import { FilesService } from '@services/entity-services/files.service';
|
import { FilesService } from '@services/entity-services/files.service';
|
||||||
@ -107,7 +107,7 @@ export class EditDossierDeletedDocumentsComponent extends ListingComponent<FileL
|
|||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
const files = await this._filesService.getDeletedFilesFor(this.dossier.id).toPromise();
|
const files = await firstValueFrom(this._filesService.getDeletedFilesFor(this.dossier.id));
|
||||||
this.entitiesService.setEntities(this._toListItems(files));
|
this.entitiesService.setEntities(this._toListItems(files));
|
||||||
this.sortingService.setSortingOption({
|
this.sortingService.setSortingOption({
|
||||||
column: 'softDeleted',
|
column: 'softDeleted',
|
||||||
@ -119,7 +119,7 @@ export class EditDossierDeletedDocumentsComponent extends ListingComponent<FileL
|
|||||||
revert() {}
|
revert() {}
|
||||||
|
|
||||||
save(): EditDossierSaveResult {
|
save(): EditDossierSaveResult {
|
||||||
return of({ success: true }).toPromise();
|
return firstValueFrom(of({ success: true }));
|
||||||
}
|
}
|
||||||
|
|
||||||
restore(files = this.listingService.selected) {
|
restore(files = this.listingService.selected) {
|
||||||
@ -130,14 +130,14 @@ export class EditDossierDeletedDocumentsComponent extends ListingComponent<FileL
|
|||||||
|
|
||||||
private async _restore(files: FileListItem[]): Promise<void> {
|
private async _restore(files: FileListItem[]): Promise<void> {
|
||||||
const fileIds = files.map(f => f.fileId);
|
const fileIds = files.map(f => f.fileId);
|
||||||
await this._fileManagementService.restore(fileIds, this.dossier.id).toPromise();
|
await firstValueFrom(this._fileManagementService.restore(fileIds, this.dossier.id));
|
||||||
this._removeFromList(fileIds);
|
this._removeFromList(fileIds);
|
||||||
await this._filesService.loadAll(files[0].dossierId).toPromise();
|
await firstValueFrom(this._filesService.loadAll(files[0].dossierId));
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _hardDelete(files: FileListItem[]) {
|
private async _hardDelete(files: FileListItem[]) {
|
||||||
const fileIds = files.map(f => f.fileId);
|
const fileIds = files.map(f => f.fileId);
|
||||||
await this._fileManagementService.hardDelete(this.dossier.id, fileIds).toPromise();
|
await firstValueFrom(this._fileManagementService.hardDelete(this.dossier.id, fileIds));
|
||||||
this._removeFromList(fileIds);
|
this._removeFromList(fileIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,8 @@ import { DictionaryService } from '@shared/services/dictionary.service';
|
|||||||
import { CircleButtonTypes, LoadingService, Toaster } from '@iqser/common-ui';
|
import { CircleButtonTypes, LoadingService, Toaster } from '@iqser/common-ui';
|
||||||
import { DossiersService } from '@services/entity-services/dossiers.service';
|
import { DossiersService } from '@services/entity-services/dossiers.service';
|
||||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-edit-dossier-dictionary',
|
selector: 'redaction-edit-dossier-dictionary',
|
||||||
@ -67,9 +68,9 @@ export class EditDossierDictionaryComponent implements EditDossierSectionInterfa
|
|||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
// TODO: Setting the type manually shouldn't be necessary, but for now it fails with status code 500...
|
// TODO: Setting the type manually shouldn't be necessary, but for now it fails with status code 500...
|
||||||
const dictionary: IDictionary = { ...this.dossierDictionary, type: 'dossier_redaction', label };
|
const dictionary: IDictionary = { ...this.dossierDictionary, type: 'dossier_redaction', label };
|
||||||
await this._dictionaryService
|
await firstValueFrom(
|
||||||
.updateDictionary(dictionary, this.dossier.dossierTemplateId, 'dossier_redaction', this.dossier.id)
|
this._dictionaryService.updateDictionary(dictionary, this.dossier.dossierTemplateId, 'dossier_redaction', this.dossier.id),
|
||||||
.toPromise();
|
);
|
||||||
await this._updateDossierDictionary();
|
await this._updateDossierDictionary();
|
||||||
this._toaster.success(_('edit-dossier-dialog.dictionary.display-name.success'));
|
this._toaster.success(_('edit-dossier-dialog.dictionary.display-name.success'));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -85,20 +86,20 @@ export class EditDossierDictionaryComponent implements EditDossierSectionInterfa
|
|||||||
type: 'dossier_redaction',
|
type: 'dossier_redaction',
|
||||||
addToDictionaryAction: this.form.get('addToDictionaryAction').value,
|
addToDictionaryAction: this.form.get('addToDictionaryAction').value,
|
||||||
};
|
};
|
||||||
await this._dictionaryService
|
await firstValueFrom(
|
||||||
.updateDictionary(dictionary, this.dossier.dossierTemplateId, 'dossier_redaction', this.dossier.id)
|
this._dictionaryService.updateDictionary(dictionary, this.dossier.dossierTemplateId, 'dossier_redaction', this.dossier.id),
|
||||||
.toPromise();
|
);
|
||||||
|
|
||||||
await this._dictionaryService
|
await firstValueFrom(
|
||||||
.saveEntries(
|
this._dictionaryService.saveEntries(
|
||||||
this._dictionaryManager.editor.currentEntries,
|
this._dictionaryManager.editor.currentEntries,
|
||||||
this._dictionaryManager.initialEntries,
|
this._dictionaryManager.initialEntries,
|
||||||
this.dossier.dossierTemplateId,
|
this.dossier.dossierTemplateId,
|
||||||
'dossier_redaction',
|
'dossier_redaction',
|
||||||
this.dossier.id,
|
this.dossier.id,
|
||||||
false,
|
false,
|
||||||
)
|
),
|
||||||
.toPromise();
|
);
|
||||||
|
|
||||||
await this._updateDossierDictionary();
|
await this._updateDossierDictionary();
|
||||||
return { success: true };
|
return { success: true };
|
||||||
@ -127,6 +128,8 @@ export class EditDossierDictionaryComponent implements EditDossierSectionInterfa
|
|||||||
|
|
||||||
private async _updateDossierDictionary() {
|
private async _updateDossierDictionary() {
|
||||||
const { dossierId, dossierTemplateId } = this.dossier;
|
const { dossierId, dossierTemplateId } = this.dossier;
|
||||||
this.dossierDictionary = await this._dictionaryService.getForType(dossierTemplateId, 'dossier_redaction', dossierId).toPromise();
|
this.dossierDictionary = await firstValueFrom(
|
||||||
|
this._dictionaryService.getForType(dossierTemplateId, 'dossier_redaction', dossierId),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import { downloadTypesTranslations } from '../../../../../translations/download-
|
|||||||
import { DossiersService } from '@services/entity-services/dossiers.service';
|
import { DossiersService } from '@services/entity-services/dossiers.service';
|
||||||
import { ReportTemplateService } from '@services/report-template.service';
|
import { ReportTemplateService } from '@services/report-template.service';
|
||||||
import { PermissionsService } from '@services/permissions.service';
|
import { PermissionsService } from '@services/permissions.service';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-edit-dossier-download-package',
|
selector: 'redaction-edit-dossier-download-package',
|
||||||
@ -70,7 +71,7 @@ export class EditDossierDownloadPackageComponent implements OnInit, EditDossierS
|
|||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.availableReportTypes =
|
this.availableReportTypes =
|
||||||
(await this._reportTemplateController.getAvailableReportTemplates(this.dossier.dossierTemplateId).toPromise()) || [];
|
(await firstValueFrom(this._reportTemplateController.getAvailableReportTemplates(this.dossier.dossierTemplateId))) || [];
|
||||||
|
|
||||||
this.form = this._getForm();
|
this.form = this._getForm();
|
||||||
if (!this._permissionsService.canEditDossier()) {
|
if (!this._permissionsService.canEditDossier()) {
|
||||||
@ -85,7 +86,7 @@ export class EditDossierDownloadPackageComponent implements OnInit, EditDossierS
|
|||||||
reportTemplateIds: this.form.get('reportTemplateIds').value,
|
reportTemplateIds: this.form.get('reportTemplateIds').value,
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
await this._dossiersService.createOrUpdate(dossier).toPromise();
|
await firstValueFrom(this._dossiersService.createOrUpdate(dossier));
|
||||||
return { success: true };
|
return { success: true };
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return { success: false };
|
return { success: false };
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import { DossiersService } from '@services/entity-services/dossiers.service';
|
|||||||
import { Dossier, IDossierRequest } from '@red/domain';
|
import { Dossier, IDossierRequest } from '@red/domain';
|
||||||
import { AutoUnsubscribe } from '@iqser/common-ui';
|
import { AutoUnsubscribe } from '@iqser/common-ui';
|
||||||
import { EditDossierSaveResult, EditDossierSectionInterface } from '../edit-dossier-section.interface';
|
import { EditDossierSaveResult, EditDossierSectionInterface } from '../edit-dossier-section.interface';
|
||||||
import { BehaviorSubject } from 'rxjs';
|
import { BehaviorSubject, firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-edit-dossier-team',
|
selector: 'redaction-edit-dossier-team',
|
||||||
@ -77,7 +77,7 @@ export class EditDossierTeamComponent extends AutoUnsubscribe implements EditDos
|
|||||||
} as IDossierRequest;
|
} as IDossierRequest;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await this._dossiersService.createOrUpdate(dossier).toPromise();
|
await firstValueFrom(this._dossiersService.createOrUpdate(dossier));
|
||||||
return { success: true };
|
return { success: true };
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return { success: false };
|
return { success: false };
|
||||||
|
|||||||
@ -13,6 +13,7 @@ import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
|||||||
import { DossiersService } from '@services/entity-services/dossiers.service';
|
import { DossiersService } from '@services/entity-services/dossiers.service';
|
||||||
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
|
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
|
||||||
import { DossierStatsService } from '@services/entity-services/dossier-stats.service';
|
import { DossierStatsService } from '@services/entity-services/dossier-stats.service';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-edit-dossier-general-info',
|
selector: 'redaction-edit-dossier-general-info',
|
||||||
@ -96,7 +97,7 @@ export class EditDossierGeneralInfoComponent implements OnInit, EditDossierSecti
|
|||||||
dossierTemplateId: this.form.get('dossierTemplateId').value,
|
dossierTemplateId: this.form.get('dossierTemplateId').value,
|
||||||
} as IDossierRequest;
|
} as IDossierRequest;
|
||||||
try {
|
try {
|
||||||
await this._dossiersService.createOrUpdate(dossier).toPromise();
|
await firstValueFrom(this._dossiersService.createOrUpdate(dossier));
|
||||||
return { success: true };
|
return { success: true };
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return { success: false };
|
return { success: false };
|
||||||
@ -118,7 +119,7 @@ export class EditDossierGeneralInfoComponent implements OnInit, EditDossierSecti
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
this._dialogService.openDialog('confirm', null, data, async () => {
|
this._dialogService.openDialog('confirm', null, data, async () => {
|
||||||
await this._dossiersService.delete(this.dossier).toPromise();
|
await firstValueFrom(this._dossiersService.delete(this.dossier));
|
||||||
this._editDossierDialogRef.close();
|
this._editDossierDialogRef.close();
|
||||||
this._router.navigate(['main', 'dossiers']).then(() => this._notifyDossierDeleted());
|
this._router.navigate(['main', 'dossiers']).then(() => this._notifyDossierDeleted());
|
||||||
});
|
});
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import { PermissionsService } from '@services/permissions.service';
|
|||||||
import { DossiersService } from '@services/entity-services/dossiers.service';
|
import { DossiersService } from '@services/entity-services/dossiers.service';
|
||||||
import { JustificationsService } from '@services/entity-services/justifications.service';
|
import { JustificationsService } from '@services/entity-services/justifications.service';
|
||||||
import { Dossier, ILegalBasisChangeRequest } from '@red/domain';
|
import { Dossier, ILegalBasisChangeRequest } from '@red/domain';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
export interface LegalBasisOption {
|
export interface LegalBasisOption {
|
||||||
label?: string;
|
label?: string;
|
||||||
@ -47,18 +48,9 @@ export class ForceAnnotationDialogComponent extends BaseDialogComponent implemen
|
|||||||
return this._data.hint;
|
return this._data.hint;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _getForm(): FormGroup {
|
|
||||||
this.isDocumentAdmin = this._permissionsService.isApprover(this._data.dossier);
|
|
||||||
|
|
||||||
return this._formBuilder.group({
|
|
||||||
reason: this._data.hint ? ['Forced Hint'] : [null, Validators.required],
|
|
||||||
comment: this.isDocumentAdmin ? [null] : [null, Validators.required],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
super.ngOnInit();
|
super.ngOnInit();
|
||||||
const data = await this._justificationsService.getForDossierTemplate(this._data.dossier.dossierTemplateId).toPromise();
|
const data = await firstValueFrom(this._justificationsService.getForDossierTemplate(this._data.dossier.dossierTemplateId));
|
||||||
|
|
||||||
this.legalOptions = data.map(lbm => ({
|
this.legalOptions = data.map(lbm => ({
|
||||||
legalBasis: lbm.reason,
|
legalBasis: lbm.reason,
|
||||||
@ -73,6 +65,15 @@ export class ForceAnnotationDialogComponent extends BaseDialogComponent implemen
|
|||||||
this._dialogRef.close(this._createForceRedactionRequest());
|
this._dialogRef.close(this._createForceRedactionRequest());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _getForm(): FormGroup {
|
||||||
|
this.isDocumentAdmin = this._permissionsService.isApprover(this._data.dossier);
|
||||||
|
|
||||||
|
return this._formBuilder.group({
|
||||||
|
reason: this._data.hint ? ['Forced Hint'] : [null, Validators.required],
|
||||||
|
comment: this.isDocumentAdmin ? [null] : [null, Validators.required],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private _createForceRedactionRequest(): ILegalBasisChangeRequest {
|
private _createForceRedactionRequest(): ILegalBasisChangeRequest {
|
||||||
const request: ILegalBasisChangeRequest = {};
|
const request: ILegalBasisChangeRequest = {};
|
||||||
|
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import { Dictionary, Dossier, File, IAddRedactionRequest } from '@red/domain';
|
|||||||
import { DossiersService } from '@services/entity-services/dossiers.service';
|
import { DossiersService } from '@services/entity-services/dossiers.service';
|
||||||
import { BaseDialogComponent } from '@iqser/common-ui';
|
import { BaseDialogComponent } from '@iqser/common-ui';
|
||||||
import { DictionaryService } from '@shared/services/dictionary.service';
|
import { DictionaryService } from '@shared/services/dictionary.service';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
export interface LegalBasisOption {
|
export interface LegalBasisOption {
|
||||||
label?: string;
|
label?: string;
|
||||||
@ -69,36 +70,15 @@ export class ManualAnnotationDialogComponent extends BaseDialogComponent impleme
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _getPossibleDictionaries(): Promise<Dictionary[]> {
|
get disabled() {
|
||||||
const possibleDictionaries: Dictionary[] = [];
|
return this.form.invalid;
|
||||||
const dossier = this._dossier;
|
|
||||||
|
|
||||||
const dossierDictionary = await this._dictionaryService
|
|
||||||
.getForType(dossier.dossierTemplateId, 'dossier_redaction', dossier.dossierId)
|
|
||||||
.toPromise();
|
|
||||||
|
|
||||||
for (const key of Object.keys(this._appStateService.dictionaryData[dossier.dossierTemplateId])) {
|
|
||||||
const dictionaryData = this._appStateService.getDictionary(key, dossier.dossierTemplateId);
|
|
||||||
if (!dictionaryData.virtual && dictionaryData.addToDictionaryAction) {
|
|
||||||
possibleDictionaries.push(dictionaryData);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dossierDictionary.addToDictionaryAction) {
|
|
||||||
// TODO fix this in the backend
|
|
||||||
possibleDictionaries.push(new Dictionary({ ...dossierDictionary, type: 'dossier_redaction' }));
|
|
||||||
}
|
|
||||||
|
|
||||||
possibleDictionaries.sort((a, b) => a.label.localeCompare(b.label));
|
|
||||||
|
|
||||||
return possibleDictionaries;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
super.ngOnInit();
|
super.ngOnInit();
|
||||||
this.possibleDictionaries = await this._getPossibleDictionaries();
|
this.possibleDictionaries = await this._getPossibleDictionaries();
|
||||||
|
|
||||||
const data = await this._justificationsService.getForDossierTemplate(this._dossier.dossierTemplateId).toPromise();
|
const data = await firstValueFrom(this._justificationsService.getForDossierTemplate(this._dossier.dossierTemplateId));
|
||||||
this.legalOptions = data.map(lbm => ({
|
this.legalOptions = data.map(lbm => ({
|
||||||
legalBasis: lbm.reason,
|
legalBasis: lbm.reason,
|
||||||
description: lbm.description,
|
description: lbm.description,
|
||||||
@ -124,6 +104,31 @@ export class ManualAnnotationDialogComponent extends BaseDialogComponent impleme
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async _getPossibleDictionaries(): Promise<Dictionary[]> {
|
||||||
|
const possibleDictionaries: Dictionary[] = [];
|
||||||
|
const dossier = this._dossier;
|
||||||
|
|
||||||
|
const dossierDictionary = await firstValueFrom(
|
||||||
|
this._dictionaryService.getForType(dossier.dossierTemplateId, 'dossier_redaction', dossier.dossierId),
|
||||||
|
);
|
||||||
|
|
||||||
|
for (const key of Object.keys(this._appStateService.dictionaryData[dossier.dossierTemplateId])) {
|
||||||
|
const dictionaryData = this._appStateService.getDictionary(key, dossier.dossierTemplateId);
|
||||||
|
if (!dictionaryData.virtual && dictionaryData.addToDictionaryAction) {
|
||||||
|
possibleDictionaries.push(dictionaryData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dossierDictionary.addToDictionaryAction) {
|
||||||
|
// TODO fix this in the backend
|
||||||
|
possibleDictionaries.push(new Dictionary({ ...dossierDictionary, type: 'dossier_redaction' }));
|
||||||
|
}
|
||||||
|
|
||||||
|
possibleDictionaries.sort((a, b) => a.label.localeCompare(b.label));
|
||||||
|
|
||||||
|
return possibleDictionaries;
|
||||||
|
}
|
||||||
|
|
||||||
private _getForm(): FormGroup {
|
private _getForm(): FormGroup {
|
||||||
return this._formBuilder.group({
|
return this._formBuilder.group({
|
||||||
section: [null],
|
section: [null],
|
||||||
@ -155,8 +160,4 @@ export class ManualAnnotationDialogComponent extends BaseDialogComponent impleme
|
|||||||
addRedactionRequest.section = this.form.get('section').value;
|
addRedactionRequest.section = this.form.get('section').value;
|
||||||
addRedactionRequest.value = addRedactionRequest.rectangle ? this.form.get('classification').value : addRedactionRequest.value;
|
addRedactionRequest.value = addRedactionRequest.rectangle ? this.form.get('classification').value : addRedactionRequest.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
get disabled() {
|
|
||||||
return this.form.invalid;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import { Dossier, DossierAttributeWithValue, DossierStats } from '@red/domain';
|
|||||||
import { DossiersDialogService } from '../../../../services/dossiers-dialog.service';
|
import { DossiersDialogService } from '../../../../services/dossiers-dialog.service';
|
||||||
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
|
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
|
||||||
import { FilesService } from '@services/entity-services/files.service';
|
import { FilesService } from '@services/entity-services/files.service';
|
||||||
import { Observable } from 'rxjs';
|
import { firstValueFrom, Observable } from 'rxjs';
|
||||||
import { map, switchMap } from 'rxjs/operators';
|
import { map, switchMap } from 'rxjs/operators';
|
||||||
import { DossierStatsService } from '@services/entity-services/dossier-stats.service';
|
import { DossierStatsService } from '@services/entity-services/dossier-stats.service';
|
||||||
import { FilesMapService } from '@services/entity-services/files-map.service';
|
import { FilesMapService } from '@services/entity-services/files-map.service';
|
||||||
@ -43,7 +43,7 @@ export class DossierDetailsStatsComponent implements OnInit {
|
|||||||
openEditDossierDialog(section: string): void {
|
openEditDossierDialog(section: string): void {
|
||||||
const data = { dossierId: this.dossier.dossierId, section };
|
const data = { dossierId: this.dossier.dossierId, section };
|
||||||
this._dialogService.openDialog('editDossier', null, data, async () => {
|
this._dialogService.openDialog('editDossier', null, data, async () => {
|
||||||
await this._filesService.loadAll(this.dossier.dossierId).toPromise();
|
await firstValueFrom(this._filesService.loadAll(this.dossier.dossierId));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
|||||||
import { Dossier, DossierAttributeWithValue, DossierStats, IDossierRequest, StatusSorter, User } from '@red/domain';
|
import { Dossier, DossierAttributeWithValue, DossierStats, IDossierRequest, StatusSorter, User } from '@red/domain';
|
||||||
import { DossiersService } from '@services/entity-services/dossiers.service';
|
import { DossiersService } from '@services/entity-services/dossiers.service';
|
||||||
import { ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute } from '@angular/router';
|
||||||
import { Observable } from 'rxjs';
|
import { firstValueFrom, Observable } from 'rxjs';
|
||||||
import { DossierStatsService } from '@services/entity-services/dossier-stats.service';
|
import { DossierStatsService } from '@services/entity-services/dossier-stats.service';
|
||||||
import { pluck, switchMap } from 'rxjs/operators';
|
import { pluck, switchMap } from 'rxjs/operators';
|
||||||
import { DossiersDialogService } from '../../../../services/dossiers-dialog.service';
|
import { DossiersDialogService } from '../../../../services/dossiers-dialog.service';
|
||||||
@ -73,7 +73,7 @@ export class DossierDetailsComponent {
|
|||||||
async assignOwner(user: User | string, dossier: Dossier) {
|
async assignOwner(user: User | string, dossier: Dossier) {
|
||||||
const owner = typeof user === 'string' ? this._userService.find(user) : user;
|
const owner = typeof user === 'string' ? this._userService.find(user) : user;
|
||||||
const dossierRequest: IDossierRequest = { ...dossier, ownerId: owner.id };
|
const dossierRequest: IDossierRequest = { ...dossier, ownerId: owner.id };
|
||||||
await this.dossiersService.createOrUpdate(dossierRequest).toPromise();
|
await firstValueFrom(this.dossiersService.createOrUpdate(dossierRequest));
|
||||||
|
|
||||||
const ownerName = this._userService.getNameForId(owner.id);
|
const ownerName = this._userService.getNameForId(owner.id);
|
||||||
const dossierName = dossier.dossierName;
|
const dossierName = dossier.dossierName;
|
||||||
|
|||||||
@ -19,6 +19,7 @@ import { map, take } from 'rxjs/operators';
|
|||||||
import { saveAsCSV } from '@utils/csv-utils';
|
import { saveAsCSV } from '@utils/csv-utils';
|
||||||
import { UserService } from '@services/user.service';
|
import { UserService } from '@services/user.service';
|
||||||
import { ConfigService } from '../../config.service';
|
import { ConfigService } from '../../config.service';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-screen-header',
|
selector: 'redaction-screen-header',
|
||||||
@ -53,7 +54,7 @@ export class ScreenHeaderComponent implements OnInit {
|
|||||||
async reanalyseDossier() {
|
async reanalyseDossier() {
|
||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
try {
|
try {
|
||||||
await this._reanalysisService.reanalyzeDossier(this.dossier.dossierId, true).toPromise();
|
await firstValueFrom(this._reanalysisService.reanalyzeDossier(this.dossier.dossierId, true));
|
||||||
this._toaster.success(_('dossier-overview.reanalyse-dossier.success'));
|
this._toaster.success(_('dossier-overview.reanalyse-dossier.success'));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this._toaster.error(_('dossier-overview.reanalyse-dossier.error'));
|
this._toaster.error(_('dossier-overview.reanalyse-dossier.error'));
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import { FileAssignService } from '../../../shared/services/file-assign.service'
|
|||||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||||
import { ReanalysisService } from '../../../../../services/reanalysis.service';
|
import { ReanalysisService } from '../../../../../services/reanalysis.service';
|
||||||
import { FileManagementService } from '@services/entity-services/file-management.service';
|
import { FileManagementService } from '@services/entity-services/file-management.service';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class BulkActionsService {
|
export class BulkActionsService {
|
||||||
@ -28,13 +29,13 @@ export class BulkActionsService {
|
|||||||
this._assignFiles(files, 'approver', true);
|
this._assignFiles(files, 'approver', true);
|
||||||
} else {
|
} else {
|
||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
await this._filesService
|
await firstValueFrom(
|
||||||
.setUnderApprovalFor(
|
this._filesService.setUnderApprovalFor(
|
||||||
files.map(f => f.id),
|
files.map(f => f.id),
|
||||||
dossier.id,
|
dossier.id,
|
||||||
dossier.approverIds[0],
|
dossier.approverIds[0],
|
||||||
)
|
),
|
||||||
.toPromise();
|
);
|
||||||
this._loadingService.stop();
|
this._loadingService.stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -45,12 +46,12 @@ export class BulkActionsService {
|
|||||||
|
|
||||||
async ocr(files: File[]) {
|
async ocr(files: File[]) {
|
||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
await this._reanalysisService
|
await firstValueFrom(
|
||||||
.ocrFiles(
|
this._reanalysisService.ocrFiles(
|
||||||
files.map(f => f.fileId),
|
files.map(f => f.fileId),
|
||||||
files[0].dossierId,
|
files[0].dossierId,
|
||||||
)
|
),
|
||||||
.toPromise();
|
);
|
||||||
this._loadingService.stop();
|
this._loadingService.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,12 +65,12 @@ export class BulkActionsService {
|
|||||||
}),
|
}),
|
||||||
async () => {
|
async () => {
|
||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
await this._fileManagementService
|
await firstValueFrom(
|
||||||
.delete(
|
this._fileManagementService.delete(
|
||||||
files.map(item => item.fileId),
|
files.map(item => item.fileId),
|
||||||
files[0].dossierId,
|
files[0].dossierId,
|
||||||
)
|
),
|
||||||
.toPromise();
|
);
|
||||||
this._loadingService.stop();
|
this._loadingService.stop();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@ -78,18 +79,18 @@ export class BulkActionsService {
|
|||||||
async reanalyse(files: File[]) {
|
async reanalyse(files: File[]) {
|
||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
const fileIds = files.filter(file => file.analysisRequired).map(file => file.fileId);
|
const fileIds = files.filter(file => file.analysisRequired).map(file => file.fileId);
|
||||||
await this._reanalysisService.reanalyzeFilesForDossier(fileIds, files[0].dossierId).toPromise();
|
await firstValueFrom(this._reanalysisService.reanalyzeFilesForDossier(fileIds, files[0].dossierId));
|
||||||
this._loadingService.stop();
|
this._loadingService.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
async backToUnderReview(files: File[]): Promise<void> {
|
async backToUnderReview(files: File[]): Promise<void> {
|
||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
await this._filesService
|
await firstValueFrom(
|
||||||
.setUnderReviewFor(
|
this._filesService.setUnderReviewFor(
|
||||||
files.map(f => f.id),
|
files.map(f => f.id),
|
||||||
files[0].dossierId,
|
files[0].dossierId,
|
||||||
)
|
),
|
||||||
.toPromise();
|
);
|
||||||
this._loadingService.stop();
|
this._loadingService.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,23 +106,23 @@ export class BulkActionsService {
|
|||||||
}),
|
}),
|
||||||
async () => {
|
async () => {
|
||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
await this._filesService
|
await firstValueFrom(
|
||||||
.setApprovedFor(
|
this._filesService.setApprovedFor(
|
||||||
files.map(f => f.id),
|
files.map(f => f.id),
|
||||||
files[0].dossierId,
|
files[0].dossierId,
|
||||||
)
|
),
|
||||||
.toPromise();
|
);
|
||||||
this._loadingService.stop();
|
this._loadingService.stop();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
await this._filesService
|
await firstValueFrom(
|
||||||
.setApprovedFor(
|
this._filesService.setApprovedFor(
|
||||||
files.map(f => f.id),
|
files.map(f => f.id),
|
||||||
files[0].dossierId,
|
files[0].dossierId,
|
||||||
)
|
),
|
||||||
.toPromise();
|
);
|
||||||
this._loadingService.stop();
|
this._loadingService.stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import { UserPreferenceService } from '@services/user-preference.service';
|
|||||||
import { FilesMapService } from '@services/entity-services/files-map.service';
|
import { FilesMapService } from '@services/entity-services/files-map.service';
|
||||||
import { ReanalysisService } from '@services/reanalysis.service';
|
import { ReanalysisService } from '@services/reanalysis.service';
|
||||||
import { DossiersService } from '@services/entity-services/dossiers.service';
|
import { DossiersService } from '@services/entity-services/dossiers.service';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-dossiers-listing-actions',
|
selector: 'redaction-dossiers-listing-actions',
|
||||||
@ -60,6 +61,6 @@ export class DossiersListingActionsComponent implements OnChanges {
|
|||||||
|
|
||||||
async reanalyseDossier($event: MouseEvent, id: string): Promise<void> {
|
async reanalyseDossier($event: MouseEvent, id: string): Promise<void> {
|
||||||
$event.stopPropagation();
|
$event.stopPropagation();
|
||||||
await this._reanalysisService.reanalyzeDossier(id).toPromise();
|
await firstValueFrom(this._reanalysisService.reanalyzeDossier(id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,10 +4,10 @@ import { ManualAnnotationService } from '../../../../services/manual-annotation.
|
|||||||
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
||||||
import { UserService } from '@services/user.service';
|
import { UserService } from '@services/user.service';
|
||||||
import { PermissionsService } from '@services/permissions.service';
|
import { PermissionsService } from '@services/permissions.service';
|
||||||
import { AutoUnsubscribe, InputWithActionComponent, LoadingService, trackBy } from '@iqser/common-ui';
|
import { AutoUnsubscribe, InputWithActionComponent, LoadingService, trackByFactory } from '@iqser/common-ui';
|
||||||
import { FilesMapService } from '@services/entity-services/files-map.service';
|
import { FilesMapService } from '@services/entity-services/files-map.service';
|
||||||
import { ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute } from '@angular/router';
|
||||||
import { Observable } from 'rxjs';
|
import { firstValueFrom, Observable } from 'rxjs';
|
||||||
import { CommentingService } from '../../services/commenting.service';
|
import { CommentingService } from '../../services/commenting.service';
|
||||||
import { tap } from 'rxjs/operators';
|
import { tap } from 'rxjs/operators';
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ import { tap } from 'rxjs/operators';
|
|||||||
})
|
})
|
||||||
export class CommentsComponent extends AutoUnsubscribe implements OnChanges {
|
export class CommentsComponent extends AutoUnsubscribe implements OnChanges {
|
||||||
@Input() annotation: AnnotationWrapper;
|
@Input() annotation: AnnotationWrapper;
|
||||||
readonly trackBy = trackBy();
|
readonly trackBy = trackByFactory();
|
||||||
readonly file$: Observable<File>;
|
readonly file$: Observable<File>;
|
||||||
@HostBinding('class.hidden') _hidden = true;
|
@HostBinding('class.hidden') _hidden = true;
|
||||||
@ViewChild(InputWithActionComponent) private readonly _input: InputWithActionComponent;
|
@ViewChild(InputWithActionComponent) private readonly _input: InputWithActionComponent;
|
||||||
@ -58,9 +58,9 @@ export class CommentsComponent extends AutoUnsubscribe implements OnChanges {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
const commentId = await this._manualAnnotationService
|
const commentId = await firstValueFrom(
|
||||||
.addComment(value, this.annotation.id, this._dossierId, this._fileId)
|
this._manualAnnotationService.addComment(value, this.annotation.id, this._dossierId, this._fileId),
|
||||||
.toPromise();
|
);
|
||||||
this.annotation.comments.push({
|
this.annotation.comments.push({
|
||||||
text: value,
|
text: value,
|
||||||
id: commentId,
|
id: commentId,
|
||||||
@ -80,7 +80,7 @@ export class CommentsComponent extends AutoUnsubscribe implements OnChanges {
|
|||||||
async deleteComment($event: MouseEvent, comment: IComment): Promise<void> {
|
async deleteComment($event: MouseEvent, comment: IComment): Promise<void> {
|
||||||
$event.stopPropagation();
|
$event.stopPropagation();
|
||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
await this._manualAnnotationService.deleteComment(comment.id, this.annotation.id, this._dossierId, this._fileId).toPromise();
|
await firstValueFrom(this._manualAnnotationService.deleteComment(comment.id, this.annotation.id, this._dossierId, this._fileId));
|
||||||
this.annotation.comments.splice(this.annotation.comments.indexOf(comment), 1);
|
this.annotation.comments.splice(this.annotation.comments.indexOf(comment), 1);
|
||||||
this._changeRef.markForCheck();
|
this._changeRef.markForCheck();
|
||||||
this._loadingService.stop();
|
this._loadingService.stop();
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
|||||||
import { File, IPageRange } from '@red/domain';
|
import { File, IPageRange } from '@red/domain';
|
||||||
import { ReanalysisService } from '@services/reanalysis.service';
|
import { ReanalysisService } from '@services/reanalysis.service';
|
||||||
import { ExcludedPagesService } from '../../services/excluded-pages.service';
|
import { ExcludedPagesService } from '../../services/excluded-pages.service';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-page-exclusion',
|
selector: 'redaction-page-exclusion',
|
||||||
@ -57,15 +58,15 @@ export class PageExclusionComponent implements OnChanges {
|
|||||||
endPage,
|
endPage,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
await this._reanalysisService
|
await firstValueFrom(
|
||||||
.excludePages(
|
this._reanalysisService.excludePages(
|
||||||
{
|
{
|
||||||
pageRanges: pageRanges,
|
pageRanges: pageRanges,
|
||||||
},
|
},
|
||||||
this.file.dossierId,
|
this.file.dossierId,
|
||||||
this.file.fileId,
|
this.file.fileId,
|
||||||
)
|
),
|
||||||
.toPromise();
|
);
|
||||||
this._inputComponent.reset();
|
this._inputComponent.reset();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this._toaster.error(_('file-preview.tabs.exclude-pages.error'));
|
this._toaster.error(_('file-preview.tabs.exclude-pages.error'));
|
||||||
@ -75,15 +76,15 @@ export class PageExclusionComponent implements OnChanges {
|
|||||||
|
|
||||||
async includePagesRange(range: IPageRange): Promise<void> {
|
async includePagesRange(range: IPageRange): Promise<void> {
|
||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
await this._reanalysisService
|
await firstValueFrom(
|
||||||
.includePages(
|
this._reanalysisService.includePages(
|
||||||
{
|
{
|
||||||
pageRanges: [range],
|
pageRanges: [range],
|
||||||
},
|
},
|
||||||
this.file.dossierId,
|
this.file.dossierId,
|
||||||
this.file.fileId,
|
this.file.fileId,
|
||||||
)
|
),
|
||||||
.toPromise();
|
);
|
||||||
this._inputComponent.reset();
|
this._inputComponent.reset();
|
||||||
this._loadingService.stop();
|
this._loadingService.stop();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import { File, IViewedPage } from '@red/domain';
|
|||||||
import { AutoUnsubscribe } from '@iqser/common-ui';
|
import { AutoUnsubscribe } from '@iqser/common-ui';
|
||||||
import { FilesMapService } from '@services/entity-services/files-map.service';
|
import { FilesMapService } from '@services/entity-services/files-map.service';
|
||||||
import { FilePreviewStateService } from '../../services/file-preview-state.service';
|
import { FilePreviewStateService } from '../../services/file-preview-state.service';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-page-indicator',
|
selector: 'redaction-page-indicator',
|
||||||
@ -93,7 +94,7 @@ export class PageIndicatorComponent extends AutoUnsubscribe implements OnDestroy
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async _markPageRead() {
|
private async _markPageRead() {
|
||||||
await this._viewedPagesService.addPage({ page: this.number }, this.file.dossierId, this.file.fileId).toPromise();
|
await firstValueFrom(this._viewedPagesService.addPage({ page: this.number }, this.file.dossierId, this.file.fileId));
|
||||||
if (this.activePage) {
|
if (this.activePage) {
|
||||||
this.activePage.showAsUnseen = false;
|
this.activePage.showAsUnseen = false;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
|||||||
import { UserService } from '@services/user.service';
|
import { UserService } from '@services/user.service';
|
||||||
import { FilesService } from '@services/entity-services/files.service';
|
import { FilesService } from '@services/entity-services/files.service';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-user-management',
|
selector: 'redaction-user-management',
|
||||||
@ -88,11 +89,11 @@ export class UserManagementComponent implements OnChanges {
|
|||||||
this.loadingService.start();
|
this.loadingService.start();
|
||||||
|
|
||||||
if (!assigneeId) {
|
if (!assigneeId) {
|
||||||
await this.filesService.setUnassigned([fileId], dossierId).toPromise();
|
await firstValueFrom(this.filesService.setUnassigned([fileId], dossierId));
|
||||||
} else if (file.isNew || file.isUnderReview) {
|
} else if (file.isNew || file.isUnderReview) {
|
||||||
await this.filesService.setReviewerFor([fileId], dossierId, assigneeId).toPromise();
|
await firstValueFrom(this.filesService.setReviewerFor([fileId], dossierId, assigneeId));
|
||||||
} else if (file.isUnderApproval) {
|
} else if (file.isUnderApproval) {
|
||||||
await this.filesService.setUnderApprovalFor([fileId], dossierId, assigneeId).toPromise();
|
await firstValueFrom(this.filesService.setUnderApprovalFor([fileId], dossierId, assigneeId));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.loadingService.stop();
|
this.loadingService.stop();
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import { environment } from '@environments/environment';
|
|||||||
|
|
||||||
import { IRectangle, ISectionGrid, ISectionRectangle } from '@red/domain';
|
import { IRectangle, ISectionGrid, ISectionRectangle } from '@red/domain';
|
||||||
import { SkippedService } from './skipped.service';
|
import { SkippedService } from './skipped.service';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
import Annotation = Core.Annotations.Annotation;
|
import Annotation = Core.Annotations.Annotation;
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
@ -91,10 +92,9 @@ export class AnnotationDrawService {
|
|||||||
await annotationManager.drawAnnotationsFromList(annotations);
|
await annotationManager.drawAnnotationsFromList(annotations);
|
||||||
|
|
||||||
if (this._userPreferenceService.areDevFeaturesEnabled) {
|
if (this._userPreferenceService.areDevFeaturesEnabled) {
|
||||||
const sectionsGrid = await this._redactionLogService
|
const sectionsGrid = await firstValueFrom(this._redactionLogService.getSectionGrid(dossierId, fileId)).catch(() => ({
|
||||||
.getSectionGrid(dossierId, fileId)
|
rectanglesPerPage: {},
|
||||||
.toPromise()
|
}));
|
||||||
.catch(() => ({ rectanglesPerPage: {} }));
|
|
||||||
await this._drawSections(activeViewer, sectionsGrid, dossierId);
|
await this._drawSections(activeViewer, sectionsGrid, dossierId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,14 +2,12 @@ import {
|
|||||||
ChangeDetectionStrategy,
|
ChangeDetectionStrategy,
|
||||||
ChangeDetectorRef,
|
ChangeDetectorRef,
|
||||||
Component,
|
Component,
|
||||||
EventEmitter,
|
|
||||||
HostBinding,
|
HostBinding,
|
||||||
Input,
|
Input,
|
||||||
OnChanges,
|
OnChanges,
|
||||||
OnDestroy,
|
OnDestroy,
|
||||||
OnInit,
|
OnInit,
|
||||||
Optional,
|
Optional,
|
||||||
Output,
|
|
||||||
ViewChild,
|
ViewChild,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import { PermissionsService } from '@services/permissions.service';
|
import { PermissionsService } from '@services/permissions.service';
|
||||||
@ -38,6 +36,7 @@ import { ExcludedPagesService } from '../../../screens/file-preview-screen/servi
|
|||||||
import { tap } from 'rxjs/operators';
|
import { tap } from 'rxjs/operators';
|
||||||
import { DocumentInfoService } from '../../../screens/file-preview-screen/services/document-info.service';
|
import { DocumentInfoService } from '../../../screens/file-preview-screen/services/document-info.service';
|
||||||
import { ExpandableFileActionsComponent } from '@shared/components/expandable-file-actions/expandable-file-actions.component';
|
import { ExpandableFileActionsComponent } from '@shared/components/expandable-file-actions/expandable-file-actions.component';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-file-actions [file] [type]',
|
selector: 'redaction-file-actions [file] [type]',
|
||||||
@ -273,7 +272,7 @@ export class FileActionsComponent extends AutoUnsubscribe implements OnDestroy,
|
|||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
try {
|
try {
|
||||||
const dossier = this._dossiersService.find(this.file.dossierId);
|
const dossier = this._dossiersService.find(this.file.dossierId);
|
||||||
await this._fileManagementService.delete([this.file.fileId], this.file.dossierId).toPromise();
|
await firstValueFrom(this._fileManagementService.delete([this.file.fileId], this.file.dossierId));
|
||||||
await this._router.navigate([dossier.routerLink]);
|
await this._router.navigate([dossier.routerLink]);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this._toaster.error(_('error.http.generic'), { params: error });
|
this._toaster.error(_('error.http.generic'), { params: error });
|
||||||
@ -300,7 +299,7 @@ export class FileActionsComponent extends AutoUnsubscribe implements OnDestroy,
|
|||||||
if ($event) {
|
if ($event) {
|
||||||
$event.stopPropagation();
|
$event.stopPropagation();
|
||||||
}
|
}
|
||||||
await this._reanalysisService.reanalyzeFilesForDossier([this.file.fileId], this.file.dossierId, true).toPromise();
|
await firstValueFrom(this._reanalysisService.reanalyzeFilesForDossier([this.file.fileId], this.file.dossierId, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _setFileUnderApproval($event: MouseEvent) {
|
private async _setFileUnderApproval($event: MouseEvent) {
|
||||||
@ -311,7 +310,7 @@ export class FileActionsComponent extends AutoUnsubscribe implements OnDestroy,
|
|||||||
private async _ocrFile($event: MouseEvent) {
|
private async _ocrFile($event: MouseEvent) {
|
||||||
$event.stopPropagation();
|
$event.stopPropagation();
|
||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
await this._reanalysisService.ocrFiles([this.file.fileId], this.file.dossierId).toPromise();
|
await firstValueFrom(this._reanalysisService.ocrFiles([this.file.fileId], this.file.dossierId));
|
||||||
this._loadingService.stop();
|
this._loadingService.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -321,7 +320,7 @@ export class FileActionsComponent extends AutoUnsubscribe implements OnDestroy,
|
|||||||
|
|
||||||
private async _toggleAnalysis() {
|
private async _toggleAnalysis() {
|
||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
await this._reanalysisService.toggleAnalysis(this.file.dossierId, this.file.fileId, !this.file.excluded).toPromise();
|
await firstValueFrom(this._reanalysisService.toggleAnalysis(this.file.dossierId, this.file.fileId, !this.file.excluded));
|
||||||
this._loadingService.stop();
|
this._loadingService.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -364,7 +363,7 @@ export class FileActionsComponent extends AutoUnsubscribe implements OnDestroy,
|
|||||||
|
|
||||||
private async _setFileApproved() {
|
private async _setFileApproved() {
|
||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
await this._filesService.setApprovedFor([this.file.id], this.file.dossierId).toPromise();
|
await firstValueFrom(this._filesService.setApprovedFor([this.file.id], this.file.dossierId));
|
||||||
this._loadingService.stop();
|
this._loadingService.stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
|||||||
import { FilesService } from '@services/entity-services/files.service';
|
import { FilesService } from '@services/entity-services/files.service';
|
||||||
import { ConfirmationDialogInput, LoadingService, Toaster } from '@iqser/common-ui';
|
import { ConfirmationDialogInput, LoadingService, Toaster } from '@iqser/common-ui';
|
||||||
import { DossiersService } from '@services/entity-services/dossiers.service';
|
import { DossiersService } from '@services/entity-services/dossiers.service';
|
||||||
import { Observable } from 'rxjs';
|
import { firstValueFrom, Observable } from 'rxjs';
|
||||||
import { tap } from 'rxjs/operators';
|
import { tap } from 'rxjs/operators';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
@ -29,14 +29,12 @@ export class FileAssignService {
|
|||||||
question: _('confirmation-dialog.assign-file-to-me.question'),
|
question: _('confirmation-dialog.assign-file-to-me.question'),
|
||||||
});
|
});
|
||||||
this._dialogService.openDialog('confirm', null, data, () => {
|
this._dialogService.openDialog('confirm', null, data, () => {
|
||||||
this._assignReviewerToCurrentUser(files)
|
firstValueFrom(this._assignReviewerToCurrentUser(files))
|
||||||
.toPromise()
|
|
||||||
.then(() => resolve())
|
.then(() => resolve())
|
||||||
.catch(() => reject());
|
.catch(() => reject());
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this._assignReviewerToCurrentUser(files)
|
firstValueFrom(this._assignReviewerToCurrentUser(files))
|
||||||
.toPromise()
|
|
||||||
.then(() => resolve())
|
.then(() => resolve())
|
||||||
.catch(() => reject());
|
.catch(() => reject());
|
||||||
}
|
}
|
||||||
@ -83,28 +81,28 @@ export class FileAssignService {
|
|||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
try {
|
try {
|
||||||
if (!userId) {
|
if (!userId) {
|
||||||
await this._filesService
|
await firstValueFrom(
|
||||||
.setUnassigned(
|
this._filesService.setUnassigned(
|
||||||
files.map(f => f.fileId),
|
files.map(f => f.fileId),
|
||||||
files[0].dossierId,
|
files[0].dossierId,
|
||||||
)
|
),
|
||||||
.toPromise();
|
);
|
||||||
} else if (mode === 'reviewer') {
|
} else if (mode === 'reviewer') {
|
||||||
await this._filesService
|
await firstValueFrom(
|
||||||
.setReviewerFor(
|
this._filesService.setReviewerFor(
|
||||||
files.map(f => f.fileId),
|
files.map(f => f.fileId),
|
||||||
files[0].dossierId,
|
files[0].dossierId,
|
||||||
userId,
|
userId,
|
||||||
)
|
),
|
||||||
.toPromise();
|
);
|
||||||
} else {
|
} else {
|
||||||
await this._filesService
|
await firstValueFrom(
|
||||||
.setUnderApprovalFor(
|
this._filesService.setUnderApprovalFor(
|
||||||
files.map(f => f.fileId),
|
files.map(f => f.fileId),
|
||||||
files[0].dossierId,
|
files[0].dossierId,
|
||||||
userId,
|
userId,
|
||||||
)
|
),
|
||||||
.toPromise();
|
);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this._toaster.error(_('error.http.generic'), { params: error });
|
this._toaster.error(_('error.http.generic'), { params: error });
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import { File } from '@red/domain';
|
|||||||
import { FileDownloadService } from '@upload-download/services/file-download.service';
|
import { FileDownloadService } from '@upload-download/services/file-download.service';
|
||||||
import { CircleButtonType, CircleButtonTypes, Toaster } from '@iqser/common-ui';
|
import { CircleButtonType, CircleButtonTypes, Toaster } from '@iqser/common-ui';
|
||||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
export type MenuState = 'OPEN' | 'CLOSED';
|
export type MenuState = 'OPEN' | 'CLOSED';
|
||||||
|
|
||||||
@ -38,7 +39,7 @@ export class FileDownloadBtnComponent implements OnChanges {
|
|||||||
$event.stopPropagation();
|
$event.stopPropagation();
|
||||||
const dossierId = this.files[0].dossierId;
|
const dossierId = this.files[0].dossierId;
|
||||||
const filesIds = this.files.map(f => f.fileId);
|
const filesIds = this.files.map(f => f.fileId);
|
||||||
await this._fileDownloadService.downloadFiles(filesIds, dossierId).toPromise();
|
await firstValueFrom(this._fileDownloadService.downloadFiles(filesIds, dossierId));
|
||||||
this._toaster.info(_('download-status.queued'));
|
this._toaster.info(_('download-status.queued'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { Component, EventEmitter, Input, OnChanges, Output, ViewChild } from '@angular/core';
|
import { Component, EventEmitter, Input, OnChanges, Output, ViewChild } from '@angular/core';
|
||||||
import { Debounce, IconButtonTypes, List } from '@iqser/common-ui';
|
import { Debounce, IconButtonTypes, List } from '@iqser/common-ui';
|
||||||
import { Observable, of } from 'rxjs';
|
import { firstValueFrom, Observable, of } from 'rxjs';
|
||||||
import { catchError, map, take, tap } from 'rxjs/operators';
|
import { catchError, map, take, tap } from 'rxjs/operators';
|
||||||
import { Dictionary, Dossier, DossierTemplate } from '@red/domain';
|
import { Dictionary, Dossier, DossierTemplate } from '@red/domain';
|
||||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||||
@ -110,20 +110,18 @@ export class DictionaryManagerComponent implements OnChanges {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._dictionaryService
|
firstValueFrom(
|
||||||
.getForType(this._dictionary.dossierTemplateId, this._dictionary.type)
|
this._dictionaryService.getForType(this._dictionary.dossierTemplateId, this._dictionary.type).pipe(
|
||||||
.pipe(
|
|
||||||
tap(values => (this._dictionary.entries = [...values.entries] ?? [])),
|
tap(values => (this._dictionary.entries = [...values.entries] ?? [])),
|
||||||
catchError(() => {
|
catchError(() => {
|
||||||
this._dictionary.entries = [];
|
this._dictionary.entries = [];
|
||||||
return of({});
|
return of({});
|
||||||
}),
|
}),
|
||||||
)
|
),
|
||||||
.toPromise()
|
).then(() => {
|
||||||
.then(() => {
|
this.diffEditorText = this._toString([...this._dictionary.entries]);
|
||||||
this.diffEditorText = this._toString([...this._dictionary.entries]);
|
this.showDiffEditor = true;
|
||||||
this.showDiffEditor = true;
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get _dictionaries() {
|
get _dictionaries() {
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import { CircleButtonType, IqserTooltipPosition, Toaster } from '@iqser/common-u
|
|||||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||||
import { FileDownloadService } from '@upload-download/services/file-download.service';
|
import { FileDownloadService } from '@upload-download/services/file-download.service';
|
||||||
import { PermissionsService } from '@services/permissions.service';
|
import { PermissionsService } from '@services/permissions.service';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-expandable-file-actions',
|
selector: 'redaction-expandable-file-actions',
|
||||||
@ -58,7 +59,7 @@ export class ExpandableFileActionsComponent implements OnChanges {
|
|||||||
$event.stopPropagation();
|
$event.stopPropagation();
|
||||||
const dossierId = files[0].dossierId;
|
const dossierId = files[0].dossierId;
|
||||||
const filesIds = files.map(f => f.fileId);
|
const filesIds = files.map(f => f.fileId);
|
||||||
await this._fileDownloadService.downloadFiles(filesIds, dossierId).toPromise();
|
await firstValueFrom(this._fileDownloadService.downloadFiles(filesIds, dossierId));
|
||||||
this._toaster.info(_('download-status.queued'));
|
this._toaster.info(_('download-status.queued'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { Injectable, Injector } from '@angular/core';
|
import { Injectable, Injector } from '@angular/core';
|
||||||
import { Dossier, DossierAttributeConfig, DossierAttributeWithValue, IDossierAttribute, IDossierAttributeConfig } from '@red/domain';
|
import { Dossier, DossierAttributeConfig, DossierAttributeWithValue, IDossierAttribute, IDossierAttributeConfig } from '@red/domain';
|
||||||
import { Observable } from 'rxjs';
|
import { firstValueFrom, Observable } from 'rxjs';
|
||||||
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
|
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
|
||||||
import { EntitiesService, List, mapEach, RequiredParam, Validate } from '@iqser/common-ui';
|
import { EntitiesService, List, mapEach, RequiredParam, Validate } from '@iqser/common-ui';
|
||||||
import { map, tap } from 'rxjs/operators';
|
import { map, tap } from 'rxjs/operators';
|
||||||
@ -14,8 +14,8 @@ export class DossierAttributesService extends EntitiesService<DossierAttributeCo
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getWithValues(dossier: Dossier): Promise<DossierAttributeWithValue[]> {
|
async getWithValues(dossier: Dossier): Promise<DossierAttributeWithValue[]> {
|
||||||
const attributes = await this.getAttributes(dossier.id).toPromise();
|
const attributes = await firstValueFrom(this.getAttributes(dossier.id));
|
||||||
const attributesConfig = await this.getConfig(dossier.dossierTemplateId).toPromise();
|
const attributesConfig = await firstValueFrom(this.getConfig(dossier.dossierTemplateId));
|
||||||
|
|
||||||
return attributesConfig.map(config => ({
|
return attributesConfig.map(config => ({
|
||||||
...config,
|
...config,
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
import { OverwriteFilesDialogComponent } from '../dialogs/overwrite-files-dialog/overwrite-files-dialog.component';
|
import { OverwriteFilesDialogComponent } from '../dialogs/overwrite-files-dialog/overwrite-files-dialog.component';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
const dialogConfig = {
|
const dialogConfig = {
|
||||||
width: '662px',
|
width: '662px',
|
||||||
@ -18,9 +19,6 @@ export class UploadDownloadDialogService {
|
|||||||
data: filename,
|
data: filename,
|
||||||
});
|
});
|
||||||
|
|
||||||
return ref
|
return firstValueFrom(ref.afterClosed()).then(res => res || { cancel: true });
|
||||||
.afterClosed()
|
|
||||||
.toPromise()
|
|
||||||
.then(res => res || { cancel: true });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import { Injectable, Injector } from '@angular/core';
|
|||||||
import { EntitiesService, List, mapEach, QueryParam, RequiredParam, shareLast, Toaster, Validate } from '@iqser/common-ui';
|
import { EntitiesService, List, mapEach, QueryParam, RequiredParam, shareLast, Toaster, Validate } from '@iqser/common-ui';
|
||||||
import { Dossier, IDossier, IDossierRequest } from '@red/domain';
|
import { Dossier, IDossier, IDossierRequest } from '@red/domain';
|
||||||
import { catchError, filter, map, mapTo, switchMap, tap } from 'rxjs/operators';
|
import { catchError, filter, map, mapTo, switchMap, tap } from 'rxjs/operators';
|
||||||
import { combineLatest, Observable, of, Subject, throwError, timer } from 'rxjs';
|
import { combineLatest, firstValueFrom, Observable, of, Subject, throwError, timer } from 'rxjs';
|
||||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||||
import { HttpErrorResponse, HttpStatusCode } from '@angular/common/http';
|
import { HttpErrorResponse, HttpStatusCode } from '@angular/common/http';
|
||||||
import { DossierStatsService } from '@services/entity-services/dossier-stats.service';
|
import { DossierStatsService } from '@services/entity-services/dossier-stats.service';
|
||||||
@ -83,7 +83,7 @@ export class DossiersService extends EntitiesService<Dossier, IDossier> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getDeleted(): Promise<IDossier[]> {
|
getDeleted(): Promise<IDossier[]> {
|
||||||
return this.getAll('deleted-dossiers').toPromise();
|
return firstValueFrom(this.getAll('deleted-dossiers'));
|
||||||
}
|
}
|
||||||
|
|
||||||
delete(dossier: Dossier): Observable<unknown> {
|
delete(dossier: Dossier): Observable<unknown> {
|
||||||
@ -99,13 +99,13 @@ export class DossiersService extends EntitiesService<Dossier, IDossier> {
|
|||||||
|
|
||||||
@Validate()
|
@Validate()
|
||||||
restore(@RequiredParam() dossierIds: List): Promise<unknown> {
|
restore(@RequiredParam() dossierIds: List): Promise<unknown> {
|
||||||
return this._post(dossierIds, 'deleted-dossiers/restore').toPromise();
|
return firstValueFrom(this._post(dossierIds, 'deleted-dossiers/restore'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Validate()
|
@Validate()
|
||||||
hardDelete(@RequiredParam() dossierIds: List): Promise<unknown> {
|
hardDelete(@RequiredParam() dossierIds: List): Promise<unknown> {
|
||||||
const body = dossierIds.map<QueryParam>(id => ({ key: 'dossierId', value: id }));
|
const body = dossierIds.map<QueryParam>(id => ({ key: 'dossierId', value: id }));
|
||||||
return super.delete(body, 'deleted-dossiers/hard-delete', body).toPromise();
|
return firstValueFrom(super.delete(body, 'deleted-dossiers/hard-delete', body));
|
||||||
}
|
}
|
||||||
|
|
||||||
private _emitFileChanges(changes: ChangesDetails): void {
|
private _emitFileChanges(changes: ChangesDetails): void {
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import { Injectable, Injector } from '@angular/core';
|
import { Injectable, Injector } from '@angular/core';
|
||||||
import { GenericService, List, RequiredParam, Validate } from '@iqser/common-ui';
|
import { GenericService, List, RequiredParam, Validate } from '@iqser/common-ui';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
type UserAttributes = Record<string, List>;
|
type UserAttributes = Record<string, List>;
|
||||||
|
|
||||||
@ -36,7 +37,7 @@ export class UserPreferenceService extends GenericService<UserAttributes> {
|
|||||||
async saveLastOpenedFileForDossier(dossierId: string, fileId: string): Promise<void> {
|
async saveLastOpenedFileForDossier(dossierId: string, fileId: string): Promise<void> {
|
||||||
const key = `${KEYS.dossierRecent}-${dossierId}`;
|
const key = `${KEYS.dossierRecent}-${dossierId}`;
|
||||||
this.userAttributes[key] = [fileId];
|
this.userAttributes[key] = [fileId];
|
||||||
await this.savePreferences([fileId], key).toPromise();
|
await firstValueFrom(this.savePreferences([fileId], key));
|
||||||
}
|
}
|
||||||
|
|
||||||
getLanguage(): string {
|
getLanguage(): string {
|
||||||
@ -47,7 +48,7 @@ export class UserPreferenceService extends GenericService<UserAttributes> {
|
|||||||
async saveLanguage(language: string): Promise<void> {
|
async saveLanguage(language: string): Promise<void> {
|
||||||
const key = KEYS.language;
|
const key = KEYS.language;
|
||||||
this.userAttributes[key] = [language];
|
this.userAttributes[key] = [language];
|
||||||
await this.savePreferences([language], key).toPromise();
|
await firstValueFrom(this.savePreferences([language], key));
|
||||||
}
|
}
|
||||||
|
|
||||||
getFilePreviewTooltipsPreference(): boolean {
|
getFilePreviewTooltipsPreference(): boolean {
|
||||||
@ -60,7 +61,7 @@ export class UserPreferenceService extends GenericService<UserAttributes> {
|
|||||||
const currentValue = this.getFilePreviewTooltipsPreference();
|
const currentValue = this.getFilePreviewTooltipsPreference();
|
||||||
const nextValue = [(!currentValue).toString()];
|
const nextValue = [(!currentValue).toString()];
|
||||||
this.userAttributes[key] = nextValue;
|
this.userAttributes[key] = nextValue;
|
||||||
await this.savePreferences(nextValue, key).toPromise();
|
await firstValueFrom(this.savePreferences(nextValue, key));
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleDevFeatures(): void {
|
toggleDevFeatures(): void {
|
||||||
@ -69,7 +70,7 @@ export class UserPreferenceService extends GenericService<UserAttributes> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async reload(): Promise<void> {
|
async reload(): Promise<void> {
|
||||||
const attributes = await this.getAll<UserAttributes>().toPromise();
|
const attributes = await firstValueFrom(this.getAll<UserAttributes>());
|
||||||
this._userAttributes = attributes ?? {};
|
this._userAttributes = attributes ?? {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import { ActivatedRouteSnapshot, CanActivate, Router } from '@angular/router';
|
|||||||
import { AppStateService } from './app-state.service';
|
import { AppStateService } from './app-state.service';
|
||||||
import { UserService } from '@services/user.service';
|
import { UserService } from '@services/user.service';
|
||||||
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
|
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
@ -17,11 +18,11 @@ export class AppStateGuard implements CanActivate {
|
|||||||
|
|
||||||
async canActivate(route: ActivatedRouteSnapshot): Promise<boolean> {
|
async canActivate(route: ActivatedRouteSnapshot): Promise<boolean> {
|
||||||
if (this._userService.currentUser.isUserAdmin) {
|
if (this._userService.currentUser.isUserAdmin) {
|
||||||
await this._userService.loadAll().toPromise();
|
await firstValueFrom(this._userService.loadAll());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._userService.currentUser.isUser || this._userService.currentUser.isAdmin) {
|
if (this._userService.currentUser.isUser || this._userService.currentUser.isAdmin) {
|
||||||
await this._userService.loadAll().toPromise();
|
await firstValueFrom(this._userService.loadAll());
|
||||||
await this._dossierTemplatesService.loadAllIfEmpty();
|
await this._dossierTemplatesService.loadAllIfEmpty();
|
||||||
await this._appStateService.loadDictionaryDataIfNecessary();
|
await this._appStateService.loadDictionaryDataIfNecessary();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Dictionary, DossierTemplate, IColors } from '@red/domain';
|
import { Dictionary, DossierTemplate, IColors } from '@red/domain';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { forkJoin, Observable, of } from 'rxjs';
|
import { firstValueFrom, forkJoin, Observable, of } from 'rxjs';
|
||||||
import { catchError, map, tap } from 'rxjs/operators';
|
import { catchError, map, tap } from 'rxjs/operators';
|
||||||
import { FALLBACK_COLOR, hexToRgb } from '@utils/functions';
|
import { FALLBACK_COLOR, hexToRgb } from '@utils/functions';
|
||||||
import { DictionaryService } from '@shared/services/dictionary.service';
|
import { DictionaryService } from '@shared/services/dictionary.service';
|
||||||
@ -79,9 +79,9 @@ export class AppStateService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async refreshDossierTemplate(dossierTemplateId: string) {
|
async refreshDossierTemplate(dossierTemplateId: string) {
|
||||||
const dossierTemplate = await this._dossierTemplatesService.get(dossierTemplateId).toPromise();
|
const dossierTemplate = await firstValueFrom(this._dossierTemplatesService.get(dossierTemplateId));
|
||||||
|
|
||||||
await this._fileAttributesService.getFileAttributesConfig(dossierTemplateId).toPromise();
|
await firstValueFrom(this._fileAttributesService.getFileAttributesConfig(dossierTemplateId));
|
||||||
|
|
||||||
const newDossierTemplate = new DossierTemplate(dossierTemplate);
|
const newDossierTemplate = new DossierTemplate(dossierTemplate);
|
||||||
this._dossierTemplatesService.replace(newDossierTemplate);
|
this._dossierTemplatesService.replace(newDossierTemplate);
|
||||||
@ -102,7 +102,7 @@ export class AppStateService {
|
|||||||
for (const dossierTemplate of this.dossierTemplates) {
|
for (const dossierTemplate of this.dossierTemplates) {
|
||||||
observables.push(this._getDictionaryDataForDossierTemplate$(dossierTemplate.dossierTemplateId));
|
observables.push(this._getDictionaryDataForDossierTemplate$(dossierTemplate.dossierTemplateId));
|
||||||
}
|
}
|
||||||
const result = await forkJoin(observables).toPromise();
|
const result = await firstValueFrom(forkJoin(observables));
|
||||||
|
|
||||||
const dictionaryData = {};
|
const dictionaryData = {};
|
||||||
for (let i = 0; i < this.dossierTemplates.length; i++) {
|
for (let i = 0; i < this.dossierTemplates.length; i++) {
|
||||||
@ -113,7 +113,7 @@ export class AppStateService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async refreshDossierTemplateDictionaryData(dossierTemplateId: string) {
|
async refreshDossierTemplateDictionaryData(dossierTemplateId: string) {
|
||||||
this._dictionaryData[dossierTemplateId] = await this._getDictionaryDataForDossierTemplate$(dossierTemplateId).toPromise();
|
this._dictionaryData[dossierTemplateId] = await firstValueFrom(this._getDictionaryDataForDossierTemplate$(dossierTemplateId));
|
||||||
}
|
}
|
||||||
|
|
||||||
loadColors(dossierTemplateId: string) {
|
loadColors(dossierTemplateId: string) {
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { catchError, filter, mergeMap, switchMap, take, tap } from 'rxjs/operators';
|
import { catchError, filter, mergeMap, switchMap, take, tap } from 'rxjs/operators';
|
||||||
import { ConfigService } from '@services/config.service';
|
import { ConfigService } from '@services/config.service';
|
||||||
import { Title } from '@angular/platform-browser';
|
import { Title } from '@angular/platform-browser';
|
||||||
import { from, of, throwError } from 'rxjs';
|
import { firstValueFrom, from, of, throwError } from 'rxjs';
|
||||||
import { KeycloakEventType, KeycloakService } from 'keycloak-angular';
|
import { KeycloakEventType, KeycloakService } from 'keycloak-angular';
|
||||||
import { GeneralSettingsService } from '@services/general-settings.service';
|
import { GeneralSettingsService } from '@services/general-settings.service';
|
||||||
import { LanguageService } from '@i18n/language.service';
|
import { LanguageService } from '@i18n/language.service';
|
||||||
@ -18,8 +18,8 @@ export function configurationInitializer(
|
|||||||
userPreferenceService: UserPreferenceService,
|
userPreferenceService: UserPreferenceService,
|
||||||
) {
|
) {
|
||||||
return () =>
|
return () =>
|
||||||
keycloakService.keycloakEvents$
|
firstValueFrom(
|
||||||
.pipe(
|
keycloakService.keycloakEvents$.pipe(
|
||||||
filter(event => event.type === KeycloakEventType.OnReady),
|
filter(event => event.type === KeycloakEventType.OnReady),
|
||||||
switchMap(() => from(keycloakService.isLoggedIn())),
|
switchMap(() => from(keycloakService.isLoggedIn())),
|
||||||
switchMap(loggedIn => (!loggedIn ? throwError('Not Logged In') : of({}))),
|
switchMap(loggedIn => (!loggedIn ? throwError('Not Logged In') : of({}))),
|
||||||
@ -34,6 +34,6 @@ export function configurationInitializer(
|
|||||||
}),
|
}),
|
||||||
tap(() => languageService.chooseAndSetInitialLanguage()),
|
tap(() => languageService.chooseAndSetInitialLanguage()),
|
||||||
take(1),
|
take(1),
|
||||||
)
|
),
|
||||||
.toPromise();
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
Subproject commit 650c16b80387943f1de0efa876215559f56d123b
|
Subproject commit df28e3578b9e8aa2daae87dd9ddb9e851ba8cf34
|
||||||
Loading…
x
Reference in New Issue
Block a user