diff --git a/webapp/src/app/modules/hierarchy/classified-pages/classified-pages.component.ts b/webapp/src/app/modules/hierarchy/classified-pages/classified-pages.component.ts
index c524dd5c..4faf69cb 100644
--- a/webapp/src/app/modules/hierarchy/classified-pages/classified-pages.component.ts
+++ b/webapp/src/app/modules/hierarchy/classified-pages/classified-pages.component.ts
@@ -83,7 +83,6 @@ const CLASSIFIED_SIZE_PARAM = 'size';
selector: 'app-classified-pages',
standalone: true,
imports: [
- //NgxEchartsDirective,
MatCardModule,
MatIconModule,
MatButtonModule,
@@ -123,9 +122,7 @@ export class ClassifiedPagesComponent implements OnInit {
/* -------------------------------- category stats -------------------------------- */
readonly total = computed(
- () =>
- //this.buckets().reduce((sum, b) => sum + b.count, 0),
- this.pagesResponse().total,
+ () => this.pagesResponse().total,
);
readonly totalClassifiedPages = computed(() =>
this.buckets().reduce((sum, b) => sum + b.count, 0),
diff --git a/webapp/src/app/modules/hierarchy/hierarchy-chart/hierarchy-chart.component.ts b/webapp/src/app/modules/hierarchy/hierarchy-chart/hierarchy-chart.component.ts
index 25bb484e..fdba8e30 100644
--- a/webapp/src/app/modules/hierarchy/hierarchy-chart/hierarchy-chart.component.ts
+++ b/webapp/src/app/modules/hierarchy/hierarchy-chart/hierarchy-chart.component.ts
@@ -59,6 +59,14 @@ const QUERY_PARAM_LANG = 'lang';
const LEAF_ROW_HEIGHT = 22;
const MIN_TREE_HEIGHT = 200;
+/**
+ * Owns chart navigation and hierarchy persistence.
+ *
+ * The page shell supplies resolved hierarchy data. This component builds chart
+ * levels, opens the edit and suggestion dialogs, and handles their results.
+ * Editors work on copies and return data; this component is the only layer
+ * that calls OrgminerService or refreshes the chart.
+ */
@Component({
selector: 'app-hierarchy-chart',
standalone: true,
diff --git a/webapp/src/app/modules/hierarchy/hierarchy-chart/hierarchy-suggestions-dialog/hierarchy-suggestions-dialog.component.ts b/webapp/src/app/modules/hierarchy/hierarchy-chart/hierarchy-suggestions-dialog/hierarchy-suggestions-dialog.component.ts
index 688d389b..cc7b6003 100644
--- a/webapp/src/app/modules/hierarchy/hierarchy-chart/hierarchy-suggestions-dialog/hierarchy-suggestions-dialog.component.ts
+++ b/webapp/src/app/modules/hierarchy/hierarchy-chart/hierarchy-suggestions-dialog/hierarchy-suggestions-dialog.component.ts
@@ -18,6 +18,7 @@ export interface HierarchySuggestionDecision {
action: 'review' | 'reject';
}
+/** Displays suggestion history, read-only for users and actionable for managers. */
@Component({
standalone: true,
imports: [CommonModule, DatePipe, MatDialogModule, MatButtonModule],
diff --git a/webapp/src/app/modules/hierarchy/hierarchy-chart/hierarchy-tree-editor/hierarchy-tree-editor.component.html b/webapp/src/app/modules/hierarchy/hierarchy-chart/hierarchy-tree-editor/hierarchy-tree-editor.component.html
index be9af585..e3bd4650 100644
--- a/webapp/src/app/modules/hierarchy/hierarchy-chart/hierarchy-tree-editor/hierarchy-tree-editor.component.html
+++ b/webapp/src/app/modules/hierarchy/hierarchy-chart/hierarchy-tree-editor/hierarchy-tree-editor.component.html
@@ -22,7 +22,7 @@
- @if (numberOfSuggestions <= 0) {
+ @if (!isManager && numberOfSuggestions <= 0) {
- Speichern
+ {{
+ isSuggestion && isManager
+ ? 'Vorschlag als neue Hierarchie speichern'
+ : isManager
+ ? 'Neue Hierarchie speichern'
+ : 'Vorschlag erstellen'
+ }}
+
+ }
+ @if (isSuggestion) {
+
}
diff --git a/webapp/src/app/modules/hierarchy/hierarchy-chart/hierarchy-tree-editor/hierarchy-tree-editor.component.ts b/webapp/src/app/modules/hierarchy/hierarchy-chart/hierarchy-tree-editor/hierarchy-tree-editor.component.ts
index 76db0b61..a3c51807 100644
--- a/webapp/src/app/modules/hierarchy/hierarchy-chart/hierarchy-tree-editor/hierarchy-tree-editor.component.ts
+++ b/webapp/src/app/modules/hierarchy/hierarchy-chart/hierarchy-tree-editor/hierarchy-tree-editor.component.ts
@@ -17,6 +17,16 @@ import {
import { ChipComponent } from '../../../../shared/ui/chip/chip.component';
import type { RawNode } from '../hierarchy-chart.component';
import type { HierarchyEditorDialogData } from '../hierarchy-edit-dialog/hierarchy-edit-dialog.component';
+
+export interface HierarchyEditorResult {
+ action: 'reject';
+}
+
+/**
+ * Edits a private hierarchy copy and returns a saved tree or reject action.
+ * The add/edit child components emit changes to this editor; persistence stays
+ * in HierarchyChartComponent.
+ */
@Component({
standalone: true,
imports: [
@@ -37,6 +47,9 @@ export class HierarchyTreeEditorComponent {
private readonly originalData: RawNode;
readonly numberOfSuggestions: number;
+ readonly isManager: boolean;
+ readonly isSuggestion: boolean;
+ readonly suggestionStatus: HierarchyEditorDialogData['suggestionStatus'];
readonly expanded = new Set();
@@ -61,11 +74,14 @@ export class HierarchyTreeEditorComponent {
constructor(
private readonly dialogRef: MatDialogRef<
HierarchyTreeEditorComponent,
- RawNode
+ RawNode | HierarchyEditorResult
>,
@Inject(MAT_DIALOG_DATA) data: HierarchyEditorDialogData,
) {
this.numberOfSuggestions = data.numberOfSuggestions;
+ this.isManager = data.isManager;
+ this.isSuggestion = data.isSuggestion ?? false;
+ this.suggestionStatus = data.suggestionStatus;
this.originalData = JSON.parse(JSON.stringify(data.tree));
this.initHierarchy();
}
@@ -75,6 +91,7 @@ export class HierarchyTreeEditorComponent {
private initHierarchy(): void {
this.hierarchy = JSON.parse(JSON.stringify(this.originalData));
this.expanded.clear();
+ this.previousStatus.clear();
}
rollback(): void {
@@ -100,15 +117,6 @@ export class HierarchyTreeEditorComponent {
target.value = 0;
}
target.children.unshift(newOrg);
- // target.value++;
-
- // const targetParent = this.findParent(target.id);
- // if (targetParent?.children) {
- // targetParent.value = targetParent.children.reduce(
- // (acc, child) => (child.children ? acc + child.children.length : acc),
- // 0,
- // );
- // }
}
addAggregator(newAgg: RawNode, target: RawNode): void {
@@ -154,25 +162,6 @@ export class HierarchyTreeEditorComponent {
return this.findParent(id, allChildren);
}
- // For the case we want to affect the sorting of items
- // findItemBefore(item: RawNode): RawNode | undefined {
- // const parent = this.findParent(item.id);
- // if (!parent?.children) return undefined;
- // return parent.children.find(
- // (_, i, all) => all[i + 1] && all[i + 1].id === item.id,
- // );
- // }
-
- // findItemAfter(item: RawNode): RawNode | undefined {
- // const parent = this.findParent(item.id);
- // if (!parent?.children) return undefined;
- // return parent.children.find(
- // (_, i, all) => all[i - 1] && all[i - 1].id === item.id,
- // );
- // }
-
- // in initHierarchy(): this.previousStatus.clear();
-
markAsDeleted(item: RawNode): void {
if (item.modified === 'deleted') return;
this.previousStatus.set(item.id, item.modified);
@@ -217,53 +206,8 @@ export class HierarchyTreeEditorComponent {
const index = parent.children.indexOf(item);
if (index !== -1) {
parent.children.splice(index, 1);
- // if (parent.value !== undefined) {
- // parent.value--;
- // }
}
}
- // For the case we want to affect the sorting of items
- // injectNextTo(item: RawNode, target: RawNode | undefined, after = true): void {
- // if (!target || target === this.hierarchy) return;
-
- // this.detach(item);
-
- // const targetParent = this.findParent(target.id);
- // if (!targetParent?.children) return;
-
- // const index = targetParent.children.indexOf(target);
- // if (index !== -1) {
- // targetParent.children.splice(index + (after ? 1 : 0), 0, item);
- // }
- // }
-
- // appendTo(item: RawNode, target: RawNode | undefined): void {
- // if (!target) return;
-
- // this.detach(item);
-
- // if (!target.children) {
- // target.children = [];
- // }
- // target.children.push(item);
- // }
-
- // move(item: RawNode, direction: 'left' | 'up' | 'right' | 'down'): void {
- // switch (direction) {
- // case 'left':
- // this.injectNextTo(item, this.findParent(item.id));
- // break;
- // case 'up':
- // this.injectNextTo(item, this.findItemBefore(item), false);
- // break;
- // case 'right':
- // this.appendTo(item, this.findItemBefore(item));
- // break;
- // case 'down':
- // this.injectNextTo(item, this.findItemAfter(item));
- // break;
- // }
- // }
/* ----------------------------------- dialog ------------------------------------ */
@@ -271,7 +215,6 @@ export class HierarchyTreeEditorComponent {
const cleaned = this.cleanHierarchy(
JSON.parse(JSON.stringify(this.hierarchy)),
);
- console.log('[HierarchyTreeEditor] cleaned hierarchy to save:', cleaned);
this.dialogRef.close(cleaned);
}
@@ -279,11 +222,16 @@ export class HierarchyTreeEditorComponent {
this.dialogRef.close(undefined);
}
+ rejectSuggestion(): void {
+ if (this.suggestionStatus === 'accepted') return;
+ this.dialogRef.close({ action: 'reject' } as HierarchyEditorResult);
+ }
+
private cleanHierarchy(node: RawNode): RawNode {
const result: RawNode = { ...node };
delete (result as any).id;
- if (result.modified === '') {
- delete result.modified;
+ if (result['modified'] === '') {
+ delete result['modified'];
}
if (result.value !== undefined) {
result.value = result.children?.length ?? 0;
diff --git a/webapp/src/app/modules/hierarchy/orgminer-content/orgminer-content.component.ts b/webapp/src/app/modules/hierarchy/orgminer-content/orgminer-content.component.ts
index 66ef0ad9..d236e8e7 100644
--- a/webapp/src/app/modules/hierarchy/orgminer-content/orgminer-content.component.ts
+++ b/webapp/src/app/modules/hierarchy/orgminer-content/orgminer-content.component.ts
@@ -75,7 +75,6 @@ export class OrgminerContentComponent implements OnInit {
),
{ initialValue: null },
);
- // effect is here to restore the state from the URL when the data is loaded, but only if the data is not null
private readonly restoreStateEffect = effect(() => {
if (this.data()) {
this.restoreStateFromUrl();
@@ -88,7 +87,6 @@ export class OrgminerContentComponent implements OnInit {
return verifiedStaff.map((s) => s.name).filter((n): n is string => !!n);
});
readonly sortedStaff = computed(() => {
- //First, sorts the staff by name, then moves verified staff to the top of the list
const staff = this.data()?.staff ?? [];
const verifiedStaffNames = this.verifiedStaffNames();
return staff