diff --git a/apps/red-ui/src/app/modules/file-preview/components/editable-structured-component-value/editable-structured-component-value.component.html b/apps/red-ui/src/app/modules/file-preview/components/editable-structured-component-value/editable-structured-component-value.component.html
index 25abd1b20..98be17cc8 100644
--- a/apps/red-ui/src/app/modules/file-preview/components/editable-structured-component-value/editable-structured-component-value.component.html
+++ b/apps/red-ui/src/app/modules/file-preview/components/editable-structured-component-value/editable-structured-component-value.component.html
@@ -46,7 +46,7 @@
f.label === this.entry.name);
+ if (nestedFilter) {
+ this._filtersService.filterCheckboxClicked({ nestedFilter, filterGroup, primaryFiltersSlug: 'primaryFilters' });
+ return;
+ }
+ }
+ }
}
diff --git a/apps/red-ui/src/app/modules/file-preview/components/structured-component-management/structured-component-management.component.html b/apps/red-ui/src/app/modules/file-preview/components/structured-component-management/structured-component-management.component.html
index ce7af1ab5..bb8ee916b 100644
--- a/apps/red-ui/src/app/modules/file-preview/components/structured-component-management/structured-component-management.component.html
+++ b/apps/red-ui/src/app/modules/file-preview/components/structured-component-management/structured-component-management.component.html
@@ -3,7 +3,7 @@
-
+
-
+
;
- readonly componentLogData = signal(undefined);
- readonly openScmDialogByDefault = signal(this.userPreferences.getOpenScmDialogByDefault());
- readonly iconButtonTypes = IconButtonTypes;
+ protected readonly componentLogData = signal(undefined);
+ protected readonly openScmDialogByDefault = signal(this.userPreferences.getOpenScmDialogByDefault());
+ protected readonly iconButtonTypes = IconButtonTypes;
+ protected displayedComponents$: Observable;
constructor(
private readonly _componentLogService: ComponentLogService,
@@ -38,6 +36,24 @@ export class StructuredComponentManagementComponent {
readonly userPreferences: UserPreferenceService,
) {}
+ async ngOnInit(): Promise {
+ await this.#loadData();
+ this.displayedComponents$ = this.#displayedComponents$();
+ }
+
+ #displayedComponents$() {
+ const componentLogData$ = this._componentLogService.getComponentLogData(
+ this.file.dossierTemplateId,
+ this.file.dossierId,
+ this.file.fileId,
+ this.dictionaries,
+ );
+ const componentLogFilters$ = this._filterService.getFilterModels$('componentLogFilters');
+ return combineLatest([componentLogData$, componentLogFilters$]).pipe(
+ map(([components, filters]) => this._componentLogFilterService.filterComponents(components, filters)),
+ );
+ }
+
deselectLast() {
const lastSelected = this.editableComponents.find(c => c.selected);
if (lastSelected) {
@@ -49,10 +65,6 @@ export class StructuredComponentManagementComponent {
return this.file.workflowStatus !== WorkflowFileStatuses.APPROVED;
}
- async ngOnInit(): Promise {
- await this.#loadData();
- }
-
getValueCellId(index: number) {
return `value-cell-${index}`;
}
@@ -102,30 +114,18 @@ export class StructuredComponentManagementComponent {
async #loadData(): Promise {
this._loadingService.start();
const componentLogData = await firstValueFrom(
- this._componentLogService.getComponentLogData(this.file.dossierTemplateId, this.file.dossierId, this.file.fileId),
+ this._componentLogService.getComponentLogData(
+ this.file.dossierTemplateId,
+ this.file.dossierId,
+ this.file.fileId,
+ this.dictionaries,
+ ),
);
this.#computeFilters(componentLogData);
- this.#updateDisplayValue(componentLogData);
this.componentLogData.set(componentLogData);
this._loadingService.stop();
}
- #updateDisplayValue(componentLogs: ComponentLogEntry[]) {
- const dictionaries = this.dictionaries;
- for (const componentLog of componentLogs) {
- let foundDictionary: Dictionary;
- for (const reference of componentLog.componentValues[0].entityReferences) {
- if (foundDictionary) {
- reference.displayValue = foundDictionary.label;
- continue;
- }
- foundDictionary = dictionaries.find(dict => dict.type === reference.type);
- foundDictionary = foundDictionary ?? ({ label: reference.type } as Dictionary);
- reference.displayValue = foundDictionary.label;
- }
- }
- }
-
#computeFilters(componentLogs: ComponentLogEntry[]) {
const filterGroups = this._componentLogFilterService.filterGroups(componentLogs);
this._filterService.addFilterGroups(filterGroups);
diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/docu-mine/revert-value-dialog/revert-value-dialog.component.html b/apps/red-ui/src/app/modules/file-preview/dialogs/docu-mine/revert-value-dialog/revert-value-dialog.component.html
new file mode 100644
index 000000000..51f7d5a57
--- /dev/null
+++ b/apps/red-ui/src/app/modules/file-preview/dialogs/docu-mine/revert-value-dialog/revert-value-dialog.component.html
@@ -0,0 +1,19 @@
+
diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/docu-mine/revert-value-dialog/revert-value-dialog.component.scss b/apps/red-ui/src/app/modules/file-preview/dialogs/docu-mine/revert-value-dialog/revert-value-dialog.component.scss
new file mode 100644
index 000000000..e69de29bb
diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/docu-mine/revert-value-dialog/revert-value-dialog.component.ts b/apps/red-ui/src/app/modules/file-preview/dialogs/docu-mine/revert-value-dialog/revert-value-dialog.component.ts
new file mode 100644
index 000000000..779f7003c
--- /dev/null
+++ b/apps/red-ui/src/app/modules/file-preview/dialogs/docu-mine/revert-value-dialog/revert-value-dialog.component.ts
@@ -0,0 +1,20 @@
+import { Component } from '@angular/core';
+import { CircleButtonComponent, IconButtonComponent, IqserDialogComponent } from '@iqser/common-ui';
+import { MatDialogClose } from '@angular/material/dialog';
+import { TranslateModule } from '@ngx-translate/core';
+
+interface RevertValueData {}
+interface RevertValueResult {}
+
+@Component({
+ templateUrl: 'revert-value-dialog.component.html',
+ styleUrls: ['./revert-value-dialog.component.scss'],
+ standalone: true,
+ imports: [CircleButtonComponent, IconButtonComponent, MatDialogClose, TranslateModule],
+})
+export class RevertValueDialogComponent extends IqserDialogComponent {
+ constructor() {
+ super();
+ }
+ save() {}
+}
diff --git a/apps/red-ui/src/app/modules/file-preview/services/component-log-filter.service.ts b/apps/red-ui/src/app/modules/file-preview/services/component-log-filter.service.ts
index 77360f0a6..85e8fccd5 100644
--- a/apps/red-ui/src/app/modules/file-preview/services/component-log-filter.service.ts
+++ b/apps/red-ui/src/app/modules/file-preview/services/component-log-filter.service.ts
@@ -1,7 +1,6 @@
import { Injectable } from '@angular/core';
import { ComponentLogEntry } from '@red/domain';
-import { NestedFilter } from '@common-ui/filtering';
-import { componentLogChecker } from '@utils/filter-utils';
+import { INestedFilter, NestedFilter } from '@common-ui/filtering';
@Injectable()
export class ComponentLogFilterService {
@@ -22,8 +21,23 @@ export class ComponentLogFilterService {
{
slug: 'componentLogFilters',
filters: componentLogFilters,
- checker: componentLogChecker,
},
];
}
+
+ filterComponents(components: ComponentLogEntry[], filters: INestedFilter[]) {
+ const someFiltersChecked = !!filters.find(f => f.checked);
+ if (!someFiltersChecked) {
+ return components;
+ }
+
+ const checkedFiltersIds = filters.reduce((ids, f) => {
+ if (f.checked) {
+ ids.push(f.id);
+ }
+ return ids;
+ }, []);
+
+ return components.filter(c => checkedFiltersIds.includes(c.name));
+ }
}
diff --git a/apps/red-ui/src/app/modules/shared-dossiers/dialogs/edit-dictionary-dialog/edit-dictionary-dialog.component.ts b/apps/red-ui/src/app/modules/shared-dossiers/dialogs/edit-dictionary-dialog/edit-dictionary-dialog.component.ts
index f5f16cb34..e067c2f5f 100644
--- a/apps/red-ui/src/app/modules/shared-dossiers/dialogs/edit-dictionary-dialog/edit-dictionary-dialog.component.ts
+++ b/apps/red-ui/src/app/modules/shared-dossiers/dialogs/edit-dictionary-dialog/edit-dictionary-dialog.component.ts
@@ -76,6 +76,4 @@ export class EditDictionaryDialogComponent extends IqserDialogComponent {
@@ -34,12 +35,18 @@ export class ComponentLogService extends GenericService {
);
}
- getComponentLogData(dossierTemplateId: string, dossierId: string, fileId: string): Observable {
+ getComponentLogData(
+ dossierTemplateId: string,
+ dossierId: string,
+ fileId: string,
+ dictionaries: Dictionary[],
+ ): Observable {
return this.#componentLogRequest(dossierTemplateId, dossierId, fileId).pipe(
map(data => data.componentDetails),
catchError(() => of({} as ComponentDetails)),
map(componentDetails => this.#mapComponentDetails(componentDetails)),
mapEach(log => new ComponentLogEntry(log)),
+ map(log => this.#updateDisplayValue(log, dictionaries)),
);
}
@@ -91,4 +98,17 @@ export class ComponentLogService extends GenericService {
#mapComponentDetails(componentDetails: ComponentDetails): IComponentLogEntry[] {
return Object.keys(componentDetails).reduce((res, key) => (res.push(componentDetails[key]), res), []);
}
+
+ #updateDisplayValue(componentLogs: ComponentLogEntry[], dictionaries: Dictionary[]): ComponentLogEntry[] {
+ for (const componentLog of componentLogs) {
+ for (const componentValue of componentLog.componentValues) {
+ for (const reference of componentValue.entityReferences) {
+ const foundDictionary =
+ dictionaries.find(dict => dict.type === reference.type) ?? ({ label: reference.type } as Dictionary);
+ reference.displayValue = foundDictionary.label;
+ }
+ }
+ }
+ return componentLogs;
+ }
}
diff --git a/apps/red-ui/src/app/utils/filter-utils.ts b/apps/red-ui/src/app/utils/filter-utils.ts
index 8793b9e0e..c7b1439fd 100644
--- a/apps/red-ui/src/app/utils/filter-utils.ts
+++ b/apps/red-ui/src/app/utils/filter-utils.ts
@@ -84,8 +84,6 @@ export const dossierTemplateChecker = (dw: Dossier, filter: INestedFilter) => dw
export const dossierStateChecker = (dw: Dossier, filter: INestedFilter) =>
dw.dossierStatusId === (filter.id === 'undefined' ? null : filter.id);
-export const componentLogChecker = (componentLogEntry: ComponentLogEntry, filter: INestedFilter) => componentLogEntry.name === filter.id;
-
export const userTypeFilters: { [key in UserType]: (user: User) => boolean } = {
INACTIVE: (user: User) => !user.hasAnyRole,
REGULAR: (user: User) => user.roles.length === 1 && user.roles[0] === 'RED_USER',
diff --git a/apps/red-ui/src/assets/i18n/redact/de.json b/apps/red-ui/src/assets/i18n/redact/de.json
index 09d830a41..0e26ac601 100644
--- a/apps/red-ui/src/assets/i18n/redact/de.json
+++ b/apps/red-ui/src/assets/i18n/redact/de.json
@@ -367,6 +367,7 @@
"annotation": {
"pending": "(Pending analysis)"
},
+ "annotations": "",
"archived-dossiers-listing": {
"no-data": {
"title": "No archived dossiers."
@@ -2182,6 +2183,13 @@
"header": "Resize {type}"
}
},
+ "revert-value-dialog": {
+ "actions": {
+ "cancel": "",
+ "revert": ""
+ },
+ "title": ""
+ },
"roles": {
"inactive": "Inaktiv",
"manager-admin": "Manager & admin",
diff --git a/apps/red-ui/src/assets/i18n/redact/en.json b/apps/red-ui/src/assets/i18n/redact/en.json
index 35fcded6d..e86ebf3a0 100644
--- a/apps/red-ui/src/assets/i18n/redact/en.json
+++ b/apps/red-ui/src/assets/i18n/redact/en.json
@@ -2183,6 +2183,13 @@
"header": "Resize {type}"
}
},
+ "revert-value-dialog": {
+ "actions": {
+ "cancel": "Cancel",
+ "revert": "Revert to original values"
+ },
+ "title": "Revert to the original values?"
+ },
"roles": {
"inactive": "Inactive",
"manager-admin": "Manager & admin",
diff --git a/apps/red-ui/src/assets/i18n/scm/de.json b/apps/red-ui/src/assets/i18n/scm/de.json
index f00a14406..a18f19a8b 100644
--- a/apps/red-ui/src/assets/i18n/scm/de.json
+++ b/apps/red-ui/src/assets/i18n/scm/de.json
@@ -367,6 +367,7 @@
"annotation": {
"pending": "(Pending analysis)"
},
+ "annotations": "",
"archived-dossiers-listing": {
"no-data": {
"title": "No archived dossiers."
@@ -2182,6 +2183,13 @@
"header": "Resize {type}"
}
},
+ "revert-value-dialog": {
+ "actions": {
+ "cancel": "",
+ "revert": ""
+ },
+ "title": ""
+ },
"roles": {
"inactive": "Inaktiv",
"manager-admin": "Manager & admin",
diff --git a/apps/red-ui/src/assets/i18n/scm/en.json b/apps/red-ui/src/assets/i18n/scm/en.json
index 1b110b692..59eef38e6 100644
--- a/apps/red-ui/src/assets/i18n/scm/en.json
+++ b/apps/red-ui/src/assets/i18n/scm/en.json
@@ -2183,6 +2183,13 @@
"header": "Resize {type}"
}
},
+ "revert-value-dialog": {
+ "actions": {
+ "cancel": "Cancel",
+ "revert": "Revert to original values"
+ },
+ "title": "Revert to the original values?"
+ },
"roles": {
"inactive": "Inactive",
"manager-admin": "Manager & admin",
diff --git a/libs/common-ui b/libs/common-ui
index 301ea99ab..0d85f78d9 160000
--- a/libs/common-ui
+++ b/libs/common-ui
@@ -1 +1 @@
-Subproject commit 301ea99abe1be09687cdbe6d0fbae3bec7eefc23
+Subproject commit 0d85f78d9a42e2ef8de387ec3b86e2857a4cc3e9