diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/structured-component-management-dialog/structured-component-management-dialog.component.html b/apps/red-ui/src/app/modules/file-preview/dialogs/structured-component-management-dialog/structured-component-management-dialog.component.html
index 4b779a302..cd67148ea 100644
--- a/apps/red-ui/src/app/modules/file-preview/dialogs/structured-component-management-dialog/structured-component-management-dialog.component.html
+++ b/apps/red-ui/src/app/modules/file-preview/dialogs/structured-component-management-dialog/structured-component-management-dialog.component.html
@@ -3,32 +3,36 @@
-
+
-
- {{ entry.value }}
+
+ {{ entry.name.replaceAll('_', ' ').toLowerCase() }}
- {{ entry.componentRuleId }}
+ {{ entry.componentValues[0].valueDescription }}
-
+
- (undefined);
+ readonly componentLogData = signal(undefined);
readonly openScmDialogByDefault = signal(this.userPreferences.getOpenScmDialogByDefault());
constructor(
@@ -108,7 +108,7 @@ export class StructuredComponentManagementDialogComponent extends BaseDialogComp
const componentLogData = await firstValueFrom(
this._componentLogService.getComponentLogData(this.data.file.dossierId, this.data.file.fileId),
);
- this.scmData.set(componentLogData);
+ this.componentLogData.set(componentLogData);
this._loadingService.stop();
}
}
diff --git a/apps/red-ui/src/app/services/files/component-log.service.ts b/apps/red-ui/src/app/services/files/component-log.service.ts
index b528603ce..bd5c9eec4 100644
--- a/apps/red-ui/src/app/services/files/component-log.service.ts
+++ b/apps/red-ui/src/app/services/files/component-log.service.ts
@@ -1,49 +1,38 @@
import { Injectable } from '@angular/core';
-import { GenericService, QueryParam } from '@iqser/common-ui';
+import { GenericService } from '@iqser/common-ui';
import { catchError, map, tap } from 'rxjs/operators';
import { Observable, of } from 'rxjs';
import { HttpHeaders } from '@angular/common/http';
import { saveAs } from 'file-saver';
import { ComponentLogEntry, IComponentLogData, IComponentLogEntry } from '@red/domain';
+import { filterEach, mapEach } from '@common-ui/utils';
@Injectable({ providedIn: 'root' })
export class ComponentLogService extends GenericService {
protected readonly _defaultModelPath = 'import-redactions';
- getComponentLogData(dossierId: string, fileId: string): Observable {
- const queryParams: QueryParam[] = [];
- queryParams.push({ key: 'fileId', value: fileId });
-
- return this._getOne([dossierId], 'componentLog', queryParams).pipe(
- map(data => data.componentLogEntries[0]),
- catchError(() => of({} as IComponentLogEntry)),
- map(data => new ComponentLogEntry(data)),
- );
- }
-
- getComponentLogExportData(dossierId: string, fileId: string): Observable {
- const queryParams: QueryParam[] = [];
- queryParams.push({ key: 'fileId', value: fileId });
-
- return this._getOne([dossierId], 'rss', queryParams).pipe(
- map(data => data.files[0]),
- catchError(() => of({} as IComponentLogEntry)),
+ getComponentLogData(dossierId: string, fileId: string): Observable {
+ return this._getOne([dossierId, fileId], 'componentLog').pipe(
+ map(data => data.componentLogEntries),
+ catchError(() => of({} as IComponentLogEntry[])),
+ filterEach(log => !!log.componentValues[0].componentLogEntityReferences.length),
+ mapEach(log => new ComponentLogEntry(log)),
);
}
override(dossierId: string, fileId: string, componentOverrides: Record): Observable {
- return this._post({ componentOverrides }, `rss/override/${dossierId}/${fileId}`);
+ return this._post({ componentOverrides }, `componentLog/override/${dossierId}/${fileId}`);
}
revertOverride(dossierId: string, fileId: string, components: string[]): Observable {
- return this._post({ components }, `rss/override/revert/${dossierId}/${fileId}`);
+ return this._post({ components }, `componentLog/override/revert/${dossierId}/${fileId}`);
}
- exportJSON(dossierId: string, fileId: string, name: string): Observable {
- return this.getComponentLogExportData(dossierId, fileId).pipe(
+ exportJSON(dossierId: string, fileId: string, name: string): Observable {
+ return this.getComponentLogData(dossierId, fileId).pipe(
tap(data => {
const blob = new Blob([JSON.stringify(data, null, 2)], { type: 'application/json' });
- saveAs(blob, name + '.rss.json');
+ saveAs(blob, name + '.component_log.json');
}),
);
}
@@ -52,23 +41,19 @@ export class ComponentLogService extends GenericService {
return this._getComponentLogDataAsXML(dossierId, fileId).pipe(
tap(data => {
const blob = new Blob([data], { type: 'application/xml' });
- saveAs(blob, name + '.rss.xml');
+ saveAs(blob, name + '.component_log.xml');
}),
);
}
private _getComponentLogDataAsXML(dossierId: string, fileId: string) {
- const queryParams: QueryParam[] = [];
- queryParams.push({ key: 'fileId', value: fileId });
-
- const entityPath = [dossierId].map(item => encodeURIComponent(item)).join('/');
+ const entityPath = [dossierId, fileId].map(item => encodeURIComponent(item)).join('/');
let headers = new HttpHeaders();
headers = headers.set('accept', 'application/xml');
- return this._http.get(`/${this._serviceName}/${encodeURI('rss')}/${entityPath}`, {
+ return this._http.get(`/${this._serviceName}/${encodeURI('componentLog')}/${entityPath}`, {
headers: headers,
- params: this._queryParams(queryParams),
responseType: 'text',
observe: 'body',
});
diff --git a/apps/red-ui/src/assets/i18n/redact/de.json b/apps/red-ui/src/assets/i18n/redact/de.json
index 6737f6df7..9a9499e91 100644
--- a/apps/red-ui/src/assets/i18n/redact/de.json
+++ b/apps/red-ui/src/assets/i18n/redact/de.json
@@ -569,7 +569,7 @@
"save": "Save",
"undo": "Undo"
},
- "annotations": "{type} found on {pageCount, plural, one{page} other{pages}} {pages} by rule #{ruleNumber}",
+ "annotations": "{type} found on page {page} by rule #{ruleNumber}",
"table-header": {
"annotation-references": "Annotation references",
"component": "Component",
diff --git a/apps/red-ui/src/assets/i18n/redact/en.json b/apps/red-ui/src/assets/i18n/redact/en.json
index ef362c9b9..50a0fc214 100644
--- a/apps/red-ui/src/assets/i18n/redact/en.json
+++ b/apps/red-ui/src/assets/i18n/redact/en.json
@@ -569,7 +569,7 @@
"save": "Save",
"undo": "Undo to: {value}"
},
- "annotations": "{type} found on {pageCount, plural, one{page} other{pages}} {pages} by rule #{ruleNumber}",
+ "annotations": "{type} found on page {page} by rule #{ruleNumber}",
"table-header": {
"annotation-references": "Annotation references",
"component": "Component",
diff --git a/apps/red-ui/src/assets/i18n/scm/de.json b/apps/red-ui/src/assets/i18n/scm/de.json
index c87dcb87c..b152a4888 100644
--- a/apps/red-ui/src/assets/i18n/scm/de.json
+++ b/apps/red-ui/src/assets/i18n/scm/de.json
@@ -569,7 +569,7 @@
"save": "Save",
"undo": "Undo"
},
- "annotations": "{type} found on {pageCount, plural, one{page} other{pages}} {pages} by rule #{ruleNumber}",
+ "annotations": "{type} found on page {page} by rule #{ruleNumber}",
"table-header": {
"annotation-references": "Annotation references",
"component": "Component",
diff --git a/apps/red-ui/src/assets/i18n/scm/en.json b/apps/red-ui/src/assets/i18n/scm/en.json
index bbaa90dea..4b80faf0f 100644
--- a/apps/red-ui/src/assets/i18n/scm/en.json
+++ b/apps/red-ui/src/assets/i18n/scm/en.json
@@ -569,7 +569,7 @@
"save": "Save",
"undo": "Undo to: {value}"
},
- "annotations": "{type} found on {pageCount, plural, one{page} other{pages}} {pages} by rule #{ruleNumber}",
+ "annotations": "{type} found on page {page} by rule #{ruleNumber}",
"table-header": {
"annotation-references": "Annotation references",
"component": "Component",
diff --git a/libs/red-domain/src/lib/component-log/component-value.ts b/libs/red-domain/src/lib/component-log/component-value.ts
index ec01a2957..efad62032 100644
--- a/libs/red-domain/src/lib/component-log/component-value.ts
+++ b/libs/red-domain/src/lib/component-log/component-value.ts
@@ -8,6 +8,7 @@ export interface ComponentLogEntityReference {
export interface IComponentValue {
readonly value: string;
readonly originalValue: string;
+ readonly valueDescription: string;
readonly componentRuleId: string;
readonly componentLogEntityReferences: ComponentLogEntityReference[];
}
@@ -15,12 +16,14 @@ export interface IComponentValue {
export class ComponentValue implements IComponentValue {
readonly value: string;
readonly originalValue: string;
+ readonly valueDescription: string;
readonly componentRuleId: string;
readonly componentLogEntityReferences: ComponentLogEntityReference[];
constructor(value: IComponentValue) {
this.value = value.value;
this.originalValue = value.originalValue;
+ this.valueDescription = value.valueDescription;
this.componentRuleId = value.componentRuleId;
this.componentLogEntityReferences = value.componentLogEntityReferences ?? [];
}