diff --git a/webapp/src/app/modules/hierarchy/hierarchy.component.html b/webapp/src/app/modules/hierarchy/hierarchy.component.html
index 85be628f..589fa2b4 100644
--- a/webapp/src/app/modules/hierarchy/hierarchy.component.html
+++ b/webapp/src/app/modules/hierarchy/hierarchy.component.html
@@ -1 +1,50 @@
-
hierarchy works!
+
+
Organizationsstruktur
+
+
+
+ Hierarchie
+
+
+
+ @if (classifiedBuckets() && orgminerContent() && orgminerContent()?.uri) {
+
+
+ {{ orgName() }}
+
+
+ @if (orgminerContent()) {
+
+ } @else {
+
+ info
+ Keine Organisation ausgewählt.
+
+ }
+
+
+
+
+ Klassifizierte Seiten: {{ totalPagesClassified() }} URLs
+
+
+
+
+ }
+
+
diff --git a/webapp/src/app/modules/hierarchy/hierarchy.component.scss b/webapp/src/app/modules/hierarchy/hierarchy.component.scss
index e69de29b..eb958627 100644
--- a/webapp/src/app/modules/hierarchy/hierarchy.component.scss
+++ b/webapp/src/app/modules/hierarchy/hierarchy.component.scss
@@ -0,0 +1,32 @@
+.content {
+ display: flex;
+ flex-direction: column;
+ gap: 1rem;
+ padding: 1rem;
+}
+
+mat-expansion-panel {
+ border: 1px solid var(--sg-border);
+ border-radius: var(--sg-radius-sm);
+ background: var(--sg-none);
+ box-shadow: none;
+}
+
+mat-expansion-panel-header {
+ padding: 0 16px;
+ min-height: 48px;
+}
+
+mat-panel-title {
+ justify-content: center;
+ font-size: 16px;
+ font-weight: 700;
+}
+
+mat-panel-description {
+ font-size: 14px;
+ color: var(--sg-text-muted);
+}
+app-hierarchy-chart {
+ height: 100%;
+}
diff --git a/webapp/src/app/modules/hierarchy/hierarchy.component.ts b/webapp/src/app/modules/hierarchy/hierarchy.component.ts
index fe78cd45..cfcc6540 100644
--- a/webapp/src/app/modules/hierarchy/hierarchy.component.ts
+++ b/webapp/src/app/modules/hierarchy/hierarchy.component.ts
@@ -1,11 +1,161 @@
-import { Component } from '@angular/core';
+import {
+ Component,
+ computed,
+ DestroyRef,
+ inject,
+ input,
+ OnInit,
+ signal,
+} from '@angular/core';
+import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
+import { ActivatedRoute, Router } from '@angular/router';
+import { HierarchyChartComponent } from './hierarchy-chart/hierarchy-chart.component';
+import { OrgminerService } from '../../api/api/orgminer.service';
+import { OrgminerContentComponent } from './orgminer-content/orgminer-content.component';
+import { OrgminerContent } from '../../api/model/orgminerContent';
+import { ClassifiedPagesComponent } from './classified-pages/classified-pages.component';
+import { CategoryBucket } from '../../api/model/categoryBucket';
+import { MatExpansionModule } from '@angular/material/expansion';
+import { MatIconModule } from '@angular/material/icon';
+const ORGANIZATION_URL_PARAM = 'orgUrl';
+const ORGANIZATION_NAME_PARAM = 'orgName';
+const ORGMINER_EXPANDED_PARAM = 'orgExpanded';
+const ORGMINER_SELECTION_CATEGORY_PARAM = 'orgSelectionCategory';
+const ORGMINER_SELECTION_INDEX_PARAM = 'orgSelectionIndex';
+const CLASSIFIED_CATEGORY_PARAM = 'classifiedCategory';
+const CLASSIFIED_PAGE_PARAM = 'classifiedPage';
+const HIERARCHY_PANEL_PARAM = 'hierarchyExpanded';
+const ORGANIZATION_PANEL_PARAM = 'organizationExpanded';
+const CLASSIFIED_PAGES_PANEL_PARAM = 'classifiedPagesExpanded';
@Component({
selector: 'app-hierarchy',
- imports: [],
+ imports: [
+ HierarchyChartComponent,
+ OrgminerContentComponent,
+ ClassifiedPagesComponent,
+ MatExpansionModule,
+ MatIconModule,
+ ],
templateUrl: './hierarchy.component.html',
styleUrl: './hierarchy.component.scss',
})
-export class HierarchyComponent {
+export class HierarchyComponent implements OnInit {
+ hierarchyData = input.required();
+ hierarchyExpanded = signal(true);
+ organizationExpanded = signal(true);
+ classifiedPagesExpanded = signal(false);
+ orgminerContent = signal(null);
+ orgName = signal(null);
+ classifiedBuckets = signal(null);
+ orgminerService = inject(OrgminerService);
+ private readonly router = inject(Router);
+ private readonly route = inject(ActivatedRoute);
+ private readonly destroyRef = inject(DestroyRef);
+ private isOwnNavigation = false;
+ totalPagesClassified = computed(
+ () => this.classifiedBuckets()?.reduce((sum, b) => sum + b.count, 0) ?? 0,
+ );
+ ngOnInit(): void {
+ this.route.queryParamMap
+ .pipe(takeUntilDestroyed(this.destroyRef))
+ .subscribe((params) => {
+ if (this.isOwnNavigation) {
+ this.isOwnNavigation = false;
+ return;
+ }
+ const organizationUrl = params.get(ORGANIZATION_URL_PARAM);
+ this.hierarchyExpanded.set(
+ this.readBooleanParam(params.get(HIERARCHY_PANEL_PARAM), true),
+ );
+ this.organizationExpanded.set(
+ this.readBooleanParam(params.get(ORGANIZATION_PANEL_PARAM), true),
+ );
+ this.classifiedPagesExpanded.set(
+ this.readBooleanParam(
+ params.get(CLASSIFIED_PAGES_PANEL_PARAM),
+ false,
+ ),
+ );
+ if (organizationUrl) {
+ this.loadOrganization({
+ name: params.get(ORGANIZATION_NAME_PARAM) ?? 'Organisation',
+ url: organizationUrl,
+ });
+ }
+ });
+ }
+
+ onHierarchyExpandedChange(expanded: boolean): void {
+ this.hierarchyExpanded.set(expanded);
+ this.syncPanelState({ [HIERARCHY_PANEL_PARAM]: expanded });
+ }
+
+ onOrganizationExpandedChange(expanded: boolean): void {
+ this.organizationExpanded.set(expanded);
+ this.syncPanelState({ [ORGANIZATION_PANEL_PARAM]: expanded });
+ }
+
+ onClassifiedPagesExpandedChange(expanded: boolean): void {
+ this.classifiedPagesExpanded.set(expanded);
+ this.syncPanelState({ [CLASSIFIED_PAGES_PANEL_PARAM]: expanded });
+ }
+
+ analyzeOrg(org: { name: string; url: string }) {
+ this.hierarchyExpanded.set(false);
+ this.organizationExpanded.set(true);
+ this.isOwnNavigation = true;
+ this.router
+ .navigate([], {
+ relativeTo: this.route,
+ queryParams: {
+ [ORGANIZATION_URL_PARAM]: org.url,
+ [ORGANIZATION_NAME_PARAM]: org.name,
+ [ORGMINER_EXPANDED_PARAM]: null,
+ [ORGMINER_SELECTION_CATEGORY_PARAM]: null,
+ [ORGMINER_SELECTION_INDEX_PARAM]: null,
+ [CLASSIFIED_CATEGORY_PARAM]: null,
+ [CLASSIFIED_PAGE_PARAM]: null,
+ [HIERARCHY_PANEL_PARAM]: false,
+ [ORGANIZATION_PANEL_PARAM]: true,
+ },
+ queryParamsHandling: 'merge',
+ replaceUrl: true,
+ })
+ .then((navigated) => {
+ if (!navigated) this.isOwnNavigation = false;
+ });
+ this.loadOrganization(org);
+ }
+
+ private syncPanelState(queryParams: Record): void {
+ this.isOwnNavigation = true;
+ this.router
+ .navigate([], {
+ relativeTo: this.route,
+ queryParams,
+ queryParamsHandling: 'merge',
+ replaceUrl: true,
+ })
+ .then((navigated) => {
+ if (!navigated) this.isOwnNavigation = false;
+ });
+ }
+
+ private readBooleanParam(value: string | null, fallback: boolean): boolean {
+ return value === null ? fallback : value === 'true';
+ }
+
+ private loadOrganization(org: { name: string; url: string }) {
+ console.log('Analyze organization event triggered', org.url);
+ this.orgName.set(org.name);
+ this.orgminerService.getOrgminerContent(org.url).subscribe((data) => {
+ console.log('Orgminer content:', data);
+ this.orgminerContent.set(data);
+ });
+ this.orgminerService.getClassifiedPagesAggs(org.url).subscribe((data) => {
+ this.classifiedBuckets.set(data);
+ });
+ }
}