remove typevalue
This commit is contained in:
parent
7e30768a09
commit
e463bb9e5a
@ -6,31 +6,37 @@ export class Dictionary implements IDictionary, IListable {
|
||||
readonly caseInsensitive: boolean;
|
||||
readonly description?: string;
|
||||
readonly dossierTemplateId?: string;
|
||||
readonly entries?: List;
|
||||
entries: List;
|
||||
readonly hexColor?: string;
|
||||
readonly hint: boolean;
|
||||
readonly label: string;
|
||||
readonly rank?: number;
|
||||
readonly recommendation: boolean;
|
||||
readonly type: string;
|
||||
|
||||
constructor(dictionary: IDictionary) {
|
||||
constructor(dictionary: IDictionary, readonly virtual = false) {
|
||||
this.addToDictionaryAction = !!dictionary.addToDictionaryAction;
|
||||
this.caseInsensitive = !!dictionary.caseInsensitive;
|
||||
this.description = dictionary.description;
|
||||
this.dossierTemplateId = dictionary.dossierTemplateId;
|
||||
this.entries = dictionary.entries;
|
||||
this.entries = dictionary.entries ?? [];
|
||||
this.hexColor = dictionary.hexColor;
|
||||
this.hint = !!dictionary.hint;
|
||||
this.label = dictionary.label;
|
||||
this.label = dictionary.label ?? dictionary.type;
|
||||
this.rank = dictionary.rank;
|
||||
this.recommendation = !!dictionary.recommendation;
|
||||
this.type = dictionary.type;
|
||||
}
|
||||
|
||||
get id(): string {
|
||||
return this.label;
|
||||
return this.type;
|
||||
}
|
||||
|
||||
get searchKey(): string {
|
||||
return this.label;
|
||||
return this.label ?? this.type;
|
||||
}
|
||||
|
||||
get routerLink(): string {
|
||||
return `/main/admin/dossier-templates/${this.dossierTemplateId}/dictionaries/${this.type}`;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,8 +4,8 @@ import { AnnotationWrapper } from './annotation.wrapper';
|
||||
import { RedactionLogEntryWrapper } from './redaction-log-entry.wrapper';
|
||||
import { ViewMode } from './view-mode';
|
||||
import * as moment from 'moment';
|
||||
import { TypeValue } from './type-value';
|
||||
import { User } from '@models/user';
|
||||
import { Dictionary } from '@models/dictionary';
|
||||
|
||||
export class AnnotationData {
|
||||
visibleAnnotations: AnnotationWrapper[];
|
||||
@ -20,7 +20,7 @@ export class FileDataModel {
|
||||
constructor(public file: File, public fileData: Blob, public redactionLog: RedactionLog, public viewedPages?: ViewedPages) {}
|
||||
|
||||
getAnnotations(
|
||||
dictionaryData: { [p: string]: TypeValue },
|
||||
dictionaryData: { [p: string]: Dictionary },
|
||||
currentUser: User,
|
||||
viewMode: ViewMode,
|
||||
areDevFeaturesEnabled: boolean,
|
||||
|
||||
@ -1,41 +0,0 @@
|
||||
import { IListable } from '@iqser/common-ui';
|
||||
import { ITypeValue } from '@redaction/red-ui-http';
|
||||
|
||||
export class TypeValue implements ITypeValue, IListable {
|
||||
readonly type: string;
|
||||
readonly addToDictionaryAction: boolean;
|
||||
readonly caseInsensitive: boolean;
|
||||
readonly description?: string;
|
||||
readonly dossierTemplateId?: string;
|
||||
readonly hexColor?: string;
|
||||
readonly label?: string;
|
||||
readonly hint: boolean;
|
||||
readonly rank?: number;
|
||||
readonly recommendation: boolean;
|
||||
entries: string[] = [];
|
||||
|
||||
constructor(typeValue: ITypeValue, readonly virtual = false) {
|
||||
this.type = typeValue.type;
|
||||
this.addToDictionaryAction = !!typeValue.addToDictionaryAction;
|
||||
this.caseInsensitive = !!typeValue.caseInsensitive;
|
||||
this.description = typeValue.description;
|
||||
this.dossierTemplateId = typeValue.dossierTemplateId;
|
||||
this.hexColor = typeValue.hexColor;
|
||||
this.hint = !!typeValue.hint;
|
||||
this.rank = typeValue.rank;
|
||||
this.recommendation = !!typeValue.recommendation;
|
||||
this.label = typeValue.label;
|
||||
}
|
||||
|
||||
get id(): string {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
get searchKey(): string {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
get routerLink(): string {
|
||||
return `/main/admin/dossier-templates/${this.dossierTemplateId}/dictionaries/${this.type}`;
|
||||
}
|
||||
}
|
||||
@ -1,15 +1,15 @@
|
||||
import { Component, Inject } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import { ITypeValue } from '@redaction/red-ui-http';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Toaster } from '@iqser/common-ui';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { TypeValue } from '@models/file/type-value';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { AppStateService } from '@state/app-state.service';
|
||||
import { toKebabCase } from '@utils/functions';
|
||||
import { DictionaryService } from '@shared/services/dictionary.service';
|
||||
import { IDictionary } from '@redaction/red-ui-http';
|
||||
import { Dictionary } from '@models/dictionary';
|
||||
|
||||
@Component({
|
||||
selector: 'redaction-add-edit-dictionary-dialog',
|
||||
@ -18,7 +18,7 @@ import { DictionaryService } from '@shared/services/dictionary.service';
|
||||
})
|
||||
export class AddEditDictionaryDialogComponent {
|
||||
dictionaryForm: FormGroup;
|
||||
readonly dictionary: TypeValue;
|
||||
readonly dictionary: Dictionary;
|
||||
technicalName = '';
|
||||
private readonly _dossierTemplateId: string;
|
||||
|
||||
@ -30,7 +30,7 @@ export class AddEditDictionaryDialogComponent {
|
||||
private readonly _translateService: TranslateService,
|
||||
private readonly _dialogRef: MatDialogRef<AddEditDictionaryDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA)
|
||||
private readonly _data: { dictionary: TypeValue; dossierTemplateId: string },
|
||||
private readonly _data: { dictionary: Dictionary; dossierTemplateId: string },
|
||||
) {
|
||||
this.dictionary = _data.dictionary;
|
||||
this._dossierTemplateId = _data.dossierTemplateId;
|
||||
@ -83,15 +83,15 @@ export class AddEditDictionaryDialogComponent {
|
||||
}
|
||||
|
||||
saveDictionary(): void {
|
||||
const typeValue: ITypeValue = this._formToObject();
|
||||
const dictionary = this._formToObject();
|
||||
let observable: Observable<unknown>;
|
||||
|
||||
if (this.dictionary) {
|
||||
// edit mode
|
||||
observable = this._dictionaryService.updateType(typeValue, this._dossierTemplateId, typeValue.type);
|
||||
observable = this._dictionaryService.updateDictionary(dictionary, this._dossierTemplateId, dictionary.type);
|
||||
} else {
|
||||
// create mode
|
||||
observable = this._dictionaryService.addType({ ...typeValue, dossierTemplateId: this._dossierTemplateId });
|
||||
observable = this._dictionaryService.addDictionary({ ...dictionary, dossierTemplateId: this._dossierTemplateId });
|
||||
}
|
||||
|
||||
observable.subscribe(
|
||||
@ -120,7 +120,7 @@ export class AddEditDictionaryDialogComponent {
|
||||
this.technicalName = technicalName;
|
||||
}
|
||||
|
||||
private _formToObject(): ITypeValue {
|
||||
private _formToObject(): IDictionary {
|
||||
return {
|
||||
type: this.dictionary?.type || this.technicalName,
|
||||
label: this.dictionaryForm.get('label').value,
|
||||
|
||||
@ -103,7 +103,7 @@
|
||||
</div>
|
||||
|
||||
<div class="cell center">
|
||||
<redaction-annotation-icon [dictType]="dict" [type]="dict.hint ? 'circle' : 'square'"></redaction-annotation-icon>
|
||||
<redaction-annotation-icon [dictionary]="dict" [type]="dict.hint ? 'circle' : 'square'"></redaction-annotation-icon>
|
||||
</div>
|
||||
|
||||
<div class="cell">
|
||||
|
||||
@ -4,7 +4,6 @@ import { AppStateService } from '@state/app-state.service';
|
||||
import { catchError, defaultIfEmpty, tap } from 'rxjs/operators';
|
||||
import { forkJoin, of } from 'rxjs';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { TypeValue } from '@models/file/type-value';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import {
|
||||
CircleButtonTypes,
|
||||
@ -19,8 +18,9 @@ import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { UserService } from '@services/user.service';
|
||||
import { DictionaryService } from '@shared/services/dictionary.service';
|
||||
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
|
||||
import { Dictionary } from '@models/dictionary';
|
||||
|
||||
const toChartConfig = (dict: TypeValue): DoughnutChartConfig => ({
|
||||
const toChartConfig = (dict: Dictionary): DoughnutChartConfig => ({
|
||||
value: dict.entries?.length ?? 0,
|
||||
color: dict.hexColor,
|
||||
label: dict.label,
|
||||
@ -32,12 +32,12 @@ const toChartConfig = (dict: TypeValue): DoughnutChartConfig => ({
|
||||
styleUrls: ['./dictionary-listing-screen.component.scss'],
|
||||
providers: [...DefaultListingServices, { provide: ListingComponent, useExisting: forwardRef(() => DictionaryListingScreenComponent) }],
|
||||
})
|
||||
export class DictionaryListingScreenComponent extends ListingComponent<TypeValue> implements OnInit {
|
||||
export class DictionaryListingScreenComponent extends ListingComponent<Dictionary> implements OnInit {
|
||||
readonly iconButtonTypes = IconButtonTypes;
|
||||
readonly circleButtonTypes = CircleButtonTypes;
|
||||
readonly currentUser = this._userService.currentUser;
|
||||
readonly tableHeaderLabel = _('dictionary-listing.table-header.title');
|
||||
readonly tableColumnConfigs: TableColumnConfig<TypeValue>[] = [
|
||||
readonly tableColumnConfigs: TableColumnConfig<Dictionary>[] = [
|
||||
{ label: _('dictionary-listing.table-col-names.type'), sortByKey: 'searchKey', width: '2fr' },
|
||||
{ label: _('dictionary-listing.table-col-names.order-of-importance'), sortByKey: 'rank', class: 'flex-center' },
|
||||
{ label: _('dictionary-listing.table-col-names.hint-redaction'), class: 'flex-center' },
|
||||
@ -67,7 +67,7 @@ export class DictionaryListingScreenComponent extends ListingComponent<TypeValue
|
||||
this._dialogService.openDialog('confirm', $event, null, async () => {
|
||||
this._loadingService.start();
|
||||
await this._dictionaryService
|
||||
.deleteTypes(
|
||||
.deleteDictionaries(
|
||||
types.map(t => t.type),
|
||||
this._dossierTemplatesService.activeDossierTemplateId,
|
||||
)
|
||||
@ -79,7 +79,7 @@ export class DictionaryListingScreenComponent extends ListingComponent<TypeValue
|
||||
});
|
||||
}
|
||||
|
||||
openAddEditDictionaryDialog($event?: MouseEvent, dictionary?: TypeValue) {
|
||||
openAddEditDictionaryDialog($event?: MouseEvent, dictionary?: Dictionary) {
|
||||
this._dialogService.openDialog(
|
||||
'addEditDictionary',
|
||||
$event,
|
||||
|
||||
@ -7,10 +7,10 @@ import { ComponentHasChanges } from '@guards/can-deactivate.guard';
|
||||
import { AdminDialogService } from '../../services/admin-dialog.service';
|
||||
import { DictionaryManagerComponent } from '@shared/components/dictionary-manager/dictionary-manager.component';
|
||||
import { DictionaryService } from '@shared/services/dictionary.service';
|
||||
import { TypeValue } from '@models/file/type-value';
|
||||
import { CircleButtonTypes, LoadingService } from '@iqser/common-ui';
|
||||
import { UserService } from '@services/user.service';
|
||||
import { DossierTemplatesService } from '@services/entity-services/dossier-templates.service';
|
||||
import { Dictionary } from '@models/dictionary';
|
||||
|
||||
@Component({
|
||||
templateUrl: './dictionary-overview-screen.component.html',
|
||||
@ -21,7 +21,7 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple
|
||||
readonly currentUser = this._userService.currentUser;
|
||||
|
||||
entries: string[] = [];
|
||||
dictionary: TypeValue;
|
||||
dictionary: Dictionary;
|
||||
|
||||
@ViewChild('dictionaryManager', { static: false })
|
||||
private readonly _dictionaryManager: DictionaryManagerComponent;
|
||||
@ -72,7 +72,7 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple
|
||||
$event?.stopPropagation();
|
||||
|
||||
this._dialogService.openDialog('confirm', $event, null, async () => {
|
||||
await this._dictionaryService.deleteTypes([this.dictionary.type], this.dictionary.dossierTemplateId).toPromise();
|
||||
await this._dictionaryService.deleteDictionaries([this.dictionary.type], this.dictionary.dossierTemplateId).toPromise();
|
||||
await this._appStateService.loadDictionaryData();
|
||||
await this._router.navigate([
|
||||
'/main',
|
||||
|
||||
@ -46,9 +46,9 @@ export class EditDossierDictionaryComponent implements EditDossierSectionInterfa
|
||||
}
|
||||
|
||||
async updateDisplayName(label: string) {
|
||||
const typeValue: IDictionary = { ...this.dossier.type, label };
|
||||
const dictionary: IDictionary = { ...this.dossier.type, label };
|
||||
await this._dictionaryService
|
||||
.updateType(typeValue, this.dossier.dossierTemplateId, 'dossier_redaction', this.dossier.id)
|
||||
.updateDictionary(dictionary, this.dossier.dossierTemplateId, 'dossier_redaction', this.dossier.id)
|
||||
.toPromise();
|
||||
await this._dossiersService.updateDossierDictionary(this.dossier.dossierTemplateId, this.dossier.id);
|
||||
this.updateDossier.emit();
|
||||
|
||||
@ -10,9 +10,9 @@ import { ManualRedactionEntryWrapper } from '@models/file/manual-redaction-entry
|
||||
import { ManualAnnotationService } from '../../services/manual-annotation.service';
|
||||
import { ManualAnnotationResponse } from '@models/file/manual-annotation-response';
|
||||
import { PermissionsService } from '@services/permissions.service';
|
||||
import { TypeValue } from '@models/file/type-value';
|
||||
import { DossiersService } from '@services/entity-services/dossiers.service';
|
||||
import { JustificationsService } from '@services/entity-services/justifications.service';
|
||||
import { Dictionary } from '@models/dictionary';
|
||||
|
||||
export interface LegalBasisOption {
|
||||
label?: string;
|
||||
@ -32,7 +32,7 @@ export class ManualAnnotationDialogComponent implements OnInit {
|
||||
isDictionaryRequest: boolean;
|
||||
isFalsePositiveRequest: boolean;
|
||||
|
||||
redactionDictionaries: TypeValue[] = [];
|
||||
redactionDictionaries: Dictionary[] = [];
|
||||
legalOptions: LegalBasisOption[] = [];
|
||||
|
||||
constructor(
|
||||
@ -62,7 +62,7 @@ export class ManualAnnotationDialogComponent implements OnInit {
|
||||
});
|
||||
|
||||
for (const key of Object.keys(this._appStateService.dictionaryData[this._dossiersService.activeDossier.dossierTemplateId])) {
|
||||
const dictionaryData = this._appStateService.getDictionaryTypeValue(key);
|
||||
const dictionaryData = this._appStateService.getDictionary(key);
|
||||
if (!dictionaryData.virtual && dictionaryData.addToDictionaryAction) {
|
||||
this.redactionDictionaries.push(dictionaryData);
|
||||
}
|
||||
|
||||
@ -69,7 +69,7 @@ export class ManualAnnotationService extends GenericService<ManualAddResponse> {
|
||||
this._toaster.error(this._getMessage(mode, modifyDictionary, true, isConflict), {
|
||||
error,
|
||||
params: {
|
||||
dictionaryName: this._appStateService.getDictionaryTypeValue(body.type).label,
|
||||
dictionaryName: this._appStateService.getDictionary(body.type).label,
|
||||
content: body.value,
|
||||
},
|
||||
positionClass: 'toast-file-preview',
|
||||
|
||||
@ -6,5 +6,5 @@
|
||||
[class.request]="isRequest"
|
||||
class="icon"
|
||||
>
|
||||
<span>{{ label || dictType.label.charAt(0) }}</span>
|
||||
<span>{{ label || dictionary.label.charAt(0) }}</span>
|
||||
</div>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { Component, ElementRef, Input, OnChanges, ViewChild } from '@angular/core';
|
||||
import { TypeValue } from '@models/file/type-value';
|
||||
import { Dictionary } from '@models/dictionary';
|
||||
|
||||
@Component({
|
||||
selector: 'redaction-annotation-icon',
|
||||
@ -10,24 +10,24 @@ export class AnnotationIconComponent implements OnChanges {
|
||||
@Input() color: string;
|
||||
@Input() type: 'square' | 'rhombus' | 'circle' | 'hexagon' | 'none';
|
||||
@Input() label: string;
|
||||
@Input() dictType: TypeValue;
|
||||
@Input() dictionary: Dictionary;
|
||||
|
||||
@ViewChild('icon', { static: true }) icon: ElementRef;
|
||||
|
||||
get isHint() {
|
||||
return this.type === 'circle' || this.dictType?.type === 'hint';
|
||||
return this.type === 'circle' || this.dictionary?.type === 'hint';
|
||||
}
|
||||
|
||||
get isRequest() {
|
||||
return this.type === 'rhombus' || this.dictType?.type === 'redaction';
|
||||
return this.type === 'rhombus' || this.dictionary?.type === 'redaction';
|
||||
}
|
||||
|
||||
get isRecommendation() {
|
||||
return this.type === 'hexagon' || this.dictType?.type === 'recommendation';
|
||||
return this.type === 'hexagon' || this.dictionary?.type === 'recommendation';
|
||||
}
|
||||
|
||||
get backgroundColor() {
|
||||
return this.color || this.dictType?.hexColor;
|
||||
return this.color || this.dictionary?.hexColor;
|
||||
}
|
||||
|
||||
ngOnChanges() {
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
import { Component, Input, OnChanges } from '@angular/core';
|
||||
import { AppStateService } from '@state/app-state.service';
|
||||
import { TypeValue } from '@models/file/type-value';
|
||||
|
||||
@Component({
|
||||
selector: 'redaction-dictionary-annotation-icon',
|
||||
@ -19,9 +18,9 @@ export class DictionaryAnnotationIconComponent implements OnChanges {
|
||||
|
||||
ngOnChanges(): void {
|
||||
if (this.dictionaryKey) {
|
||||
const typeValue: TypeValue = this._appStateService.getDictionaryTypeValue(this.dictionaryKey, this.dossierTemplateId);
|
||||
const dictionary = this._appStateService.getDictionary(this.dictionaryKey, this.dossierTemplateId);
|
||||
this.color = this._appStateService.getDictionaryColor(this.dictionaryKey, this.dossierTemplateId);
|
||||
this.type = typeValue.hint ? 'circle' : 'square';
|
||||
this.type = dictionary.hint ? 'circle' : 'square';
|
||||
this.label = this.dictionaryKey[0].toUpperCase();
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@ import { DossierTemplatesService } from '@services/entity-services/dossier-templ
|
||||
import { DossierTemplate } from '@models/file/dossier-template';
|
||||
import { AppStateService } from '@state/app-state.service';
|
||||
import { EditorComponent } from '@shared/components/editor/editor.component';
|
||||
import { TypeValue } from '@models/file/type-value';
|
||||
import { Dictionary } from '@models/dictionary';
|
||||
import IModelDeltaDecoration = monaco.editor.IModelDeltaDecoration;
|
||||
import FindMatch = monaco.editor.FindMatch;
|
||||
|
||||
@ -39,10 +39,10 @@ export class DictionaryManagerComponent implements OnChanges {
|
||||
selectDossier = { dossierName: _('dictionary-overview.compare.select-dossier') } as Dossier;
|
||||
selectDictionary = {
|
||||
label: _('dictionary-overview.compare.select-dictionary'),
|
||||
} as TypeValue;
|
||||
} as Dictionary;
|
||||
selectDossierTemplate = { name: _('dictionary-overview.compare.select-dossier-template') } as DossierTemplate;
|
||||
compare: false;
|
||||
dictionaries: List<TypeValue> = this._dictionaries;
|
||||
dictionaries: List<Dictionary> = this._dictionaries;
|
||||
private _searchDecorations: string[] = [];
|
||||
|
||||
constructor(
|
||||
@ -94,7 +94,7 @@ export class DictionaryManagerComponent implements OnChanges {
|
||||
return this._dictionary;
|
||||
}
|
||||
|
||||
set dictionary(dictionary: TypeValue) {
|
||||
set dictionary(dictionary: Dictionary) {
|
||||
this._dictionary = dictionary;
|
||||
|
||||
if (dictionary.label === this.selectDictionary.label) {
|
||||
@ -107,7 +107,7 @@ export class DictionaryManagerComponent implements OnChanges {
|
||||
this.appStateService.dictionaryData[this._dictionary.dossierTemplateId][this._dictionary.type].entries;
|
||||
|
||||
if (entries.length) {
|
||||
this.diffEditorText = this._toString(entries);
|
||||
this.diffEditorText = this._toString([...entries]);
|
||||
this.showDiffEditor = true;
|
||||
return;
|
||||
}
|
||||
@ -123,7 +123,7 @@ export class DictionaryManagerComponent implements OnChanges {
|
||||
)
|
||||
.toPromise()
|
||||
.then(() => {
|
||||
this.diffEditorText = this._toString(this._dictionary.entries);
|
||||
this.diffEditorText = this._toString([...this._dictionary.entries]);
|
||||
this.showDiffEditor = true;
|
||||
});
|
||||
}
|
||||
@ -132,7 +132,7 @@ export class DictionaryManagerComponent implements OnChanges {
|
||||
if (!this._dossierTemplate || this._dossierTemplate.name === this.selectDossierTemplate.name) {
|
||||
return;
|
||||
}
|
||||
return Object.values(this.appStateService.dictionaryData[this.dossierTemplate?.dossierTemplateId]).filter(dict => !!dict.label);
|
||||
return Object.values(this.appStateService.dictionaryData[this.dossierTemplate?.dossierTemplateId]).filter(dict => !dict.virtual);
|
||||
}
|
||||
|
||||
get dossierTemplateIsNotSelected() {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { Injectable, Injector } from '@angular/core';
|
||||
import { Observable, throwError } from 'rxjs';
|
||||
import { EntitiesService, List, QueryParam, RequiredParam, Toaster, Validate } from '@iqser/common-ui';
|
||||
import { Colors, IDictionary, ITypeValue, UpdateTypeValue } from '@redaction/red-ui-http';
|
||||
import { Colors, IDictionary, UpdateDictionary } from '@redaction/red-ui-http';
|
||||
import { tap } from 'rxjs/operators';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { Dictionary } from '@models/dictionary';
|
||||
@ -29,7 +29,7 @@ export class DictionaryService extends EntitiesService<Dictionary, IDictionary>
|
||||
* Deletes entry types
|
||||
*/
|
||||
@Validate()
|
||||
deleteTypes(@RequiredParam() body: List, @RequiredParam() dossierTemplateId: string, dossierId?: string) {
|
||||
deleteDictionaries(@RequiredParam() body: List, @RequiredParam() dossierTemplateId: string, dossierId?: string) {
|
||||
const queryParams = dossierId ? [{ key: 'dossierId', value: dossierId }] : undefined;
|
||||
const url = `${this._defaultModelPath}/type/${dossierTemplateId}/delete`;
|
||||
return this._post<unknown>(body, url, queryParams);
|
||||
@ -39,9 +39,9 @@ export class DictionaryService extends EntitiesService<Dictionary, IDictionary>
|
||||
* Retrieve all entry types
|
||||
*/
|
||||
@Validate()
|
||||
getAllTypes(@RequiredParam() dossierTemplateId: string, dossierId?: string) {
|
||||
getAllDictionaries(@RequiredParam() dossierTemplateId: string, dossierId?: string) {
|
||||
const queryParams = dossierId ? [{ key: 'dossierId', value: dossierId }] : undefined;
|
||||
return this._getOne<{ types: ITypeValue[] }>(['type', dossierTemplateId], this._defaultModelPath, queryParams);
|
||||
return this._getOne<{ types: IDictionary[] }>(['type', dossierTemplateId], this._defaultModelPath, queryParams);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -56,8 +56,8 @@ export class DictionaryService extends EntitiesService<Dictionary, IDictionary>
|
||||
* Updates colors, hint and caseInsensitive of an entry type.
|
||||
*/
|
||||
@Validate()
|
||||
updateType(
|
||||
@RequiredParam() body: UpdateTypeValue,
|
||||
updateDictionary(
|
||||
@RequiredParam() body: UpdateDictionary,
|
||||
@RequiredParam() dossierTemplateId: string,
|
||||
@RequiredParam() type: string,
|
||||
dossierId?: string,
|
||||
@ -79,7 +79,7 @@ export class DictionaryService extends EntitiesService<Dictionary, IDictionary>
|
||||
* Creates entry type with colors, hint and caseInsensitive
|
||||
*/
|
||||
@Validate()
|
||||
addType(@RequiredParam() body: ITypeValue, dossierId?: string) {
|
||||
addDictionary(@RequiredParam() body: IDictionary, dossierId?: string) {
|
||||
const queryParams = dossierId ? [{ key: 'dossierId', value: dossierId }] : undefined;
|
||||
return this._post(body, `${this._defaultModelPath}/type`, queryParams);
|
||||
}
|
||||
|
||||
@ -7,7 +7,6 @@ import { catchError, filter, first, map, tap } from 'rxjs/operators';
|
||||
import { currentComponentRoute, FALLBACK_COLOR, hexToRgb } from '@utils/functions';
|
||||
import { File } from '@models/file/file';
|
||||
import { Dossier } from './model/dossier';
|
||||
import { TypeValue } from '@models/file/type-value';
|
||||
import { DossierTemplate } from '@models/file/dossier-template';
|
||||
import { DossiersService } from '@services/entity-services/dossiers.service';
|
||||
import { UserPreferenceService } from '@services/user-preference.service';
|
||||
@ -16,6 +15,7 @@ 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';
|
||||
import { ReanalysisService } from '@services/reanalysis.service';
|
||||
import { Dictionary } from '@models/dictionary';
|
||||
|
||||
export interface AppState {
|
||||
activeFileId?: string;
|
||||
@ -65,9 +65,9 @@ export class AppStateService {
|
||||
});
|
||||
}
|
||||
|
||||
private _dictionaryData?: { [key: string]: { [key: string]: TypeValue } };
|
||||
private _dictionaryData?: { [key: string]: { [key: string]: Dictionary } };
|
||||
|
||||
get dictionaryData(): { [key: string]: { [key: string]: TypeValue } } | undefined {
|
||||
get dictionaryData(): { [key: string]: { [key: string]: Dictionary } } | undefined {
|
||||
return this._dictionaryData;
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ export class AppStateService {
|
||||
return this._appState.activeDictionaryType;
|
||||
}
|
||||
|
||||
get activeDictionary(): TypeValue | undefined {
|
||||
get activeDictionary(): Dictionary | undefined {
|
||||
const activeDossierTemplateId = this._dossierTemplatesService.activeDossierTemplateId;
|
||||
return activeDossierTemplateId && this.activeDictionaryType && this.dictionaryData && this.dictionaryData[activeDossierTemplateId]
|
||||
? this.dictionaryData[activeDossierTemplateId][this.activeDictionaryType]
|
||||
@ -114,7 +114,7 @@ export class AppStateService {
|
||||
return color ?? this._dictionaryData[dossierTemplateId]['default'].hexColor;
|
||||
}
|
||||
|
||||
getDictionaryTypeValue(key: string, dossierTemplateId = this._dossiersService.activeDossier.dossierTemplateId): TypeValue | undefined {
|
||||
getDictionary(key: string, dossierTemplateId = this._dossiersService.activeDossier.dossierTemplateId): Dictionary | undefined {
|
||||
if (!dossierTemplateId) {
|
||||
dossierTemplateId = this.dossierTemplates.length > 0 ? this.dossierTemplates[0].dossierTemplateId : undefined;
|
||||
}
|
||||
@ -289,10 +289,10 @@ export class AppStateService {
|
||||
private _getDictionaryDataForDossierTemplate$(dossierTemplateId: string): Observable<{ [key: string]: any }> {
|
||||
const dictionaryData: { [key: string]: any } = {};
|
||||
|
||||
const typeObs = this._dictionaryService.getAllTypes(dossierTemplateId).pipe(
|
||||
const typeObs = this._dictionaryService.getAllDictionaries(dossierTemplateId).pipe(
|
||||
tap(typesResponse => {
|
||||
for (const type of typesResponse.types) {
|
||||
dictionaryData[type.type] = new TypeValue(type);
|
||||
dictionaryData[type.type] = new Dictionary(type);
|
||||
}
|
||||
}),
|
||||
);
|
||||
@ -311,7 +311,7 @@ export class AppStateService {
|
||||
}
|
||||
}
|
||||
|
||||
dictionaryData['declined-suggestion'] = new TypeValue(
|
||||
dictionaryData['declined-suggestion'] = new Dictionary(
|
||||
{
|
||||
hexColor: colors.notRedacted || FALLBACK_COLOR,
|
||||
type: 'declined-suggestion',
|
||||
@ -319,7 +319,7 @@ export class AppStateService {
|
||||
true,
|
||||
);
|
||||
|
||||
dictionaryData['manual'] = new TypeValue(
|
||||
dictionaryData['manual'] = new Dictionary(
|
||||
{
|
||||
hexColor: colors.manualRedactionColor || FALLBACK_COLOR,
|
||||
type: 'manual',
|
||||
@ -327,7 +327,7 @@ export class AppStateService {
|
||||
true,
|
||||
);
|
||||
|
||||
dictionaryData['manual-redaction'] = new TypeValue(
|
||||
dictionaryData['manual-redaction'] = new Dictionary(
|
||||
{
|
||||
hexColor: colors.manualRedactionColor || FALLBACK_COLOR,
|
||||
type: 'manual-redaction',
|
||||
@ -335,7 +335,7 @@ export class AppStateService {
|
||||
true,
|
||||
);
|
||||
// dictionary actions
|
||||
dictionaryData['recommendation'] = new TypeValue(
|
||||
dictionaryData['recommendation'] = new Dictionary(
|
||||
{
|
||||
hexColor: '#c5d3eb',
|
||||
type: 'recommendation',
|
||||
@ -343,21 +343,21 @@ export class AppStateService {
|
||||
true,
|
||||
);
|
||||
// dictionary actions
|
||||
dictionaryData['add-dictionary'] = new TypeValue(
|
||||
dictionaryData['add-dictionary'] = new Dictionary(
|
||||
{
|
||||
hexColor: colors.analysisColor || FALLBACK_COLOR,
|
||||
type: 'add-dictionary',
|
||||
},
|
||||
true,
|
||||
);
|
||||
dictionaryData['remove-dictionary'] = new TypeValue(
|
||||
dictionaryData['remove-dictionary'] = new Dictionary(
|
||||
{
|
||||
hexColor: colors.analysisColor || FALLBACK_COLOR,
|
||||
type: 'remove-dictionary',
|
||||
},
|
||||
true,
|
||||
);
|
||||
dictionaryData['remove-only-here'] = new TypeValue(
|
||||
dictionaryData['remove-only-here'] = new Dictionary(
|
||||
{
|
||||
hexColor: colors.analysisColor || FALLBACK_COLOR,
|
||||
type: 'remove-only-here',
|
||||
@ -365,7 +365,7 @@ export class AppStateService {
|
||||
true,
|
||||
);
|
||||
// generic suggestions
|
||||
dictionaryData['suggestion'] = new TypeValue(
|
||||
dictionaryData['suggestion'] = new Dictionary(
|
||||
{
|
||||
hexColor: colors.requestAdd || FALLBACK_COLOR,
|
||||
type: 'suggestion',
|
||||
@ -373,7 +373,7 @@ export class AppStateService {
|
||||
true,
|
||||
);
|
||||
|
||||
dictionaryData['suggestion-add'] = new TypeValue(
|
||||
dictionaryData['suggestion-add'] = new Dictionary(
|
||||
{
|
||||
hexColor: colors.requestAdd || FALLBACK_COLOR,
|
||||
type: 'suggestion-add',
|
||||
@ -381,21 +381,21 @@ export class AppStateService {
|
||||
true,
|
||||
);
|
||||
// add suggestions
|
||||
dictionaryData['suggestion-change-legal-basis'] = new TypeValue(
|
||||
dictionaryData['suggestion-change-legal-basis'] = new Dictionary(
|
||||
{
|
||||
hexColor: colors.requestAdd || FALLBACK_COLOR,
|
||||
type: 'suggestion-change-legal-basis',
|
||||
},
|
||||
true,
|
||||
);
|
||||
dictionaryData['suggestion-recategorize-image'] = new TypeValue(
|
||||
dictionaryData['suggestion-recategorize-image'] = new Dictionary(
|
||||
{
|
||||
hexColor: colors.requestAdd || FALLBACK_COLOR,
|
||||
type: 'suggestion-recategorize-image',
|
||||
},
|
||||
true,
|
||||
);
|
||||
dictionaryData['suggestion-add-dictionary'] = new TypeValue(
|
||||
dictionaryData['suggestion-add-dictionary'] = new Dictionary(
|
||||
{
|
||||
hexColor: colors.dictionaryRequestColor || FALLBACK_COLOR,
|
||||
type: 'suggestion-add',
|
||||
@ -403,7 +403,7 @@ export class AppStateService {
|
||||
true,
|
||||
);
|
||||
|
||||
dictionaryData['suggestion-remove'] = new TypeValue(
|
||||
dictionaryData['suggestion-remove'] = new Dictionary(
|
||||
{
|
||||
hexColor: colors.requestRemove || FALLBACK_COLOR,
|
||||
type: 'suggestion-add',
|
||||
@ -411,7 +411,7 @@ export class AppStateService {
|
||||
true,
|
||||
);
|
||||
|
||||
dictionaryData['suggestion-remove-dictionary'] = new TypeValue(
|
||||
dictionaryData['suggestion-remove-dictionary'] = new Dictionary(
|
||||
{
|
||||
hexColor: colors.dictionaryRequestColor || FALLBACK_COLOR,
|
||||
type: 'suggestion-add',
|
||||
@ -419,7 +419,7 @@ export class AppStateService {
|
||||
true,
|
||||
);
|
||||
|
||||
dictionaryData['skipped'] = new TypeValue(
|
||||
dictionaryData['skipped'] = new Dictionary(
|
||||
{
|
||||
hexColor: colors.notRedacted || FALLBACK_COLOR,
|
||||
type: 'skipped',
|
||||
@ -427,7 +427,7 @@ export class AppStateService {
|
||||
true,
|
||||
);
|
||||
|
||||
dictionaryData['default'] = new TypeValue(
|
||||
dictionaryData['default'] = new Dictionary(
|
||||
{
|
||||
hexColor: colors.defaultColor || FALLBACK_COLOR,
|
||||
type: 'default',
|
||||
@ -435,7 +435,7 @@ export class AppStateService {
|
||||
true,
|
||||
);
|
||||
|
||||
dictionaryData['add'] = new TypeValue(
|
||||
dictionaryData['add'] = new Dictionary(
|
||||
{
|
||||
hexColor: colors.requestAdd || FALLBACK_COLOR,
|
||||
type: 'add',
|
||||
@ -443,7 +443,7 @@ export class AppStateService {
|
||||
true,
|
||||
);
|
||||
|
||||
dictionaryData['analysis'] = new TypeValue(
|
||||
dictionaryData['analysis'] = new Dictionary(
|
||||
{
|
||||
hexColor: colors.analysisColor || FALLBACK_COLOR,
|
||||
type: 'analysis',
|
||||
@ -451,7 +451,7 @@ export class AppStateService {
|
||||
true,
|
||||
);
|
||||
|
||||
dictionaryData['pending-analysis'] = new TypeValue(
|
||||
dictionaryData['pending-analysis'] = new Dictionary(
|
||||
{
|
||||
hexColor: colors.analysisColor || FALLBACK_COLOR,
|
||||
type: 'analysis',
|
||||
@ -459,7 +459,7 @@ export class AppStateService {
|
||||
true,
|
||||
);
|
||||
|
||||
dictionaryData['change-legal-basis'] = new TypeValue(
|
||||
dictionaryData['change-legal-basis'] = new Dictionary(
|
||||
{
|
||||
hexColor: colors.analysisColor || FALLBACK_COLOR,
|
||||
type: 'analysis',
|
||||
@ -467,7 +467,7 @@ export class AppStateService {
|
||||
true,
|
||||
);
|
||||
|
||||
dictionaryData['hint'] = new TypeValue(
|
||||
dictionaryData['hint'] = new Dictionary(
|
||||
{
|
||||
hexColor: '#fa98f7',
|
||||
type: 'hint',
|
||||
@ -476,7 +476,7 @@ export class AppStateService {
|
||||
true,
|
||||
);
|
||||
|
||||
dictionaryData['redaction'] = new TypeValue(
|
||||
dictionaryData['redaction'] = new Dictionary(
|
||||
{
|
||||
hexColor: colors.previewColor || FALLBACK_COLOR,
|
||||
type: 'redaction',
|
||||
@ -484,7 +484,7 @@ export class AppStateService {
|
||||
true,
|
||||
);
|
||||
|
||||
dictionaryData['updated'] = new TypeValue(
|
||||
dictionaryData['updated'] = new Dictionary(
|
||||
{
|
||||
hexColor: colors.updatedColor || FALLBACK_COLOR,
|
||||
type: 'updated',
|
||||
|
||||
@ -32,6 +32,10 @@ export interface IDictionary {
|
||||
* The DossierTemplate Id for this type
|
||||
*/
|
||||
readonly dossierTemplateId?: string;
|
||||
/**
|
||||
* The nonnull entry type.
|
||||
*/
|
||||
readonly type: string;
|
||||
/**
|
||||
* The list of dictionary entries of an entry type.
|
||||
*/
|
||||
@ -47,7 +51,7 @@ export interface IDictionary {
|
||||
/**
|
||||
* Label of the type
|
||||
*/
|
||||
readonly label: string;
|
||||
readonly label?: string;
|
||||
/**
|
||||
* The rank of this dictionary, higher rank means higher importance.
|
||||
*/
|
||||
|
||||
@ -62,10 +62,9 @@ export * from './searchRequest';
|
||||
export * from './searchResult';
|
||||
export * from './sectionGrid';
|
||||
export * from './sectionRectangle';
|
||||
export * from './typeValue';
|
||||
export * from './updateMyProfileRequest';
|
||||
export * from './updateProfileRequest';
|
||||
export * from './updateTypeValue';
|
||||
export * from './updateDictionary';
|
||||
export * from './user';
|
||||
export * from './viewedPage';
|
||||
export * from './viewedPages';
|
||||
|
||||
@ -1,57 +0,0 @@
|
||||
/**
|
||||
* API Documentation for Redaction Gateway
|
||||
* Description for redaction
|
||||
*
|
||||
* OpenAPI spec version: 1.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Object containing entry type with an array of r-g-b colors.
|
||||
*/
|
||||
export interface ITypeValue {
|
||||
/**
|
||||
* If true the ui will add a action to add values to dictionary
|
||||
*/
|
||||
readonly addToDictionaryAction?: boolean;
|
||||
/**
|
||||
* True if the entries in this type should be matched case insensitively, default is false.
|
||||
*/
|
||||
readonly caseInsensitive?: boolean;
|
||||
/**
|
||||
* The description of the dictionary type
|
||||
*/
|
||||
readonly description?: string;
|
||||
/**
|
||||
* The DossierTemplate Id for this type
|
||||
*/
|
||||
readonly dossierTemplateId?: string;
|
||||
/**
|
||||
* The value of color must be a correct hex color
|
||||
*/
|
||||
readonly hexColor?: string;
|
||||
/**
|
||||
* True if the type just for hint, not for redaction, default is false.
|
||||
*/
|
||||
readonly hint?: boolean;
|
||||
/**
|
||||
* The rank of this dictionary, higher rank means higher importance.
|
||||
*/
|
||||
readonly rank?: number;
|
||||
/**
|
||||
* True if the type just for recommendations, not for redaction, default is false.
|
||||
*/
|
||||
readonly recommendation?: boolean;
|
||||
/**
|
||||
* The nonnull entry type.
|
||||
*/
|
||||
readonly type?: string;
|
||||
/**
|
||||
* The label of this type
|
||||
*/
|
||||
readonly label?: string;
|
||||
}
|
||||
@ -13,7 +13,7 @@
|
||||
/**
|
||||
* Object containing information of type to be updated.
|
||||
*/
|
||||
export interface UpdateTypeValue {
|
||||
export interface UpdateDictionary {
|
||||
/**
|
||||
* If true the ui will add a action to add values to dictionary
|
||||
*/
|
||||
Loading…
x
Reference in New Issue
Block a user