Removed app state service
This commit is contained in:
parent
638cb7060e
commit
76996afbf0
@ -1,10 +1,8 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { UserService } from '@services/user.service';
|
import { UserService } from '@services/user.service';
|
||||||
import { AppStateService } from '@state/app-state.service';
|
|
||||||
import { UserPreferenceService } from '@services/user-preference.service';
|
import { UserPreferenceService } from '@services/user-preference.service';
|
||||||
import { NavigationStart, Router } from '@angular/router';
|
import { NavigationStart, Router } from '@angular/router';
|
||||||
import { Title } from '@angular/platform-browser';
|
import { Title } from '@angular/platform-browser';
|
||||||
import { FileDownloadService } from '@upload-download/services/file-download.service';
|
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { SpotlightSearchAction } from '@components/spotlight-search/spotlight-search-action';
|
import { SpotlightSearchAction } from '@components/spotlight-search/spotlight-search-action';
|
||||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||||
@ -34,13 +32,11 @@ export class BaseScreenComponent {
|
|||||||
name: _('top-bar.navigation-items.my-account.children.account'),
|
name: _('top-bar.navigation-items.my-account.children.account'),
|
||||||
routerLink: '/main/account',
|
routerLink: '/main/account',
|
||||||
show: true,
|
show: true,
|
||||||
action: this.appStateService.reset,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: _('top-bar.navigation-items.my-account.children.admin'),
|
name: _('top-bar.navigation-items.my-account.children.admin'),
|
||||||
routerLink: '/main/admin',
|
routerLink: '/main/admin',
|
||||||
show: this.currentUser.isManager || this.currentUser.isUserAdmin,
|
show: this.currentUser.isManager || this.currentUser.isUserAdmin,
|
||||||
action: this.appStateService.reset,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: _('top-bar.navigation-items.my-account.children.downloads'),
|
name: _('top-bar.navigation-items.my-account.children.downloads'),
|
||||||
@ -75,7 +71,6 @@ export class BaseScreenComponent {
|
|||||||
readonly isSearchScreen$ = this._navigationStart$.pipe(map(isSearchScreen));
|
readonly isSearchScreen$ = this._navigationStart$.pipe(map(isSearchScreen));
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
readonly appStateService: AppStateService,
|
|
||||||
readonly userService: UserService,
|
readonly userService: UserService,
|
||||||
readonly userPreferenceService: UserPreferenceService,
|
readonly userPreferenceService: UserPreferenceService,
|
||||||
readonly titleService: Title,
|
readonly titleService: Title,
|
||||||
|
|||||||
@ -24,7 +24,7 @@ export class FileDataModel {
|
|||||||
private readonly _file: File,
|
private readonly _file: File,
|
||||||
private _redactionLog: IRedactionLog,
|
private _redactionLog: IRedactionLog,
|
||||||
public viewedPages?: IViewedPage[],
|
public viewedPages?: IViewedPage[],
|
||||||
private _dictionaryData?: { [p: string]: Dictionary },
|
private _dictionaryData?: Dictionary[],
|
||||||
private _areDevFeaturesEnabled?: boolean,
|
private _areDevFeaturesEnabled?: boolean,
|
||||||
) {
|
) {
|
||||||
this._buildAllAnnotations();
|
this._buildAllAnnotations();
|
||||||
@ -83,7 +83,8 @@ export class FileDataModel {
|
|||||||
// copy the redactionLog Entry
|
// copy the redactionLog Entry
|
||||||
|
|
||||||
const changeLogValues = this.#getChangeLogValues(redactionLogEntry);
|
const changeLogValues = this.#getChangeLogValues(redactionLogEntry);
|
||||||
if (!this._dictionaryData[redactionLogEntry.type]) {
|
const dictionaryData = this._dictionaryData.find(dict => dict.type === redactionLogEntry.type);
|
||||||
|
if (!dictionaryData) {
|
||||||
this.missingTypes.add(redactionLogEntry.type);
|
this.missingTypes.add(redactionLogEntry.type);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -94,7 +95,7 @@ export class FileDataModel {
|
|||||||
changeLogValues.isChangeLogEntry,
|
changeLogValues.isChangeLogEntry,
|
||||||
changeLogValues.hidden,
|
changeLogValues.hidden,
|
||||||
this.redactionLog.legalBasis,
|
this.redactionLog.legalBasis,
|
||||||
!!this._dictionaryData[redactionLogEntry.type]?.hint,
|
!!dictionaryData?.hint,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
import { Component, HostBinding, Input, OnInit } from '@angular/core';
|
import { Component, HostBinding, Input, OnInit } from '@angular/core';
|
||||||
import { UserPreferenceService } from '@services/user-preference.service';
|
import { UserPreferenceService } from '@services/user-preference.service';
|
||||||
import { AppStateService } from '@state/app-state.service';
|
|
||||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||||
import { adminSideNavTranslations } from '../translations/admin-side-nav-translations';
|
import { adminSideNavTranslations } from '../translations/admin-side-nav-translations';
|
||||||
import { UserService } from '@services/user.service';
|
import { UserService } from '@services/user.service';
|
||||||
|
import { ActivatedRoute } from '@angular/router';
|
||||||
|
|
||||||
type Type = 'settings' | 'dossierTemplates';
|
type Type = 'settings' | 'dossierTemplates';
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ export class AdminSideNavComponent implements OnInit {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly _userService: UserService,
|
private readonly _userService: UserService,
|
||||||
private readonly _appStateService: AppStateService,
|
private readonly _route: ActivatedRoute,
|
||||||
readonly userPreferenceService: UserPreferenceService,
|
readonly userPreferenceService: UserPreferenceService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
@ -77,6 +77,6 @@ export class AdminSideNavComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.prefix = this._appStateService.activeDictionaryType ? '../../' : '../';
|
this.prefix = this._route.snapshot.paramMap.get('dictionary') ? '../../' : '../';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,23 +9,14 @@
|
|||||||
<mat-icon svgIcon="iqser:arrow-right"></mat-icon>
|
<mat-icon svgIcon="iqser:arrow-right"></mat-icon>
|
||||||
|
|
||||||
<ng-container *ngIf="dossierTemplate$ | async as dossierTemplate">
|
<ng-container *ngIf="dossierTemplate$ | async as dossierTemplate">
|
||||||
<a [class.active]="!appStateService.activeDictionaryType" [routerLink]="dossierTemplate.routerLink" class="breadcrumb ml-0">
|
<a [class.active]="(activeDictionary$ | async) === undefined" [routerLink]="dossierTemplate.routerLink" class="breadcrumb ml-0">
|
||||||
{{ dossierTemplate.name }}
|
{{ dossierTemplate.name }}
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<ng-container *ngIf="appStateService.activeDictionary">
|
<ng-container *ngIf="activeDictionary$ | async as activeDictionary">
|
||||||
<mat-icon svgIcon="iqser:arrow-right"></mat-icon>
|
<mat-icon svgIcon="iqser:arrow-right"></mat-icon>
|
||||||
<a
|
<a [routerLink]="activeDictionary.routerLink" class="breadcrumb ml-0" routerLinkActive="active">
|
||||||
[routerLink]="
|
{{ activeDictionary.label }}
|
||||||
'/main/admin/dossier-templates/' +
|
|
||||||
dossierTemplate.dossierTemplateId +
|
|
||||||
'/dictionaries/' +
|
|
||||||
appStateService.activeDictionaryType
|
|
||||||
"
|
|
||||||
class="breadcrumb ml-0"
|
|
||||||
routerLinkActive="active"
|
|
||||||
>
|
|
||||||
{{ appStateService.activeDictionary.label }}
|
|
||||||
</a>
|
</a>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
import { Component, Input } from '@angular/core';
|
import { Component, Input } from '@angular/core';
|
||||||
import { AppStateService } from '@state/app-state.service';
|
|
||||||
import { UserPreferenceService } from '@services/user-preference.service';
|
import { UserPreferenceService } from '@services/user-preference.service';
|
||||||
import { PermissionsService } from '@services/permissions.service';
|
import { PermissionsService } from '@services/permissions.service';
|
||||||
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
|
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable, of } from 'rxjs';
|
||||||
import { map, switchMap } from 'rxjs/operators';
|
import { map, switchMap } from 'rxjs/operators';
|
||||||
import { ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute } from '@angular/router';
|
||||||
import { DossierTemplate } from '@red/domain';
|
import { Dictionary, DossierTemplate } from '@red/domain';
|
||||||
|
import { DictionariesMapService } from '@services/entity-services/dictionaries-map.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-dossier-template-breadcrumbs',
|
selector: 'redaction-dossier-template-breadcrumbs',
|
||||||
@ -16,17 +16,24 @@ import { DossierTemplate } from '@red/domain';
|
|||||||
export class DossierTemplateBreadcrumbsComponent {
|
export class DossierTemplateBreadcrumbsComponent {
|
||||||
@Input() root = false;
|
@Input() root = false;
|
||||||
readonly dossierTemplate$: Observable<DossierTemplate>;
|
readonly dossierTemplate$: Observable<DossierTemplate>;
|
||||||
|
readonly activeDictionary$: Observable<Dictionary>;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
readonly userPreferenceService: UserPreferenceService,
|
readonly userPreferenceService: UserPreferenceService,
|
||||||
readonly permissionService: PermissionsService,
|
readonly permissionService: PermissionsService,
|
||||||
readonly appStateService: AppStateService,
|
|
||||||
readonly dossierTemplatesService: DossierTemplatesService,
|
readonly dossierTemplatesService: DossierTemplatesService,
|
||||||
|
readonly dictionariesMapService: DictionariesMapService,
|
||||||
private readonly _route: ActivatedRoute,
|
private readonly _route: ActivatedRoute,
|
||||||
) {
|
) {
|
||||||
this.dossierTemplate$ = _route.paramMap.pipe(
|
this.dossierTemplate$ = _route.paramMap.pipe(
|
||||||
map(params => params.get('dossierTemplateId')),
|
map(params => params.get('dossierTemplateId')),
|
||||||
switchMap((dossierTemplateId: string) => this.dossierTemplatesService.getEntityChanged$(dossierTemplateId)),
|
switchMap((dossierTemplateId: string) => this.dossierTemplatesService.getEntityChanged$(dossierTemplateId)),
|
||||||
);
|
);
|
||||||
|
this.activeDictionary$ = _route.paramMap.pipe(
|
||||||
|
map(params => [params.get('dossierTemplateId'), params.get('dictionary')]),
|
||||||
|
switchMap(([dossierTemplateId, dictionary]: [string, string]) =>
|
||||||
|
dictionary ? this.dictionariesMapService.watch$(dossierTemplateId, dictionary) : of(undefined),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,13 +5,13 @@ 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';
|
||||||
import { AppStateService } from '@state/app-state.service';
|
|
||||||
import { toSnakeCase } from '@utils/functions';
|
import { toSnakeCase } from '@utils/functions';
|
||||||
import { DictionaryService } from '@shared/services/dictionary.service';
|
import { DictionaryService } from '@shared/services/dictionary.service';
|
||||||
import { Dictionary, IDictionary } from '@red/domain';
|
import { Dictionary, IDictionary } from '@red/domain';
|
||||||
import { UserService } from '@services/user.service';
|
import { UserService } from '@services/user.service';
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
import { HttpStatusCode } from '@angular/common/http';
|
import { HttpStatusCode } from '@angular/common/http';
|
||||||
|
import { DictionariesMapService } from '@services/entity-services/dictionaries-map.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-add-edit-dictionary-dialog',
|
selector: 'redaction-add-edit-dictionary-dialog',
|
||||||
@ -34,7 +34,7 @@ export class AddEditDictionaryDialogComponent extends BaseDialogComponent {
|
|||||||
readonly userService: UserService,
|
readonly userService: UserService,
|
||||||
private readonly _toaster: Toaster,
|
private readonly _toaster: Toaster,
|
||||||
private readonly _formBuilder: FormBuilder,
|
private readonly _formBuilder: FormBuilder,
|
||||||
private readonly _appStateService: AppStateService,
|
private readonly _dictionariesMapService: DictionariesMapService,
|
||||||
private readonly _translateService: TranslateService,
|
private readonly _translateService: TranslateService,
|
||||||
private readonly _dictionaryService: DictionaryService,
|
private readonly _dictionaryService: DictionaryService,
|
||||||
protected readonly _injector: Injector,
|
protected readonly _injector: Injector,
|
||||||
@ -103,7 +103,7 @@ export class AddEditDictionaryDialogComponent extends BaseDialogComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _toTechnicalName(value: string) {
|
private _toTechnicalName(value: string) {
|
||||||
const existingTechnicalNames = Object.keys(this._appStateService.dictionaryData[this._dossierTemplateId]);
|
const existingTechnicalNames = this._dictionariesMapService.get(this._dossierTemplateId).map(dict => dict.type);
|
||||||
const baseTechnicalName = toSnakeCase(value.trim());
|
const baseTechnicalName = toSnakeCase(value.trim());
|
||||||
let technicalName = baseTechnicalName;
|
let technicalName = baseTechnicalName;
|
||||||
let suffix = 1;
|
let suffix = 1;
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import { Component, Inject, Injector } from '@angular/core';
|
import { Component, Inject, Injector } from '@angular/core';
|
||||||
import { AppStateService } from '@state/app-state.service';
|
|
||||||
import { AbstractControl, FormBuilder, FormGroup, Validators } from '@angular/forms';
|
import { AbstractControl, 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 * as moment from 'moment';
|
import * as moment from 'moment';
|
||||||
@ -11,7 +10,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';
|
import { DictionaryService } from '../../../shared/services/dictionary.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: './add-edit-dossier-template-dialog.component.html',
|
templateUrl: './add-edit-dossier-template-dialog.component.html',
|
||||||
@ -31,9 +30,9 @@ export class AddEditDossierTemplateDialogComponent extends BaseDialogComponent {
|
|||||||
private _lastValidTo: Moment;
|
private _lastValidTo: Moment;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly _appStateService: AppStateService,
|
|
||||||
private readonly _toaster: Toaster,
|
private readonly _toaster: Toaster,
|
||||||
private readonly _dossierTemplatesService: DossierTemplatesService,
|
private readonly _dossierTemplatesService: DossierTemplatesService,
|
||||||
|
private readonly _dictionaryService: DictionaryService,
|
||||||
private readonly _formBuilder: FormBuilder,
|
private readonly _formBuilder: FormBuilder,
|
||||||
protected readonly _injector: Injector,
|
protected readonly _injector: Injector,
|
||||||
protected readonly _dialogRef: MatDialogRef<AddEditDossierTemplateDialogComponent>,
|
protected readonly _dialogRef: MatDialogRef<AddEditDossierTemplateDialogComponent>,
|
||||||
@ -81,7 +80,7 @@ export class AddEditDossierTemplateDialogComponent extends BaseDialogComponent {
|
|||||||
validTo: this.hasValidTo ? this.form.get('validTo').value : null,
|
validTo: this.hasValidTo ? this.form.get('validTo').value : null,
|
||||||
} as IDossierTemplate;
|
} as IDossierTemplate;
|
||||||
await this._dossierTemplatesService.createOrUpdate(dossierTemplate).toPromise();
|
await this._dossierTemplatesService.createOrUpdate(dossierTemplate).toPromise();
|
||||||
await this._appStateService.loadDictionaryData();
|
await this._dictionaryService.loadDictionaryData();
|
||||||
this._dialogRef.close(true);
|
this._dialogRef.close(true);
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
const message =
|
const message =
|
||||||
|
|||||||
@ -4,10 +4,10 @@ import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
|||||||
import { FileAttributeEncodingTypes, IFileAttributesConfig } from '../../../../../../../../libs/red-domain/src';
|
import { FileAttributeEncodingTypes, IFileAttributesConfig } from '../../../../../../../../libs/red-domain/src';
|
||||||
import { fileAttributeEncodingTypesTranslations } from '../../translations/file-attribute-encoding-types-translations';
|
import { fileAttributeEncodingTypesTranslations } from '../../translations/file-attribute-encoding-types-translations';
|
||||||
import { BaseDialogComponent, Toaster } from '../../../../../../../../libs/common-ui/src';
|
import { BaseDialogComponent, Toaster } from '../../../../../../../../libs/common-ui/src';
|
||||||
import { DossierTemplatesService } from '../../../../services/entity-services/dossier-templates.service';
|
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
|
||||||
import { firstValueFrom } from 'rxjs';
|
import { firstValueFrom } from 'rxjs';
|
||||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||||
import { FileAttributesService } from '../../../../services/entity-services/file-attributes.service';
|
import { FileAttributesService } from '@services/entity-services/file-attributes.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: './file-attributes-configurations-dialog.component.html',
|
templateUrl: './file-attributes-configurations-dialog.component.html',
|
||||||
@ -15,10 +15,9 @@ import { FileAttributesService } from '../../../../services/entity-services/file
|
|||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
})
|
})
|
||||||
export class FileAttributesConfigurationsDialogComponent extends BaseDialogComponent {
|
export class FileAttributesConfigurationsDialogComponent extends BaseDialogComponent {
|
||||||
private readonly _configuration: IFileAttributesConfig = this._data;
|
|
||||||
|
|
||||||
readonly encodingTypeOptions = Object.keys(FileAttributeEncodingTypes);
|
readonly encodingTypeOptions = Object.keys(FileAttributeEncodingTypes);
|
||||||
readonly translations = fileAttributeEncodingTypesTranslations;
|
readonly translations = fileAttributeEncodingTypesTranslations;
|
||||||
|
private readonly _configuration: IFileAttributesConfig = this._data;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly _formBuilder: FormBuilder,
|
private readonly _formBuilder: FormBuilder,
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import { ChangeDetectionStrategy, Component, forwardRef, Injector, OnInit } from '@angular/core';
|
import { ChangeDetectionStrategy, Component, forwardRef, Injector, OnInit } from '@angular/core';
|
||||||
import { AppStateService } from '@state/app-state.service';
|
|
||||||
import { DefaultColorType, IColors } from '@red/domain';
|
import { DefaultColorType, IColors } from '@red/domain';
|
||||||
import { AdminDialogService } from '../../services/admin-dialog.service';
|
import { AdminDialogService } from '../../services/admin-dialog.service';
|
||||||
import {
|
import {
|
||||||
@ -43,7 +42,6 @@ export class DefaultColorsScreenComponent extends ListingComponent<ListItem> imp
|
|||||||
protected readonly _injector: Injector,
|
protected readonly _injector: Injector,
|
||||||
private readonly _userService: UserService,
|
private readonly _userService: UserService,
|
||||||
private readonly _loadingService: LoadingService,
|
private readonly _loadingService: LoadingService,
|
||||||
private readonly _appStateService: AppStateService,
|
|
||||||
private readonly _dossierTemplatesService: DossierTemplatesService,
|
private readonly _dossierTemplatesService: DossierTemplatesService,
|
||||||
private readonly _dialogService: AdminDialogService,
|
private readonly _dialogService: AdminDialogService,
|
||||||
private readonly _dictionaryService: DictionaryService,
|
private readonly _dictionaryService: DictionaryService,
|
||||||
@ -66,14 +64,14 @@ export class DefaultColorsScreenComponent extends ListingComponent<ListItem> imp
|
|||||||
},
|
},
|
||||||
async () => {
|
async () => {
|
||||||
await this._loadColors();
|
await this._loadColors();
|
||||||
await this._appStateService.refreshDossierTemplate(this._dossierTemplatesService.activeDossierTemplateId);
|
await this._dictionaryService.refreshDossierTemplate(this._dossierTemplatesService.activeDossierTemplateId);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _loadColors() {
|
private async _loadColors() {
|
||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
const data = await firstValueFrom(this._appStateService.loadColors(this._dossierTemplatesService.activeDossierTemplateId));
|
const data = await firstValueFrom(this._dictionaryService.getColors(this._dossierTemplatesService.activeDossierTemplateId));
|
||||||
this._colorsObj = data;
|
this._colorsObj = data;
|
||||||
const entities = Object.keys(data)
|
const entities = Object.keys(data)
|
||||||
.map(key => ({
|
.map(key => ({
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
import { Component, forwardRef, Injector, OnInit } from '@angular/core';
|
import { Component, forwardRef, Injector, OnInit } from '@angular/core';
|
||||||
import { DoughnutChartConfig } from '@shared/components/simple-doughnut-chart/simple-doughnut-chart.component';
|
import { DoughnutChartConfig } from '@shared/components/simple-doughnut-chart/simple-doughnut-chart.component';
|
||||||
import { AppStateService } from '@state/app-state.service';
|
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import {
|
import {
|
||||||
CircleButtonTypes,
|
CircleButtonTypes,
|
||||||
@ -20,6 +19,7 @@ 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';
|
||||||
|
import { DictionariesMapService } from '@services/entity-services/dictionaries-map.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: './dictionary-listing-screen.component.html',
|
templateUrl: './dictionary-listing-screen.component.html',
|
||||||
@ -44,8 +44,8 @@ export class DictionaryListingScreenComponent extends ListingComponent<Dictionar
|
|||||||
protected readonly _injector: Injector,
|
protected readonly _injector: Injector,
|
||||||
private readonly _userService: UserService,
|
private readonly _userService: UserService,
|
||||||
private readonly _loadingService: LoadingService,
|
private readonly _loadingService: LoadingService,
|
||||||
private readonly _appStateService: AppStateService,
|
|
||||||
private readonly _dossierTemplatesService: DossierTemplatesService,
|
private readonly _dossierTemplatesService: DossierTemplatesService,
|
||||||
|
private readonly _dictionariesMapService: DictionariesMapService,
|
||||||
private readonly _dialogService: AdminDialogService,
|
private readonly _dialogService: AdminDialogService,
|
||||||
private readonly _translateService: TranslateService,
|
private readonly _translateService: TranslateService,
|
||||||
private readonly _dictionaryService: DictionaryService,
|
private readonly _dictionaryService: DictionaryService,
|
||||||
@ -95,11 +95,12 @@ export class DictionaryListingScreenComponent extends ListingComponent<Dictionar
|
|||||||
|
|
||||||
private async _loadDictionaryData(refresh = true): Promise<void> {
|
private async _loadDictionaryData(refresh = true): Promise<void> {
|
||||||
if (refresh) {
|
if (refresh) {
|
||||||
await this._appStateService.loadDictionaryData();
|
await this._dictionaryService.loadDictionaryData();
|
||||||
}
|
}
|
||||||
|
|
||||||
const appStateDictionaryData = this._appStateService.dictionaryData[this._dossierTemplatesService.activeDossierTemplateId];
|
const entities: Dictionary[] = this._dictionariesMapService
|
||||||
const entities = Object.values(appStateDictionaryData).filter(d => !d.virtual);
|
.get(this._dossierTemplatesService.activeDossierTemplateId)
|
||||||
|
.filter(d => !d.virtual);
|
||||||
this.entitiesService.setEntities(entities);
|
this.entitiesService.setEntities(entities);
|
||||||
|
|
||||||
this._calculateData();
|
this._calculateData();
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
<section>
|
<section *ngIf="dictionary$ | async as dictionary">
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<redaction-dossier-template-breadcrumbs></redaction-dossier-template-breadcrumbs>
|
<redaction-dossier-template-breadcrumbs></redaction-dossier-template-breadcrumbs>
|
||||||
|
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
<iqser-circle-button
|
<iqser-circle-button
|
||||||
(action)="openDeleteDictionaryDialog($event)"
|
(action)="openDeleteDictionaryDialog(dictionary, $event)"
|
||||||
*ngIf="currentUser.isAdmin"
|
*ngIf="currentUser.isAdmin"
|
||||||
[tooltip]="'dictionary-overview.action.delete' | translate"
|
[tooltip]="'dictionary-overview.action.delete' | translate"
|
||||||
[type]="circleButtonTypes.dark"
|
[type]="circleButtonTypes.dark"
|
||||||
@ -13,7 +13,7 @@
|
|||||||
></iqser-circle-button>
|
></iqser-circle-button>
|
||||||
|
|
||||||
<iqser-circle-button
|
<iqser-circle-button
|
||||||
(action)="openEditDictionaryDialog($event)"
|
(action)="openEditDictionaryDialog(dictionary, $event)"
|
||||||
*ngIf="currentUser.isAdmin"
|
*ngIf="currentUser.isAdmin"
|
||||||
[tooltip]="'dictionary-overview.action.edit' | translate"
|
[tooltip]="'dictionary-overview.action.edit' | translate"
|
||||||
[type]="circleButtonTypes.dark"
|
[type]="circleButtonTypes.dark"
|
||||||
@ -22,7 +22,7 @@
|
|||||||
></iqser-circle-button>
|
></iqser-circle-button>
|
||||||
|
|
||||||
<iqser-circle-button
|
<iqser-circle-button
|
||||||
(action)="download()"
|
(action)="download(dictionary)"
|
||||||
[tooltip]="'dictionary-overview.action.download' | translate"
|
[tooltip]="'dictionary-overview.action.download' | translate"
|
||||||
icon="iqser:download"
|
icon="iqser:download"
|
||||||
tooltipPosition="below"
|
tooltipPosition="below"
|
||||||
@ -55,11 +55,11 @@
|
|||||||
|
|
||||||
<redaction-dictionary-manager
|
<redaction-dictionary-manager
|
||||||
#dictionaryManager
|
#dictionaryManager
|
||||||
(saveDictionary)="save()"
|
(saveDictionary)="save(dictionary)"
|
||||||
[canEdit]="currentUser.isAdmin"
|
[canEdit]="currentUser.isAdmin"
|
||||||
[isLeavingPage]="isLeavingPage"
|
|
||||||
[filterByDossierTemplate]="true"
|
[filterByDossierTemplate]="true"
|
||||||
[initialEntries]="initialEntries"
|
[initialEntries]="initialEntries"
|
||||||
|
[isLeavingPage]="isLeavingPage"
|
||||||
></redaction-dictionary-manager>
|
></redaction-dictionary-manager>
|
||||||
|
|
||||||
<div *ngIf="!!dictionary" class="right-container">
|
<div *ngIf="!!dictionary" class="right-container">
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import { Component, ElementRef, OnDestroy, OnInit, ViewChild } from '@angular/core';
|
import { Component, ElementRef, ViewChild } from '@angular/core';
|
||||||
import { AppStateService } from '@state/app-state.service';
|
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { saveAs } from 'file-saver';
|
import { saveAs } from 'file-saver';
|
||||||
@ -10,20 +9,23 @@ 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';
|
import { firstValueFrom, Observable, of } from 'rxjs';
|
||||||
|
import { DictionariesMapService } from '@services/entity-services/dictionaries-map.service';
|
||||||
|
import { map, switchMap } from 'rxjs/operators';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: './dictionary-overview-screen.component.html',
|
templateUrl: './dictionary-overview-screen.component.html',
|
||||||
styleUrls: ['./dictionary-overview-screen.component.scss'],
|
styleUrls: ['./dictionary-overview-screen.component.scss'],
|
||||||
})
|
})
|
||||||
export class DictionaryOverviewScreenComponent implements OnInit, OnDestroy {
|
export class DictionaryOverviewScreenComponent {
|
||||||
readonly circleButtonTypes = CircleButtonTypes;
|
readonly circleButtonTypes = CircleButtonTypes;
|
||||||
readonly currentUser = this._userService.currentUser;
|
readonly currentUser = this._userService.currentUser;
|
||||||
|
|
||||||
initialEntries: string[] = [];
|
initialEntries: string[] = [];
|
||||||
dictionary: Dictionary;
|
|
||||||
isLeavingPage = false;
|
isLeavingPage = false;
|
||||||
|
|
||||||
|
readonly dictionary$: Observable<Dictionary>;
|
||||||
|
|
||||||
@ViewChild('dictionaryManager', { static: false })
|
@ViewChild('dictionaryManager', { static: false })
|
||||||
private readonly _dictionaryManager: DictionaryManagerComponent;
|
private readonly _dictionaryManager: DictionaryManagerComponent;
|
||||||
@ViewChild('fileInput') private readonly _fileInput: ElementRef;
|
@ViewChild('fileInput') private readonly _fileInput: ElementRef;
|
||||||
@ -33,46 +35,48 @@ export class DictionaryOverviewScreenComponent implements OnInit, OnDestroy {
|
|||||||
private readonly _userService: UserService,
|
private readonly _userService: UserService,
|
||||||
private readonly _activatedRoute: ActivatedRoute,
|
private readonly _activatedRoute: ActivatedRoute,
|
||||||
private readonly _loadingService: LoadingService,
|
private readonly _loadingService: LoadingService,
|
||||||
private readonly _appStateService: AppStateService,
|
|
||||||
private readonly _dossierTemplatesService: DossierTemplatesService,
|
private readonly _dossierTemplatesService: DossierTemplatesService,
|
||||||
private readonly _dialogService: AdminDialogService,
|
private readonly _dialogService: AdminDialogService,
|
||||||
protected readonly _translateService: TranslateService,
|
protected readonly _translateService: TranslateService,
|
||||||
private readonly _dictionaryService: DictionaryService,
|
private readonly _dictionaryService: DictionaryService,
|
||||||
) {}
|
private readonly _dictionariesMapService: DictionariesMapService,
|
||||||
|
private readonly _route: ActivatedRoute,
|
||||||
|
) {
|
||||||
|
this.dictionary$ = _route.paramMap.pipe(
|
||||||
|
map(params => [params.get('dossierTemplateId'), params.get('dictionary')]),
|
||||||
|
switchMap(([dossierTemplateId, dictionary]: [string, string]) =>
|
||||||
|
dossierTemplateId ? this._dictionariesMapService.watch$(dossierTemplateId, dictionary) : of(undefined),
|
||||||
|
),
|
||||||
|
switchMap(dictionary => this._loadEntries(dictionary)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
get changed() {
|
get changed() {
|
||||||
return this._dictionaryManager.editor.hasChanges;
|
return this._dictionaryManager.editor.hasChanges;
|
||||||
}
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
openEditDictionaryDialog(dictionary: Dictionary, $event: MouseEvent) {
|
||||||
this._appStateService.activateDictionary(this._activatedRoute.snapshot.params.dictionary);
|
|
||||||
this.dictionary = this._appStateService.activeDictionary;
|
|
||||||
await this._loadEntries();
|
|
||||||
}
|
|
||||||
|
|
||||||
openEditDictionaryDialog($event: any) {
|
|
||||||
this._dialogService.openDialog(
|
this._dialogService.openDialog(
|
||||||
'addEditDictionary',
|
'addEditDictionary',
|
||||||
$event,
|
$event,
|
||||||
{
|
{
|
||||||
dictionary: this.dictionary,
|
dictionary,
|
||||||
dossierTemplateId: this.dictionary.dossierTemplateId,
|
dossierTemplateId: dictionary.dossierTemplateId,
|
||||||
},
|
},
|
||||||
async () => {
|
async () => {
|
||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
await this._appStateService.loadDictionaryData();
|
await this._dictionaryService.loadDictionaryData();
|
||||||
this.dictionary = this._appStateService.activeDictionary;
|
|
||||||
this._loadingService.stop();
|
this._loadingService.stop();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
openDeleteDictionaryDialog($event?: MouseEvent) {
|
openDeleteDictionaryDialog(dictionary: Dictionary, $event?: MouseEvent) {
|
||||||
$event?.stopPropagation();
|
$event?.stopPropagation();
|
||||||
|
|
||||||
this._dialogService.openDialog('confirm', $event, null, async () => {
|
this._dialogService.openDialog('confirm', $event, null, async () => {
|
||||||
await firstValueFrom(this._dictionaryService.deleteDictionaries([this.dictionary.type], this.dictionary.dossierTemplateId));
|
await firstValueFrom(this._dictionaryService.deleteDictionaries([dictionary.type], dictionary.dossierTemplateId));
|
||||||
await this._appStateService.loadDictionaryData();
|
await this._dictionaryService.loadDictionaryData();
|
||||||
await this._router.navigate([
|
await this._router.navigate([
|
||||||
'/main',
|
'/main',
|
||||||
'admin',
|
'admin',
|
||||||
@ -83,16 +87,16 @@ export class DictionaryOverviewScreenComponent implements OnInit, OnDestroy {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
download(): void {
|
download(dictionary: Dictionary): void {
|
||||||
const content = this._dictionaryManager.editor.value;
|
const content = this._dictionaryManager.editor.value;
|
||||||
const blob = new Blob([content], {
|
const blob = new Blob([content], {
|
||||||
type: 'text/plain;charset=utf-8',
|
type: 'text/plain;charset=utf-8',
|
||||||
});
|
});
|
||||||
saveAs(blob, `${this.dictionary.label}.txt`);
|
saveAs(blob, `${dictionary.label}.txt`);
|
||||||
}
|
}
|
||||||
|
|
||||||
upload($event): void {
|
upload($event): void {
|
||||||
const file = $event.target.files[0];
|
const file: File = $event.target.files[0];
|
||||||
const fileReader = new FileReader();
|
const fileReader = new FileReader();
|
||||||
|
|
||||||
if (file) {
|
if (file) {
|
||||||
@ -115,24 +119,18 @@ export class DictionaryOverviewScreenComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
save() {
|
async save(dictionary: Dictionary) {
|
||||||
const entries = this._dictionaryManager.editor?.currentEntries;
|
const entries = this._dictionaryManager.editor?.currentEntries;
|
||||||
|
|
||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
this._dictionaryService
|
try {
|
||||||
.saveEntries(entries, this.initialEntries, this.dictionary.dossierTemplateId, this.dictionary.type, null)
|
await firstValueFrom(
|
||||||
.subscribe(
|
this._dictionaryService.saveEntries(entries, this.initialEntries, dictionary.dossierTemplateId, dictionary.type, null),
|
||||||
async () => {
|
|
||||||
await this._loadEntries();
|
|
||||||
},
|
|
||||||
() => {
|
|
||||||
this._loadingService.stop();
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
}
|
await this._loadEntries(dictionary);
|
||||||
|
} catch (e) {
|
||||||
ngOnDestroy(): void {
|
this._loadingService.stop();
|
||||||
this._appStateService.reset();
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private _overwrite(fileContent: string): void {
|
private _overwrite(fileContent: string): void {
|
||||||
@ -148,24 +146,16 @@ export class DictionaryOverviewScreenComponent implements OnInit, OnDestroy {
|
|||||||
this._dictionaryManager.editor.value = currentEntries.join('\n');
|
this._dictionaryManager.editor.value = currentEntries.join('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _loadEntries() {
|
private async _loadEntries(dictionary: Dictionary) {
|
||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
await firstValueFrom(this._dictionaryService.getForType(this.dictionary.dossierTemplateId, this.dictionary.type))
|
try {
|
||||||
.then(
|
const data = await firstValueFrom(this._dictionaryService.getForType(dictionary.dossierTemplateId, dictionary.type));
|
||||||
data => {
|
this._loadingService.stop();
|
||||||
this._loadingService.stop();
|
this.initialEntries = [...data.entries].sort((str1, str2) => str1.localeCompare(str2, undefined, { sensitivity: 'accent' }));
|
||||||
this.initialEntries = [...data.entries].sort((str1, str2) =>
|
} catch (e) {
|
||||||
str1.localeCompare(str2, undefined, { sensitivity: 'accent' }),
|
this._loadingService.stop();
|
||||||
);
|
this.initialEntries = [];
|
||||||
},
|
}
|
||||||
() => {
|
return dictionary;
|
||||||
this._loadingService.stop();
|
|
||||||
this.initialEntries = [];
|
|
||||||
},
|
|
||||||
)
|
|
||||||
.catch(() => {
|
|
||||||
this._loadingService.stop();
|
|
||||||
this.initialEntries = [];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import { ChangeDetectionStrategy, Component, forwardRef, Injector } from '@angular/core';
|
import { ChangeDetectionStrategy, Component, forwardRef, Injector } from '@angular/core';
|
||||||
import { AppStateService } from '@state/app-state.service';
|
|
||||||
import { UserPreferenceService } from '@services/user-preference.service';
|
import { UserPreferenceService } from '@services/user-preference.service';
|
||||||
import { AdminDialogService } from '../../../services/admin-dialog.service';
|
import { AdminDialogService } from '../../../services/admin-dialog.service';
|
||||||
import { DossierTemplate } from '@red/domain';
|
import { DossierTemplate } from '@red/domain';
|
||||||
@ -19,6 +18,7 @@ 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';
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
import { DictionaryService } from '../../../../shared/services/dictionary.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: './dossier-templates-listing-screen.component.html',
|
templateUrl: './dossier-templates-listing-screen.component.html',
|
||||||
@ -48,7 +48,7 @@ export class DossierTemplatesListingScreenComponent extends ListingComponent<Dos
|
|||||||
protected readonly _injector: Injector,
|
protected readonly _injector: Injector,
|
||||||
private readonly _userService: UserService,
|
private readonly _userService: UserService,
|
||||||
private readonly _loadingService: LoadingService,
|
private readonly _loadingService: LoadingService,
|
||||||
private readonly _appStateService: AppStateService,
|
private readonly _dictionaryService: DictionaryService,
|
||||||
private readonly _dialogService: AdminDialogService,
|
private readonly _dialogService: AdminDialogService,
|
||||||
readonly routerHistoryService: RouterHistoryService,
|
readonly routerHistoryService: RouterHistoryService,
|
||||||
readonly userPreferenceService: UserPreferenceService,
|
readonly userPreferenceService: UserPreferenceService,
|
||||||
@ -75,6 +75,6 @@ export class DossierTemplatesListingScreenComponent extends ListingComponent<Dos
|
|||||||
this._toaster.error(_('dossier-templates-listing.error.generic'));
|
this._toaster.error(_('dossier-templates-listing.error.generic'));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
await this._appStateService.loadDictionaryData();
|
await this._dictionaryService.loadDictionaryData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import { ChangeDetectionStrategy, Component, ElementRef, forwardRef, Injector, OnDestroy, OnInit, ViewChild } from '@angular/core';
|
import { ChangeDetectionStrategy, Component, ElementRef, forwardRef, Injector, OnDestroy, OnInit, ViewChild } from '@angular/core';
|
||||||
import { AppStateService } from '@state/app-state.service';
|
|
||||||
import { AdminDialogService } from '../../services/admin-dialog.service';
|
import { AdminDialogService } from '../../services/admin-dialog.service';
|
||||||
import {
|
import {
|
||||||
CircleButtonTypes,
|
CircleButtonTypes,
|
||||||
@ -19,6 +18,7 @@ import { DossierTemplatesService } from '@services/entity-services/dossier-templ
|
|||||||
import { HttpStatusCode } from '@angular/common/http';
|
import { HttpStatusCode } from '@angular/common/http';
|
||||||
import { firstValueFrom } from 'rxjs';
|
import { firstValueFrom } from 'rxjs';
|
||||||
import { ReportTemplateService } from '../../../../services/report-template.service';
|
import { ReportTemplateService } from '../../../../services/report-template.service';
|
||||||
|
import { DictionaryService } from '../../../shared/services/dictionary.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: './file-attributes-listing-screen.component.html',
|
templateUrl: './file-attributes-listing-screen.component.html',
|
||||||
@ -57,7 +57,7 @@ export class FileAttributesListingScreenComponent extends ListingComponent<FileA
|
|||||||
private readonly _toaster: Toaster,
|
private readonly _toaster: Toaster,
|
||||||
private readonly _userService: UserService,
|
private readonly _userService: UserService,
|
||||||
private readonly _loadingService: LoadingService,
|
private readonly _loadingService: LoadingService,
|
||||||
private readonly _appStateService: AppStateService,
|
private readonly _dictionaryService: DictionaryService,
|
||||||
private readonly _dossierTemplatesService: DossierTemplatesService,
|
private readonly _dossierTemplatesService: DossierTemplatesService,
|
||||||
private readonly _dialogService: AdminDialogService,
|
private readonly _dialogService: AdminDialogService,
|
||||||
private readonly _fileAttributesService: FileAttributesService,
|
private readonly _fileAttributesService: FileAttributesService,
|
||||||
@ -108,7 +108,7 @@ export class FileAttributesListingScreenComponent extends ListingComponent<FileA
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
await this._appStateService.refreshDossierTemplate(dossierTemplateId);
|
await this._dictionaryService.refreshDossierTemplate(dossierTemplateId);
|
||||||
await this._loadData();
|
await this._loadData();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -144,7 +144,7 @@ export class FileAttributesListingScreenComponent extends ListingComponent<FileA
|
|||||||
}
|
}
|
||||||
this._loadingService.stop();
|
this._loadingService.stop();
|
||||||
});
|
});
|
||||||
await this._appStateService.refreshDossierTemplate(this._dossierTemplatesService.activeDossierTemplateId);
|
await this._dictionaryService.refreshDossierTemplate(this._dossierTemplatesService.activeDossierTemplateId);
|
||||||
await this._loadData();
|
await this._loadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import { Component, Input, OnInit } from '@angular/core';
|
import { Component, Input, OnInit } from '@angular/core';
|
||||||
import { AppStateService } from '@state/app-state.service';
|
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { AdminDialogService } from '../../../services/admin-dialog.service';
|
import { AdminDialogService } from '../../../services/admin-dialog.service';
|
||||||
import { CircleButtonTypes, LoadingService, Toaster } from '@iqser/common-ui';
|
import { CircleButtonTypes, LoadingService, Toaster } from '@iqser/common-ui';
|
||||||
@ -8,6 +7,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 { HttpStatusCode } from '@angular/common/http';
|
import { HttpStatusCode } from '@angular/common/http';
|
||||||
import { firstValueFrom } from 'rxjs';
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
import { DictionaryService } from '../../../../shared/services/dictionary.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-dossier-template-actions',
|
selector: 'redaction-dossier-template-actions',
|
||||||
@ -25,7 +25,7 @@ export class DossierTemplateActionsComponent implements OnInit {
|
|||||||
private readonly _toaster: Toaster,
|
private readonly _toaster: Toaster,
|
||||||
private readonly _userService: UserService,
|
private readonly _userService: UserService,
|
||||||
private readonly _loadingService: LoadingService,
|
private readonly _loadingService: LoadingService,
|
||||||
private readonly _appStateService: AppStateService,
|
private readonly _dictionaryService: DictionaryService,
|
||||||
private readonly _dialogService: AdminDialogService,
|
private readonly _dialogService: AdminDialogService,
|
||||||
private readonly _dossierTemplatesService: DossierTemplatesService,
|
private readonly _dossierTemplatesService: DossierTemplatesService,
|
||||||
) {}
|
) {}
|
||||||
@ -49,7 +49,7 @@ export class DossierTemplateActionsComponent implements OnInit {
|
|||||||
await firstValueFrom(this._dossierTemplatesService.delete([this.dossierTemplateId]))
|
await firstValueFrom(this._dossierTemplatesService.delete([this.dossierTemplateId]))
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
await firstValueFrom(this._dossierTemplatesService.loadAll());
|
await firstValueFrom(this._dossierTemplatesService.loadAll());
|
||||||
await this._appStateService.loadDictionaryData();
|
await this._dictionaryService.loadDictionaryData();
|
||||||
await this._router.navigate(['main', 'admin']);
|
await this._router.navigate(['main', 'admin']);
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
import { Component, Inject, Injector, OnInit } from '@angular/core';
|
import { Component, Inject, Injector, OnInit } from '@angular/core';
|
||||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||||
import { AppStateService } from '@state/app-state.service';
|
|
||||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||||
import { ManualRedactionEntryWrapper } from '@models/file/manual-redaction-entry.wrapper';
|
import { ManualRedactionEntryWrapper } from '@models/file/manual-redaction-entry.wrapper';
|
||||||
import { ManualAnnotationService } from '../../services/manual-annotation.service';
|
import { ManualAnnotationService } from '../../services/manual-annotation.service';
|
||||||
@ -33,7 +32,6 @@ export class ManualAnnotationDialogComponent extends BaseDialogComponent impleme
|
|||||||
private readonly _dossier: Dossier;
|
private readonly _dossier: Dossier;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly _appStateService: AppStateService,
|
|
||||||
private readonly _formBuilder: FormBuilder,
|
private readonly _formBuilder: FormBuilder,
|
||||||
private readonly _justificationsService: JustificationsService,
|
private readonly _justificationsService: JustificationsService,
|
||||||
private readonly _manualAnnotationService: ManualAnnotationService,
|
private readonly _manualAnnotationService: ManualAnnotationService,
|
||||||
@ -77,7 +75,7 @@ export class ManualAnnotationDialogComponent extends BaseDialogComponent impleme
|
|||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
super.ngOnInit();
|
super.ngOnInit();
|
||||||
this.possibleDictionaries = await this._appStateService.getDictionariesOptions(
|
this.possibleDictionaries = await this._dictionaryService.getDictionariesOptions(
|
||||||
this._dossier.dossierTemplateId,
|
this._dossier.dossierTemplateId,
|
||||||
this._dossier.dossierId,
|
this._dossier.dossierId,
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angular/core';
|
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angular/core';
|
||||||
import { AppStateService } from '@state/app-state.service';
|
|
||||||
import { DoughnutChartConfig } from '@shared/components/simple-doughnut-chart/simple-doughnut-chart.component';
|
import { DoughnutChartConfig } from '@shared/components/simple-doughnut-chart/simple-doughnut-chart.component';
|
||||||
import { TranslateChartService } from '@services/translate-chart.service';
|
import { TranslateChartService } from '@services/translate-chart.service';
|
||||||
import { UserService } from '@services/user.service';
|
import { UserService } from '@services/user.service';
|
||||||
@ -35,7 +34,6 @@ export class DossierDetailsComponent {
|
|||||||
readonly dossierStats$: Observable<DossierStats>;
|
readonly dossierStats$: Observable<DossierStats>;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
readonly appStateService: AppStateService,
|
|
||||||
readonly dossiersService: DossiersService,
|
readonly dossiersService: DossiersService,
|
||||||
readonly translateChartService: TranslateChartService,
|
readonly translateChartService: TranslateChartService,
|
||||||
readonly filterService: FilterService,
|
readonly filterService: FilterService,
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
|
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
|
||||||
import { AppStateService } from '@state/app-state.service';
|
|
||||||
import { File } from '@red/domain';
|
import { File } from '@red/domain';
|
||||||
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 { DictionariesMapService } from '@services/entity-services/dictionaries-map.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-file-workload',
|
selector: 'redaction-file-workload',
|
||||||
@ -14,8 +14,8 @@ export class FileWorkloadComponent {
|
|||||||
@Input() file: File;
|
@Input() file: File;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
public readonly userService: UserService,
|
readonly userService: UserService,
|
||||||
private readonly _appStateService: AppStateService,
|
private readonly _dictionariesMapService: DictionariesMapService,
|
||||||
private readonly _dossiersService: DossiersService,
|
private readonly _dossiersService: DossiersService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
@ -44,6 +44,6 @@ export class FileWorkloadComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _getDictionaryColor(type: string) {
|
private _getDictionaryColor(type: string) {
|
||||||
return this._appStateService.getDictionaryColor(type, this._dossiersService.find(this.file.dossierId).dossierTemplateId);
|
return this._dictionariesMapService.getDictionaryColor(type, this._dossiersService.find(this.file.dossierId).dossierTemplateId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
|
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
|
||||||
import { AppStateService } from '@state/app-state.service';
|
|
||||||
import { Dossier, DossierStats } from '@red/domain';
|
import { Dossier, DossierStats } from '@red/domain';
|
||||||
|
import { DictionariesMapService } from '@services/entity-services/dictionaries-map.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-dossier-workload-column',
|
selector: 'redaction-dossier-workload-column',
|
||||||
@ -12,17 +12,17 @@ export class DossierWorkloadColumnComponent {
|
|||||||
@Input() dossier: Dossier;
|
@Input() dossier: Dossier;
|
||||||
@Input() dossierStats: DossierStats;
|
@Input() dossierStats: DossierStats;
|
||||||
|
|
||||||
constructor(private readonly _appStateService: AppStateService) {}
|
constructor(private readonly _dictionariesMapService: DictionariesMapService) {}
|
||||||
|
|
||||||
get suggestionColor() {
|
get suggestionColor() {
|
||||||
return this._appStateService.getDictionaryColor('suggestion', this.dossier.dossierTemplateId);
|
return this._dictionariesMapService.getDictionaryColor('suggestion', this.dossier.dossierTemplateId);
|
||||||
}
|
}
|
||||||
|
|
||||||
get hintColor() {
|
get hintColor() {
|
||||||
return this._appStateService.getDictionaryColor('hint', this.dossier.dossierTemplateId);
|
return this._dictionariesMapService.getDictionaryColor('hint', this.dossier.dossierTemplateId);
|
||||||
}
|
}
|
||||||
|
|
||||||
get redactionColor() {
|
get redactionColor() {
|
||||||
return this._appStateService.getDictionaryColor('redaction', this.dossier.dossierTemplateId);
|
return this._dictionariesMapService.getDictionaryColor('redaction', this.dossier.dossierTemplateId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { Component, Input, OnChanges } from '@angular/core';
|
import { Component, Input, OnChanges } from '@angular/core';
|
||||||
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
||||||
import { AppStateService } from '@state/app-state.service';
|
|
||||||
import { FilePreviewStateService } from '../../services/file-preview-state.service';
|
import { FilePreviewStateService } from '../../services/file-preview-state.service';
|
||||||
|
import { DictionariesMapService } from '@services/entity-services/dictionaries-map.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-type-annotation-icon',
|
selector: 'redaction-type-annotation-icon',
|
||||||
@ -15,7 +15,7 @@ export class TypeAnnotationIconComponent implements OnChanges {
|
|||||||
color: string;
|
color: string;
|
||||||
type: 'square' | 'rhombus' | 'circle' | 'hexagon';
|
type: 'square' | 'rhombus' | 'circle' | 'hexagon';
|
||||||
|
|
||||||
constructor(private _appStateService: AppStateService, readonly screenStateService: FilePreviewStateService) {}
|
constructor(private _dictionariesMapService: DictionariesMapService, readonly screenStateService: FilePreviewStateService) {}
|
||||||
|
|
||||||
private get _dossierTemplateId(): string {
|
private get _dossierTemplateId(): string {
|
||||||
return this.screenStateService.dossierTemplateId;
|
return this.screenStateService.dossierTemplateId;
|
||||||
@ -29,9 +29,9 @@ export class TypeAnnotationIconComponent implements OnChanges {
|
|||||||
const { isSuggestion, isRecommendation, isSkipped, isDeclinedSuggestion, isHint, isIgnoredHint } = this.annotation;
|
const { isSuggestion, isRecommendation, isSkipped, isDeclinedSuggestion, isHint, isIgnoredHint } = this.annotation;
|
||||||
|
|
||||||
if (this.annotation.isSuperTypeBasedColor) {
|
if (this.annotation.isSuperTypeBasedColor) {
|
||||||
this.color = this._appStateService.getDictionaryColor(this.annotation.superType, this._dossierTemplateId);
|
this.color = this._dictionariesMapService.getDictionaryColor(this.annotation.superType, this._dossierTemplateId);
|
||||||
} else {
|
} else {
|
||||||
this.color = this._appStateService.getDictionaryColor(this.annotation.type, this._dossierTemplateId);
|
this.color = this._dictionariesMapService.getDictionaryColor(this.annotation.type, this._dossierTemplateId);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.type =
|
this.type =
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
import { Component, Inject, Injector, OnInit } from '@angular/core';
|
import { Component, Inject, Injector, OnInit } from '@angular/core';
|
||||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||||
import { AppStateService } from '@state/app-state.service';
|
|
||||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||||
import { PermissionsService } from '@services/permissions.service';
|
import { PermissionsService } from '@services/permissions.service';
|
||||||
import { Dictionary, Dossier } from '@red/domain';
|
import { Dictionary, Dossier } from '@red/domain';
|
||||||
@ -31,7 +30,6 @@ export class AcceptRecommendationDialogComponent extends BaseDialogComponent imp
|
|||||||
private readonly _dossier: Dossier;
|
private readonly _dossier: Dossier;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly _appStateService: AppStateService,
|
|
||||||
private readonly _formBuilder: FormBuilder,
|
private readonly _formBuilder: FormBuilder,
|
||||||
private readonly _manualAnnotationService: ManualAnnotationService,
|
private readonly _manualAnnotationService: ManualAnnotationService,
|
||||||
private readonly _permissionsService: PermissionsService,
|
private readonly _permissionsService: PermissionsService,
|
||||||
@ -58,7 +56,7 @@ export class AcceptRecommendationDialogComponent extends BaseDialogComponent imp
|
|||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
super.ngOnInit();
|
super.ngOnInit();
|
||||||
this.possibleDictionaries = await this._appStateService.getDictionariesOptions(
|
this.possibleDictionaries = await this._dictionaryService.getDictionariesOptions(
|
||||||
this._dossier.dossierTemplateId,
|
this._dossier.dossierTemplateId,
|
||||||
this._dossier.dossierId,
|
this._dossier.dossierId,
|
||||||
);
|
);
|
||||||
|
|||||||
@ -142,8 +142,8 @@ export class AnnotationActionsService {
|
|||||||
annotation,
|
annotation,
|
||||||
dossierId,
|
dossierId,
|
||||||
fileId,
|
fileId,
|
||||||
removeFromDictionary,
|
|
||||||
result.comment,
|
result.comment,
|
||||||
|
removeFromDictionary,
|
||||||
),
|
),
|
||||||
annotation,
|
annotation,
|
||||||
annotationsChanged,
|
annotationsChanged,
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Core, WebViewerInstance } from '@pdftron/webviewer';
|
import { Core, WebViewerInstance } from '@pdftron/webviewer';
|
||||||
import { hexToRgb } from '@utils/functions';
|
import { hexToRgb } from '@utils/functions';
|
||||||
import { AppStateService } from '@state/app-state.service';
|
|
||||||
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
||||||
import { UserPreferenceService } from '@services/user-preference.service';
|
import { UserPreferenceService } from '@services/user-preference.service';
|
||||||
import { DossiersService } from '@services/entity-services/dossiers.service';
|
import { DossiersService } from '@services/entity-services/dossiers.service';
|
||||||
@ -11,12 +10,13 @@ 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 { firstValueFrom } from 'rxjs';
|
||||||
|
import { DictionariesMapService } from '@services/entity-services/dictionaries-map.service';
|
||||||
import Annotation = Core.Annotations.Annotation;
|
import Annotation = Core.Annotations.Annotation;
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AnnotationDrawService {
|
export class AnnotationDrawService {
|
||||||
constructor(
|
constructor(
|
||||||
private readonly _appStateService: AppStateService,
|
private readonly _dictionariesMapService: DictionariesMapService,
|
||||||
private readonly _dossiersService: DossiersService,
|
private readonly _dossiersService: DossiersService,
|
||||||
private readonly _redactionLogService: RedactionLogService,
|
private readonly _redactionLogService: RedactionLogService,
|
||||||
private readonly _userPreferenceService: UserPreferenceService,
|
private readonly _userPreferenceService: UserPreferenceService,
|
||||||
@ -50,13 +50,13 @@ export class AnnotationDrawService {
|
|||||||
case 'hint':
|
case 'hint':
|
||||||
case 'redaction':
|
case 'redaction':
|
||||||
case 'recommendation':
|
case 'recommendation':
|
||||||
color = this._appStateService.getDictionaryColor(dictionary, dossierTemplateId);
|
color = this._dictionariesMapService.getDictionaryColor(dictionary, dossierTemplateId);
|
||||||
break;
|
break;
|
||||||
case 'skipped':
|
case 'skipped':
|
||||||
color = this._appStateService.getDictionaryColor(superType, dossierTemplateId);
|
color = this._dictionariesMapService.getDictionaryColor(superType, dossierTemplateId);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
color = this._appStateService.getDictionaryColor(superType, dossierTemplateId);
|
color = this._dictionariesMapService.getDictionaryColor(superType, dossierTemplateId);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return color;
|
return color;
|
||||||
|
|||||||
@ -2,13 +2,13 @@ import { Injectable } from '@angular/core';
|
|||||||
import { BehaviorSubject, firstValueFrom, Observable, pairwise, switchMap } from 'rxjs';
|
import { BehaviorSubject, firstValueFrom, Observable, pairwise, switchMap } from 'rxjs';
|
||||||
import { FileDataModel } from '@models/file/file-data.model';
|
import { FileDataModel } from '@models/file/file-data.model';
|
||||||
import { Dossier, File } from '@red/domain';
|
import { Dossier, File } 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 { FilesMapService } from '../../../../../services/entity-services/files-map.service';
|
import { FilesMapService } from '@services/entity-services/files-map.service';
|
||||||
import { PermissionsService } from '../../../../../services/permissions.service';
|
import { PermissionsService } from '../../../../../services/permissions.service';
|
||||||
import { boolFactory, shareLast } from '@iqser/common-ui';
|
import { boolFactory, shareLast } from '@iqser/common-ui';
|
||||||
import { filter, startWith } from 'rxjs/operators';
|
import { filter, startWith } from 'rxjs/operators';
|
||||||
import { FileManagementService } from '../../../../../services/entity-services/file-management.service';
|
import { FileManagementService } from '@services/entity-services/file-management.service';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class FilePreviewStateService {
|
export class FilePreviewStateService {
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import { Injectable, Injector } from '@angular/core';
|
import { Injectable, Injector } from '@angular/core';
|
||||||
import { AppStateService } from '@state/app-state.service';
|
|
||||||
import {
|
import {
|
||||||
Dossier,
|
Dossier,
|
||||||
IAddRedactionRequest,
|
IAddRedactionRequest,
|
||||||
@ -20,6 +19,7 @@ import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
|||||||
import { HttpErrorResponse, HttpStatusCode } from '@angular/common/http';
|
import { HttpErrorResponse, HttpStatusCode } from '@angular/common/http';
|
||||||
import { DossiersService } from '@services/entity-services/dossiers.service';
|
import { DossiersService } from '@services/entity-services/dossiers.service';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
import { DictionariesMapService } from '@services/entity-services/dictionaries-map.service';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ManualAnnotationService extends GenericService<IManualAddResponse> {
|
export class ManualAnnotationService extends GenericService<IManualAddResponse> {
|
||||||
@ -28,7 +28,7 @@ export class ManualAnnotationService extends GenericService<IManualAddResponse>
|
|||||||
};
|
};
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly _appStateService: AppStateService,
|
private readonly _dictionariesMapService: DictionariesMapService,
|
||||||
private readonly _toaster: Toaster,
|
private readonly _toaster: Toaster,
|
||||||
private readonly _permissionsService: PermissionsService,
|
private readonly _permissionsService: PermissionsService,
|
||||||
private readonly _dossiersService: DossiersService,
|
private readonly _dossiersService: DossiersService,
|
||||||
@ -74,8 +74,10 @@ export class ManualAnnotationService extends GenericService<IManualAddResponse>
|
|||||||
this._toaster.error(this._getMessage(mode, modifyDictionary, true, isConflict), {
|
this._toaster.error(this._getMessage(mode, modifyDictionary, true, isConflict), {
|
||||||
error,
|
error,
|
||||||
params: {
|
params: {
|
||||||
dictionaryName: this._appStateService.getDictionary(body.type, this._dossier(dossierId).dossierTemplateId)
|
dictionaryName: this._dictionariesMapService.getDictionary(
|
||||||
.label,
|
body.type as string,
|
||||||
|
this._dossier(dossierId).dossierTemplateId,
|
||||||
|
).label,
|
||||||
content: body.value,
|
content: body.value,
|
||||||
},
|
},
|
||||||
positionClass: 'toast-file-preview',
|
positionClass: 'toast-file-preview',
|
||||||
@ -199,8 +201,8 @@ export class ManualAnnotationService extends GenericService<IManualAddResponse>
|
|||||||
annotationWrapper: AnnotationWrapper,
|
annotationWrapper: AnnotationWrapper,
|
||||||
dossierId: string,
|
dossierId: string,
|
||||||
fileId: string,
|
fileId: string,
|
||||||
removeFromDictionary: boolean = false,
|
|
||||||
comment: string,
|
comment: string,
|
||||||
|
removeFromDictionary: boolean = false,
|
||||||
) {
|
) {
|
||||||
let mode: AnnotationActionMode,
|
let mode: AnnotationActionMode,
|
||||||
body: any,
|
body: any,
|
||||||
|
|||||||
@ -3,14 +3,14 @@ import { forkJoin, Observable, of } from 'rxjs';
|
|||||||
import { catchError, map, tap } from 'rxjs/operators';
|
import { catchError, map, tap } from 'rxjs/operators';
|
||||||
import { FileDataModel } from '@models/file/file-data.model';
|
import { FileDataModel } from '@models/file/file-data.model';
|
||||||
import { PermissionsService } from '@services/permissions.service';
|
import { PermissionsService } from '@services/permissions.service';
|
||||||
import { File, IRedactionLog, IViewedPage } from '@red/domain';
|
import { Dictionary, File, IRedactionLog, IViewedPage } from '@red/domain';
|
||||||
import { RedactionLogService } from './redaction-log.service';
|
import { RedactionLogService } from './redaction-log.service';
|
||||||
import { ViewedPagesService } from '@services/entity-services/viewed-pages.service';
|
import { ViewedPagesService } from '@services/entity-services/viewed-pages.service';
|
||||||
import { AppStateService } from '@state/app-state.service';
|
|
||||||
import { UserPreferenceService } from '@services/user-preference.service';
|
import { UserPreferenceService } from '@services/user-preference.service';
|
||||||
import { FilePreviewStateService } from '../screens/file-preview-screen/services/file-preview-state.service';
|
import { FilePreviewStateService } from '../screens/file-preview-screen/services/file-preview-state.service';
|
||||||
import { Toaster } from '@iqser/common-ui';
|
import { Toaster } from '@iqser/common-ui';
|
||||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||||
|
import { DictionariesMapService } from '@services/entity-services/dictionaries-map.service';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class PdfViewerDataService {
|
export class PdfViewerDataService {
|
||||||
@ -18,10 +18,10 @@ export class PdfViewerDataService {
|
|||||||
private readonly _permissionsService: PermissionsService,
|
private readonly _permissionsService: PermissionsService,
|
||||||
private readonly _redactionLogService: RedactionLogService,
|
private readonly _redactionLogService: RedactionLogService,
|
||||||
private readonly _viewedPagesService: ViewedPagesService,
|
private readonly _viewedPagesService: ViewedPagesService,
|
||||||
private readonly _appStateService: AppStateService,
|
|
||||||
private readonly _userPreferenceService: UserPreferenceService,
|
private readonly _userPreferenceService: UserPreferenceService,
|
||||||
private readonly _stateService: FilePreviewStateService,
|
private readonly _stateService: FilePreviewStateService,
|
||||||
private readonly _toaster: Toaster,
|
private readonly _toaster: Toaster,
|
||||||
|
private readonly _dictionariesMapService: DictionariesMapService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
loadRedactionLogFor(dossierId: string, fileId: string) {
|
loadRedactionLogFor(dossierId: string, fileId: string) {
|
||||||
@ -37,12 +37,8 @@ export class PdfViewerDataService {
|
|||||||
|
|
||||||
return forkJoin([redactionLog$, viewedPages$]).pipe(
|
return forkJoin([redactionLog$, viewedPages$]).pipe(
|
||||||
map((data: [redactionLog: IRedactionLog, viewedPages: IViewedPage[]]) => {
|
map((data: [redactionLog: IRedactionLog, viewedPages: IViewedPage[]]) => {
|
||||||
const fileDataModel = new FileDataModel(
|
const dictionaries: Dictionary[] = this._dictionariesMapService.get(this._stateService.dossierTemplateId);
|
||||||
newFile,
|
const fileDataModel = new FileDataModel(newFile, ...data, dictionaries, this._userPreferenceService.areDevFeaturesEnabled);
|
||||||
...data,
|
|
||||||
this._appStateService.dictionaryData[this._stateService.dossierTemplateId],
|
|
||||||
this._userPreferenceService.areDevFeaturesEnabled,
|
|
||||||
);
|
|
||||||
if (fileDataModel.missingTypes.size > 0) {
|
if (fileDataModel.missingTypes.size > 0) {
|
||||||
this._toaster.error(_('error.missing-types'), {
|
this._toaster.error(_('error.missing-types'), {
|
||||||
disableTimeOut: true,
|
disableTimeOut: true,
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { Component, Input, OnChanges } from '@angular/core';
|
import { Component, Input, OnChanges } from '@angular/core';
|
||||||
import { AppStateService } from '@state/app-state.service';
|
import { DictionariesMapService } from '@services/entity-services/dictionaries-map.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-dictionary-annotation-icon',
|
selector: 'redaction-dictionary-annotation-icon',
|
||||||
@ -14,12 +14,12 @@ export class DictionaryAnnotationIconComponent implements OnChanges {
|
|||||||
label: string;
|
label: string;
|
||||||
type: 'square' | 'circle';
|
type: 'square' | 'circle';
|
||||||
|
|
||||||
constructor(private readonly _appStateService: AppStateService) {}
|
constructor(private readonly _dictionariesMapService: DictionariesMapService) {}
|
||||||
|
|
||||||
ngOnChanges(): void {
|
ngOnChanges(): void {
|
||||||
if (this.dictionaryKey) {
|
if (this.dictionaryKey) {
|
||||||
const dictionary = this._appStateService.getDictionary(this.dictionaryKey, this.dossierTemplateId);
|
const dictionary = this._dictionariesMapService.getDictionary(this.dictionaryKey, this.dossierTemplateId);
|
||||||
this.color = this._appStateService.getDictionaryColor(this.dictionaryKey, this.dossierTemplateId);
|
this.color = this._dictionariesMapService.getDictionaryColor(this.dictionaryKey, this.dossierTemplateId);
|
||||||
this.type = dictionary.hint ? 'circle' : 'square';
|
this.type = dictionary.hint ? 'circle' : 'square';
|
||||||
this.label = this.dictionaryKey[0].toUpperCase();
|
this.label = this.dictionaryKey[0].toUpperCase();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,8 +7,8 @@ import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
|||||||
import { DictionaryService } from '@shared/services/dictionary.service';
|
import { DictionaryService } from '@shared/services/dictionary.service';
|
||||||
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 { AppStateService } from '@state/app-state.service';
|
|
||||||
import { EditorComponent } from '@shared/components/editor/editor.component';
|
import { EditorComponent } from '@shared/components/editor/editor.component';
|
||||||
|
import { DictionariesMapService } from '@services/entity-services/dictionaries-map.service';
|
||||||
import IModelDeltaDecoration = monaco.editor.IModelDeltaDecoration;
|
import IModelDeltaDecoration = monaco.editor.IModelDeltaDecoration;
|
||||||
import FindMatch = monaco.editor.FindMatch;
|
import FindMatch = monaco.editor.FindMatch;
|
||||||
|
|
||||||
@ -46,8 +46,8 @@ export class DictionaryManagerComponent implements OnChanges {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly _dictionaryService: DictionaryService,
|
private readonly _dictionaryService: DictionaryService,
|
||||||
|
private readonly _dictionariesMapService: DictionariesMapService,
|
||||||
readonly dossiersService: DossiersService,
|
readonly dossiersService: DossiersService,
|
||||||
readonly appStateService: AppStateService,
|
|
||||||
readonly dossierTemplatesService: DossierTemplatesService,
|
readonly dossierTemplatesService: DossierTemplatesService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
@ -101,9 +101,8 @@ export class DictionaryManagerComponent implements OnChanges {
|
|||||||
this.diffEditorText = '';
|
this.diffEditorText = '';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const entries =
|
const entries: List =
|
||||||
this._dictionary.entries ??
|
this._dictionary.entries ?? this._dictionariesMapService.get(this._dictionary.dossierTemplateId, this._dictionary.type).entries;
|
||||||
this.appStateService.dictionaryData[this._dictionary.dossierTemplateId][this._dictionary.type].entries;
|
|
||||||
|
|
||||||
if (entries.length) {
|
if (entries.length) {
|
||||||
this.diffEditorText = this._toString([...entries]);
|
this.diffEditorText = this._toString([...entries]);
|
||||||
@ -125,11 +124,11 @@ export class DictionaryManagerComponent implements OnChanges {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
get _dictionaries() {
|
get _dictionaries(): Dictionary[] {
|
||||||
if (!this._dossierTemplate || this._dossierTemplate.name === this.selectDossierTemplate.name) {
|
if (!this._dossierTemplate || this._dossierTemplate.name === this.selectDossierTemplate.name) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return Object.values(this.appStateService.dictionaryData[this.dossierTemplate?.dossierTemplateId]).filter(dict => !dict.virtual);
|
return this._dictionariesMapService.get(this.dossierTemplate?.dossierTemplateId).filter(dict => !dict.virtual);
|
||||||
}
|
}
|
||||||
|
|
||||||
get dossierTemplateIsNotSelected() {
|
get dossierTemplateIsNotSelected() {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { Component, Input, OnChanges } from '@angular/core';
|
import { Component, Input, OnChanges } from '@angular/core';
|
||||||
import { AppStateService } from '@state/app-state.service';
|
|
||||||
import { INestedFilter, Required } from '@iqser/common-ui';
|
import { INestedFilter, Required } from '@iqser/common-ui';
|
||||||
|
import { DictionariesMapService } from '@services/entity-services/dictionaries-map.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-type-filter',
|
selector: 'redaction-type-filter',
|
||||||
@ -23,13 +23,13 @@ export class TypeFilterComponent implements OnChanges {
|
|||||||
];
|
];
|
||||||
private _needsAnalysisKeys = ['add-dictionary', 'remove-only-here', 'change-legal-basis', 'analysis'];
|
private _needsAnalysisKeys = ['add-dictionary', 'remove-only-here', 'change-legal-basis', 'analysis'];
|
||||||
|
|
||||||
constructor(private readonly _appStateService: AppStateService) {}
|
constructor(private readonly _dictionariesMapService: DictionariesMapService) {}
|
||||||
|
|
||||||
isSuggestion = (key: string) => this._suggestionsKeys.includes(key);
|
isSuggestion = (key: string) => this._suggestionsKeys.includes(key);
|
||||||
|
|
||||||
needsAnalysis = (key: string) => this._needsAnalysisKeys.includes(key);
|
needsAnalysis = (key: string) => this._needsAnalysisKeys.includes(key);
|
||||||
|
|
||||||
ngOnChanges(): void {
|
ngOnChanges(): void {
|
||||||
this.dictionaryColor = this._appStateService.getDictionaryColor(this.filter.id, this.dossierTemplateId);
|
this.dictionaryColor = this._dictionariesMapService.getDictionaryColor(this.filter.id, this.dossierTemplateId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +1,15 @@
|
|||||||
import { Injectable, Injector } from '@angular/core';
|
import { Injectable, Injector } from '@angular/core';
|
||||||
import { Observable, throwError } from 'rxjs';
|
import { firstValueFrom, forkJoin, Observable, of, throwError } from 'rxjs';
|
||||||
import { EntitiesService, List, QueryParam, RequiredParam, Toaster, Validate } from '@iqser/common-ui';
|
import { EntitiesService, List, QueryParam, RequiredParam, Toaster, Validate } from '@iqser/common-ui';
|
||||||
import { Dictionary, IColors, IDictionary, IUpdateDictionary } from '@red/domain';
|
import { Dictionary, DossierTemplate, IColors, IDictionary, IUpdateDictionary } from '@red/domain';
|
||||||
import { mapTo, switchMap, tap } from 'rxjs/operators';
|
import { catchError, map, mapTo, switchMap, tap } from 'rxjs/operators';
|
||||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||||
import { DossierTemplateStatsService } from '@services/entity-services/dossier-template-stats.service';
|
import { DossierTemplateStatsService } from '@services/entity-services/dossier-template-stats.service';
|
||||||
|
import { DictionariesMapService } from '@services/entity-services/dictionaries-map.service';
|
||||||
|
import { FALLBACK_COLOR } from '@utils/constants';
|
||||||
|
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
|
||||||
|
import { hexToRgb } from '@utils/functions';
|
||||||
|
import { FileAttributesService } from '@services/entity-services/file-attributes.service';
|
||||||
|
|
||||||
const MIN_WORD_LENGTH = 2;
|
const MIN_WORD_LENGTH = 2;
|
||||||
|
|
||||||
@ -15,7 +20,10 @@ export class DictionaryService extends EntitiesService<Dictionary, IDictionary>
|
|||||||
constructor(
|
constructor(
|
||||||
private readonly _toaster: Toaster,
|
private readonly _toaster: Toaster,
|
||||||
protected readonly _injector: Injector,
|
protected readonly _injector: Injector,
|
||||||
|
private readonly _dossierTemplatesService: DossierTemplatesService,
|
||||||
|
private readonly _fileAttributesService: FileAttributesService,
|
||||||
private readonly _dossierTemplateStatsService: DossierTemplateStatsService,
|
private readonly _dossierTemplateStatsService: DossierTemplateStatsService,
|
||||||
|
private readonly _dictionariesMapService: DictionariesMapService,
|
||||||
) {
|
) {
|
||||||
super(_injector, Dictionary, 'dictionary');
|
super(_injector, Dictionary, 'dictionary');
|
||||||
}
|
}
|
||||||
@ -55,7 +63,22 @@ export class DictionaryService extends EntitiesService<Dictionary, IDictionary>
|
|||||||
*/
|
*/
|
||||||
@Validate()
|
@Validate()
|
||||||
getColors(@RequiredParam() dossierTemplateId: string) {
|
getColors(@RequiredParam() dossierTemplateId: string) {
|
||||||
return this._getOne<IColors>([dossierTemplateId], 'color');
|
return this._getOne<IColors>([dossierTemplateId], 'color').pipe(
|
||||||
|
catchError(() =>
|
||||||
|
of({
|
||||||
|
analysisColor: FALLBACK_COLOR,
|
||||||
|
dictionaryRequestColor: FALLBACK_COLOR,
|
||||||
|
defaultColor: FALLBACK_COLOR,
|
||||||
|
manualRedactionColor: FALLBACK_COLOR,
|
||||||
|
notRedacted: FALLBACK_COLOR,
|
||||||
|
requestAdd: FALLBACK_COLOR,
|
||||||
|
previewColor: FALLBACK_COLOR,
|
||||||
|
requestRemove: FALLBACK_COLOR,
|
||||||
|
updatedColor: FALLBACK_COLOR,
|
||||||
|
dossierTemplateId: dossierTemplateId,
|
||||||
|
} as IColors),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -136,6 +159,57 @@ export class DictionaryService extends EntitiesService<Dictionary, IDictionary>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getDictionariesOptions(dossierTemplateId: string, dossierId: string): Promise<Dictionary[]> {
|
||||||
|
const possibleDictionaries: Dictionary[] = [];
|
||||||
|
|
||||||
|
const dossierDictionary = await firstValueFrom(this.getForType(dossierTemplateId, 'dossier_redaction', dossierId));
|
||||||
|
|
||||||
|
for (const dictionary of this._dictionariesMapService.get(dossierTemplateId)) {
|
||||||
|
if (!dictionary.virtual && dictionary.addToDictionaryAction) {
|
||||||
|
possibleDictionaries.push(dictionary as Dictionary);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 loadDictionaryDataIfNecessary() {
|
||||||
|
if (this._dictionariesMapService.empty) {
|
||||||
|
await this.loadDictionaryData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async loadDictionaryData(): Promise<void> {
|
||||||
|
const observables: Observable<Dictionary[]>[] = [];
|
||||||
|
for (const dossierTemplate of this._dossierTemplatesService.all) {
|
||||||
|
observables.push(this._loadDictionaryDataForDossierTemplate$(dossierTemplate.dossierTemplateId));
|
||||||
|
}
|
||||||
|
await firstValueFrom(forkJoin(observables));
|
||||||
|
}
|
||||||
|
|
||||||
|
async refreshDossierTemplateDictionaryData(dossierTemplateId: string): Promise<void> {
|
||||||
|
await firstValueFrom(this._loadDictionaryDataForDossierTemplate$(dossierTemplateId));
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Maybe move this in dossier templates service
|
||||||
|
async refreshDossierTemplate(dossierTemplateId: string) {
|
||||||
|
const dossierTemplate = await firstValueFrom(this._dossierTemplatesService.get(dossierTemplateId));
|
||||||
|
|
||||||
|
await firstValueFrom(this._fileAttributesService.getFileAttributesConfig(dossierTemplateId));
|
||||||
|
|
||||||
|
const newDossierTemplate = new DossierTemplate(dossierTemplate);
|
||||||
|
this._dossierTemplatesService.replace(newDossierTemplate);
|
||||||
|
|
||||||
|
await this.refreshDossierTemplateDictionaryData(dossierTemplateId);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add dictionary entries with entry type.
|
* Add dictionary entries with entry type.
|
||||||
*/
|
*/
|
||||||
@ -169,4 +243,66 @@ export class DictionaryService extends EntitiesService<Dictionary, IDictionary>
|
|||||||
const url = `${this._defaultModelPath}/delete/${type}/${dossierTemplateId}`;
|
const url = `${this._defaultModelPath}/delete/${type}/${dossierTemplateId}`;
|
||||||
return this._post(body, url, queryParams);
|
return this._post(body, url, queryParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _loadDictionaryDataForDossierTemplate$(dossierTemplateId: string): Observable<Dictionary[]> {
|
||||||
|
const types$: Observable<Dictionary[]> = this.getAllDictionaries(dossierTemplateId).pipe(
|
||||||
|
map(typesResponse => typesResponse.types.map(type => new Dictionary(type))),
|
||||||
|
);
|
||||||
|
|
||||||
|
const virtualTypes$: Observable<Dictionary[]> = this.getColors(dossierTemplateId).pipe(
|
||||||
|
tap(colors => {
|
||||||
|
for (const key of Object.keys(colors)) {
|
||||||
|
const color = colors[key];
|
||||||
|
try {
|
||||||
|
const rgbValue = hexToRgb(color);
|
||||||
|
if (!rgbValue) {
|
||||||
|
colors[key] = FALLBACK_COLOR;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
colors[key] = FALLBACK_COLOR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
map(colors => {
|
||||||
|
const virtualTypes = [
|
||||||
|
{
|
||||||
|
hexColor: colors.manualRedactionColor || FALLBACK_COLOR,
|
||||||
|
type: 'dossier_redaction',
|
||||||
|
hint: false,
|
||||||
|
recommendation: false,
|
||||||
|
},
|
||||||
|
{ hexColor: colors.notRedacted || FALLBACK_COLOR, type: 'declined-suggestion' },
|
||||||
|
{ hexColor: colors.manualRedactionColor || FALLBACK_COLOR, type: 'manual' },
|
||||||
|
{ hexColor: colors.ignoredHintColor || FALLBACK_COLOR, type: 'ignored-hint' },
|
||||||
|
{ hexColor: colors.manualRedactionColor || FALLBACK_COLOR, type: 'manual-redaction' },
|
||||||
|
// dictionary actions
|
||||||
|
{ hexColor: '#c5d3eb', type: 'recommendation' },
|
||||||
|
{ hexColor: colors.analysisColor || FALLBACK_COLOR, type: 'remove-only-here' },
|
||||||
|
// generic suggestions
|
||||||
|
{ hexColor: colors.requestAdd || FALLBACK_COLOR, type: 'suggestion' },
|
||||||
|
{ hexColor: colors.requestAdd || FALLBACK_COLOR, type: 'suggestion-add' },
|
||||||
|
// add suggestions
|
||||||
|
{ hexColor: colors.requestAdd || FALLBACK_COLOR, type: 'suggestion-change-legal-basis' },
|
||||||
|
{ hexColor: colors.requestAdd || FALLBACK_COLOR, type: 'suggestion-recategorize-image' },
|
||||||
|
{ hexColor: colors.dictionaryRequestColor || FALLBACK_COLOR, type: 'suggestion-add-dictionary' },
|
||||||
|
{ hexColor: colors.dictionaryRequestColor || FALLBACK_COLOR, type: 'suggestion-resize' },
|
||||||
|
{ hexColor: colors.requestRemove || FALLBACK_COLOR, type: 'suggestion-remove' },
|
||||||
|
{ hexColor: colors.dictionaryRequestColor || FALLBACK_COLOR, type: 'suggestion-remove-dictionary' },
|
||||||
|
{ hexColor: colors.notRedacted || FALLBACK_COLOR, type: 'skipped' },
|
||||||
|
{ hexColor: colors.defaultColor || FALLBACK_COLOR, type: 'default' },
|
||||||
|
{ hexColor: colors.requestAdd || FALLBACK_COLOR, type: 'add' },
|
||||||
|
{ hexColor: colors.analysisColor || FALLBACK_COLOR, type: 'analysis' },
|
||||||
|
{ hexColor: '#fa98f7', type: 'hint', hint: true },
|
||||||
|
{ hexColor: colors.manualRedactionColor || FALLBACK_COLOR, type: 'redaction' },
|
||||||
|
{ hexColor: colors.updatedColor || FALLBACK_COLOR, type: 'updated' },
|
||||||
|
];
|
||||||
|
|
||||||
|
return virtualTypes.map(config => new Dictionary(config, true));
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
return forkJoin([types$, virtualTypes$])
|
||||||
|
.pipe(map(([types, virtualTypes]: Dictionary[][]) => [...types, ...virtualTypes]))
|
||||||
|
.pipe(tap(dictionaries => this._dictionariesMapService.set(dossierTemplateId, dictionaries)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,19 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { Dictionary, IDictionary } from '@red/domain';
|
||||||
|
import { EntitiesMapService } from '@iqser/common-ui';
|
||||||
|
|
||||||
|
@Injectable({ providedIn: 'root' })
|
||||||
|
export class DictionariesMapService extends EntitiesMapService<Dictionary, IDictionary> {
|
||||||
|
constructor() {
|
||||||
|
super('dossierTemplateId');
|
||||||
|
}
|
||||||
|
|
||||||
|
/** If the type is not found, it returns the 'default' type. */
|
||||||
|
getDictionary(type: string, dossierTemplateId: string): Dictionary | undefined {
|
||||||
|
return this.get(dossierTemplateId, type) || this.get(dossierTemplateId, 'default');
|
||||||
|
}
|
||||||
|
|
||||||
|
getDictionaryColor(type: string, dossierTemplateId: string) {
|
||||||
|
return !this.get(dossierTemplateId) ? '#cccccc' : this.getDictionary(type, dossierTemplateId).hexColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,17 +1,19 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { ActivatedRouteSnapshot, CanActivate, Router } from '@angular/router';
|
import { ActivatedRouteSnapshot, CanActivate, Router } from '@angular/router';
|
||||||
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';
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
import { DictionariesMapService } from '@services/entity-services/dictionaries-map.service';
|
||||||
|
import { DictionaryService } from '@shared/services/dictionary.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class AppStateGuard implements CanActivate {
|
export class AppStateGuard implements CanActivate {
|
||||||
constructor(
|
constructor(
|
||||||
private readonly _appStateService: AppStateService,
|
private readonly _dictionaryService: DictionaryService,
|
||||||
private readonly _dossierTemplatesService: DossierTemplatesService,
|
private readonly _dossierTemplatesService: DossierTemplatesService,
|
||||||
|
private readonly _dictionariesMapService: DictionariesMapService,
|
||||||
private readonly _userService: UserService,
|
private readonly _userService: UserService,
|
||||||
private readonly _router: Router,
|
private readonly _router: Router,
|
||||||
) {}
|
) {}
|
||||||
@ -24,17 +26,17 @@ export class AppStateGuard implements CanActivate {
|
|||||||
if (this._userService.currentUser.isUser || this._userService.currentUser.isAdmin) {
|
if (this._userService.currentUser.isUser || this._userService.currentUser.isAdmin) {
|
||||||
await firstValueFrom(this._userService.loadAll());
|
await firstValueFrom(this._userService.loadAll());
|
||||||
await this._dossierTemplatesService.loadAllIfEmpty();
|
await this._dossierTemplatesService.loadAllIfEmpty();
|
||||||
await this._appStateService.loadDictionaryDataIfNecessary();
|
await this._dictionaryService.loadDictionaryDataIfNecessary();
|
||||||
}
|
}
|
||||||
|
|
||||||
const { dossierTemplateId, type } = route.params;
|
const { dossierTemplateId, type } = route.params;
|
||||||
|
|
||||||
if (dossierTemplateId && !this._dossierTemplatesService.find(dossierTemplateId)) {
|
if (dossierTemplateId && !this._dossierTemplatesService.find(dossierTemplateId as string)) {
|
||||||
await this._router.navigate(['main', 'admin', 'dossier-templates']);
|
await this._router.navigate(['main', 'admin', 'dossier-templates']);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type && !this._appStateService.dictionaryData[dossierTemplateId][type]) {
|
if (type && !this._dictionariesMapService.get(dossierTemplateId, type)) {
|
||||||
await this._router.navigate(['main', 'admin', 'dossier-templates', dossierTemplateId]);
|
await this._router.navigate(['main', 'admin', 'dossier-templates', dossierTemplateId]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,371 +0,0 @@
|
|||||||
import { Injectable } from '@angular/core';
|
|
||||||
import { Dictionary, DossierTemplate, IColors } from '@red/domain';
|
|
||||||
import { Router } from '@angular/router';
|
|
||||||
import { firstValueFrom, forkJoin, Observable, of } from 'rxjs';
|
|
||||||
import { catchError, map, tap } from 'rxjs/operators';
|
|
||||||
import { FALLBACK_COLOR, hexToRgb } from '@utils/functions';
|
|
||||||
import { DictionaryService } from '@shared/services/dictionary.service';
|
|
||||||
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
|
|
||||||
import { FileAttributesService } from '@services/entity-services/file-attributes.service';
|
|
||||||
|
|
||||||
export interface AppState {
|
|
||||||
activeDictionaryType?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Injectable({
|
|
||||||
providedIn: 'root',
|
|
||||||
})
|
|
||||||
export class AppStateService {
|
|
||||||
private _appState: AppState = {};
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
private readonly _router: Router,
|
|
||||||
private readonly _dictionaryService: DictionaryService,
|
|
||||||
private readonly _dossierTemplatesService: DossierTemplatesService,
|
|
||||||
private readonly _fileAttributesService: FileAttributesService,
|
|
||||||
) {}
|
|
||||||
|
|
||||||
private _dictionaryData?: { [key: string]: { [key: string]: Dictionary } };
|
|
||||||
|
|
||||||
get dictionaryData(): { [key: string]: { [key: string]: Dictionary } } | undefined {
|
|
||||||
return this._dictionaryData;
|
|
||||||
}
|
|
||||||
|
|
||||||
get dossierTemplates(): DossierTemplate[] {
|
|
||||||
return this._dossierTemplatesService.all;
|
|
||||||
}
|
|
||||||
|
|
||||||
get activeDictionaryType(): string | undefined {
|
|
||||||
return this._appState.activeDictionaryType;
|
|
||||||
}
|
|
||||||
|
|
||||||
get activeDictionary(): Dictionary | undefined {
|
|
||||||
const activeDossierTemplateId = this._dossierTemplatesService.activeDossierTemplateId;
|
|
||||||
return activeDossierTemplateId && this.activeDictionaryType && this.dictionaryData && this.dictionaryData[activeDossierTemplateId]
|
|
||||||
? this.dictionaryData[activeDossierTemplateId][this.activeDictionaryType]
|
|
||||||
: undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
async getDictionariesOptions(dossierTemplateId: string, dossierId: string): Promise<Dictionary[]> {
|
|
||||||
const possibleDictionaries: Dictionary[] = [];
|
|
||||||
|
|
||||||
const dossierDictionary = await firstValueFrom(
|
|
||||||
this._dictionaryService.getForType(dossierTemplateId, 'dossier_redaction', dossierId),
|
|
||||||
);
|
|
||||||
|
|
||||||
for (const key of Object.keys(this.dictionaryData[dossierTemplateId])) {
|
|
||||||
const dictionaryData = this.getDictionary(key, 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
getDictionaryColor(type: string, dossierTemplateId: string) {
|
|
||||||
return !this._dictionaryData
|
|
||||||
? '#cccccc'
|
|
||||||
: this._dictionaryData[dossierTemplateId][type]?.hexColor || this._dictionaryData[dossierTemplateId]['default'].hexColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
getDictionary(key: string, dossierTemplateId: string): Dictionary | undefined {
|
|
||||||
if (!dossierTemplateId) {
|
|
||||||
dossierTemplateId = this.dossierTemplates.length > 0 ? this.dossierTemplates[0].dossierTemplateId : undefined;
|
|
||||||
}
|
|
||||||
if (!dossierTemplateId || !this._dictionaryData) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
const data = this._dictionaryData[dossierTemplateId][key];
|
|
||||||
return data ? data : this._dictionaryData[dossierTemplateId]['default'];
|
|
||||||
}
|
|
||||||
|
|
||||||
activateDictionary(dictionaryType: string) {
|
|
||||||
if (this._dossierTemplatesService.activeDossierTemplate) {
|
|
||||||
this._appState.activeDictionaryType = dictionaryType;
|
|
||||||
if (!this.activeDictionary) {
|
|
||||||
this._appState.activeDictionaryType = null;
|
|
||||||
this._router.navigate([this._dossierTemplatesService.activeDossierTemplate.routerLink]).then();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
reset() {
|
|
||||||
this._appState.activeDictionaryType = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
async refreshDossierTemplate(dossierTemplateId: string) {
|
|
||||||
const dossierTemplate = await firstValueFrom(this._dossierTemplatesService.get(dossierTemplateId));
|
|
||||||
|
|
||||||
await firstValueFrom(this._fileAttributesService.getFileAttributesConfig(dossierTemplateId));
|
|
||||||
|
|
||||||
const newDossierTemplate = new DossierTemplate(dossierTemplate);
|
|
||||||
this._dossierTemplatesService.replace(newDossierTemplate);
|
|
||||||
|
|
||||||
await this.refreshDossierTemplateDictionaryData(dossierTemplateId);
|
|
||||||
}
|
|
||||||
|
|
||||||
async loadDictionaryDataIfNecessary() {
|
|
||||||
if (!this._dictionaryData) {
|
|
||||||
await this.loadDictionaryData();
|
|
||||||
} else {
|
|
||||||
return this._dictionaryData;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async loadDictionaryData(): Promise<void> {
|
|
||||||
const observables = [];
|
|
||||||
for (const dossierTemplate of this.dossierTemplates) {
|
|
||||||
observables.push(this._getDictionaryDataForDossierTemplate$(dossierTemplate.dossierTemplateId));
|
|
||||||
}
|
|
||||||
const result = await firstValueFrom(forkJoin(observables));
|
|
||||||
|
|
||||||
const dictionaryData = {};
|
|
||||||
for (let i = 0; i < this.dossierTemplates.length; i++) {
|
|
||||||
dictionaryData[this.dossierTemplates[i].dossierTemplateId] = result[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
this._dictionaryData = dictionaryData;
|
|
||||||
}
|
|
||||||
|
|
||||||
async refreshDossierTemplateDictionaryData(dossierTemplateId: string) {
|
|
||||||
this._dictionaryData[dossierTemplateId] = await firstValueFrom(this._getDictionaryDataForDossierTemplate$(dossierTemplateId));
|
|
||||||
}
|
|
||||||
|
|
||||||
loadColors(dossierTemplateId: string) {
|
|
||||||
return this._dictionaryService.getColors(dossierTemplateId).pipe(
|
|
||||||
catchError(() =>
|
|
||||||
of({
|
|
||||||
analysisColor: FALLBACK_COLOR,
|
|
||||||
dictionaryRequestColor: FALLBACK_COLOR,
|
|
||||||
defaultColor: FALLBACK_COLOR,
|
|
||||||
manualRedactionColor: FALLBACK_COLOR,
|
|
||||||
notRedacted: FALLBACK_COLOR,
|
|
||||||
requestAdd: FALLBACK_COLOR,
|
|
||||||
previewColor: FALLBACK_COLOR,
|
|
||||||
requestRemove: FALLBACK_COLOR,
|
|
||||||
updatedColor: FALLBACK_COLOR,
|
|
||||||
dossierTemplateId: dossierTemplateId,
|
|
||||||
} as IColors),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
private _getDictionaryDataForDossierTemplate$(dossierTemplateId: string): Observable<{ [key: string]: any }> {
|
|
||||||
const dictionaryData: { [key: string]: any } = {};
|
|
||||||
|
|
||||||
const typeObs = this._dictionaryService.getAllDictionaries(dossierTemplateId).pipe(
|
|
||||||
tap(typesResponse => {
|
|
||||||
for (const type of typesResponse.types) {
|
|
||||||
dictionaryData[type.type] = new Dictionary(type);
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
|
|
||||||
const colorsObs = this.loadColors(dossierTemplateId).pipe(
|
|
||||||
tap(colors => {
|
|
||||||
for (const key of Object.keys(colors)) {
|
|
||||||
const color = colors[key];
|
|
||||||
try {
|
|
||||||
const rgbValue = hexToRgb(color);
|
|
||||||
if (!rgbValue) {
|
|
||||||
colors[key] = FALLBACK_COLOR;
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
colors[key] = FALLBACK_COLOR;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dictionaryData['dossier_redaction'] = new Dictionary(
|
|
||||||
{
|
|
||||||
hexColor: colors.manualRedactionColor || FALLBACK_COLOR,
|
|
||||||
type: 'dossier_redaction',
|
|
||||||
hint: false,
|
|
||||||
recommendation: false,
|
|
||||||
},
|
|
||||||
true,
|
|
||||||
);
|
|
||||||
|
|
||||||
dictionaryData['declined-suggestion'] = new Dictionary(
|
|
||||||
{
|
|
||||||
hexColor: colors.notRedacted || FALLBACK_COLOR,
|
|
||||||
type: 'declined-suggestion',
|
|
||||||
},
|
|
||||||
true,
|
|
||||||
);
|
|
||||||
|
|
||||||
dictionaryData['manual'] = new Dictionary(
|
|
||||||
{
|
|
||||||
hexColor: colors.manualRedactionColor || FALLBACK_COLOR,
|
|
||||||
type: 'manual',
|
|
||||||
},
|
|
||||||
true,
|
|
||||||
);
|
|
||||||
|
|
||||||
dictionaryData['ignored-hint'] = new Dictionary(
|
|
||||||
{
|
|
||||||
hexColor: colors.ignoredHintColor || FALLBACK_COLOR,
|
|
||||||
type: 'ignored-hint',
|
|
||||||
},
|
|
||||||
true,
|
|
||||||
);
|
|
||||||
|
|
||||||
dictionaryData['manual-redaction'] = new Dictionary(
|
|
||||||
{
|
|
||||||
hexColor: colors.manualRedactionColor || FALLBACK_COLOR,
|
|
||||||
type: 'manual-redaction',
|
|
||||||
},
|
|
||||||
true,
|
|
||||||
);
|
|
||||||
// dictionary actions
|
|
||||||
dictionaryData['recommendation'] = new Dictionary(
|
|
||||||
{
|
|
||||||
hexColor: '#c5d3eb',
|
|
||||||
type: 'recommendation',
|
|
||||||
},
|
|
||||||
true,
|
|
||||||
);
|
|
||||||
|
|
||||||
dictionaryData['remove-only-here'] = new Dictionary(
|
|
||||||
{
|
|
||||||
hexColor: colors.analysisColor || FALLBACK_COLOR,
|
|
||||||
type: 'remove-only-here',
|
|
||||||
},
|
|
||||||
true,
|
|
||||||
);
|
|
||||||
// generic suggestions
|
|
||||||
dictionaryData['suggestion'] = new Dictionary(
|
|
||||||
{
|
|
||||||
hexColor: colors.requestAdd || FALLBACK_COLOR,
|
|
||||||
type: 'suggestion',
|
|
||||||
},
|
|
||||||
true,
|
|
||||||
);
|
|
||||||
|
|
||||||
dictionaryData['suggestion-add'] = new Dictionary(
|
|
||||||
{
|
|
||||||
hexColor: colors.requestAdd || FALLBACK_COLOR,
|
|
||||||
type: 'suggestion-add',
|
|
||||||
},
|
|
||||||
true,
|
|
||||||
);
|
|
||||||
|
|
||||||
// add suggestions
|
|
||||||
dictionaryData['suggestion-change-legal-basis'] = new Dictionary(
|
|
||||||
{
|
|
||||||
hexColor: colors.requestAdd || FALLBACK_COLOR,
|
|
||||||
type: 'suggestion-change-legal-basis',
|
|
||||||
},
|
|
||||||
true,
|
|
||||||
);
|
|
||||||
|
|
||||||
dictionaryData['suggestion-recategorize-image'] = new Dictionary(
|
|
||||||
{
|
|
||||||
hexColor: colors.requestAdd || FALLBACK_COLOR,
|
|
||||||
type: 'suggestion-recategorize-image',
|
|
||||||
},
|
|
||||||
true,
|
|
||||||
);
|
|
||||||
|
|
||||||
dictionaryData['suggestion-add-dictionary'] = new Dictionary(
|
|
||||||
{
|
|
||||||
hexColor: colors.dictionaryRequestColor || FALLBACK_COLOR,
|
|
||||||
type: 'suggestion-add',
|
|
||||||
},
|
|
||||||
true,
|
|
||||||
);
|
|
||||||
|
|
||||||
dictionaryData['suggestion-resize'] = new Dictionary(
|
|
||||||
{
|
|
||||||
hexColor: colors.dictionaryRequestColor || FALLBACK_COLOR,
|
|
||||||
type: 'suggestion-resize',
|
|
||||||
},
|
|
||||||
true,
|
|
||||||
);
|
|
||||||
|
|
||||||
dictionaryData['suggestion-remove'] = new Dictionary(
|
|
||||||
{
|
|
||||||
hexColor: colors.requestRemove || FALLBACK_COLOR,
|
|
||||||
type: 'suggestion-add',
|
|
||||||
},
|
|
||||||
true,
|
|
||||||
);
|
|
||||||
|
|
||||||
dictionaryData['suggestion-remove-dictionary'] = new Dictionary(
|
|
||||||
{
|
|
||||||
hexColor: colors.dictionaryRequestColor || FALLBACK_COLOR,
|
|
||||||
type: 'suggestion-add',
|
|
||||||
},
|
|
||||||
true,
|
|
||||||
);
|
|
||||||
|
|
||||||
dictionaryData['skipped'] = new Dictionary(
|
|
||||||
{
|
|
||||||
hexColor: colors.notRedacted || FALLBACK_COLOR,
|
|
||||||
type: 'skipped',
|
|
||||||
},
|
|
||||||
true,
|
|
||||||
);
|
|
||||||
|
|
||||||
dictionaryData['default'] = new Dictionary(
|
|
||||||
{
|
|
||||||
hexColor: colors.defaultColor || FALLBACK_COLOR,
|
|
||||||
type: 'default',
|
|
||||||
},
|
|
||||||
true,
|
|
||||||
);
|
|
||||||
|
|
||||||
dictionaryData['add'] = new Dictionary(
|
|
||||||
{
|
|
||||||
hexColor: colors.requestAdd || FALLBACK_COLOR,
|
|
||||||
type: 'add',
|
|
||||||
},
|
|
||||||
true,
|
|
||||||
);
|
|
||||||
|
|
||||||
dictionaryData['analysis'] = new Dictionary(
|
|
||||||
{
|
|
||||||
hexColor: colors.analysisColor || FALLBACK_COLOR,
|
|
||||||
type: 'analysis',
|
|
||||||
},
|
|
||||||
true,
|
|
||||||
);
|
|
||||||
|
|
||||||
dictionaryData['hint'] = new Dictionary(
|
|
||||||
{
|
|
||||||
hexColor: '#fa98f7',
|
|
||||||
type: 'hint',
|
|
||||||
hint: true,
|
|
||||||
},
|
|
||||||
true,
|
|
||||||
);
|
|
||||||
|
|
||||||
dictionaryData['redaction'] = new Dictionary(
|
|
||||||
{
|
|
||||||
hexColor: colors.manualRedactionColor || FALLBACK_COLOR,
|
|
||||||
type: 'redaction',
|
|
||||||
},
|
|
||||||
true,
|
|
||||||
);
|
|
||||||
|
|
||||||
dictionaryData['updated'] = new Dictionary(
|
|
||||||
{
|
|
||||||
hexColor: colors.updatedColor || FALLBACK_COLOR,
|
|
||||||
type: 'updated',
|
|
||||||
},
|
|
||||||
true,
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
|
|
||||||
return forkJoin([typeObs, colorsObs]).pipe(map(() => dictionaryData));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1 +1,2 @@
|
|||||||
export const CHANGED_CHECK_INTERVAL = 5000;
|
export const CHANGED_CHECK_INTERVAL = 5000;
|
||||||
|
export const FALLBACK_COLOR = '#CCCCCC';
|
||||||
|
|||||||
@ -8,8 +8,6 @@ export const currentComponentRoute = filter(
|
|||||||
event => event instanceof ActivationEnd && !!event.snapshot.component && event.snapshot.component !== BaseScreenComponent,
|
event => event instanceof ActivationEnd && !!event.snapshot.component && event.snapshot.component !== BaseScreenComponent,
|
||||||
);
|
);
|
||||||
|
|
||||||
export const FALLBACK_COLOR = '#CCCCCC';
|
|
||||||
|
|
||||||
export function groupBy(xs: List<unknown>, key: string) {
|
export function groupBy(xs: List<unknown>, key: string) {
|
||||||
return xs.reduce((rv, x) => {
|
return xs.reduce((rv, x) => {
|
||||||
(rv[x[key]] = rv[x[key]] || []).push(x);
|
(rv[x[key]] = rv[x[key]] || []).push(x);
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
Subproject commit 492ac8d7c046d6a22a6d3ac07d569721fb14082e
|
Subproject commit b040815b8568d8a4fce8faef2afc57fe6fce2e10
|
||||||
@ -1,7 +1,7 @@
|
|||||||
import { IListable, List } from '@iqser/common-ui';
|
import { Entity, List } from '@iqser/common-ui';
|
||||||
import { IDictionary } from './dictionary';
|
import { IDictionary } from './dictionary';
|
||||||
|
|
||||||
export class Dictionary implements IDictionary, IListable {
|
export class Dictionary extends Entity<IDictionary> implements IDictionary {
|
||||||
readonly addToDictionaryAction: boolean;
|
readonly addToDictionaryAction: boolean;
|
||||||
readonly caseInsensitive: boolean;
|
readonly caseInsensitive: boolean;
|
||||||
readonly description: string;
|
readonly description: string;
|
||||||
@ -15,6 +15,7 @@ export class Dictionary implements IDictionary, IListable {
|
|||||||
readonly type: string;
|
readonly type: string;
|
||||||
|
|
||||||
constructor(dictionary: IDictionary, readonly virtual = false) {
|
constructor(dictionary: IDictionary, readonly virtual = false) {
|
||||||
|
super(dictionary);
|
||||||
this.addToDictionaryAction = !!dictionary.addToDictionaryAction;
|
this.addToDictionaryAction = !!dictionary.addToDictionaryAction;
|
||||||
this.caseInsensitive = !!dictionary.caseInsensitive;
|
this.caseInsensitive = !!dictionary.caseInsensitive;
|
||||||
this.description = dictionary.description ?? '';
|
this.description = dictionary.description ?? '';
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user