From 804ce69df96f95829f3c72ac06f36261b3a34f39 Mon Sep 17 00:00:00 2001 From: genja Date: Tue, 3 Nov 2026 15:55:44 +0100 Subject: [PATCH] fixed the expanded/collapsed bug for orgminer content, where no orgminer content was shown after a chart node was clicked --- .../modules/hierarchy/hierarchy.component.ts | 19 +- .../orgminer-content.component.html | 473 +++++++++--------- .../orgminer-content.component.scss | 16 + .../orgminer-content.component.ts | 11 +- 4 files changed, 283 insertions(+), 236 deletions(-) diff --git a/webapp/src/app/modules/hierarchy/hierarchy.component.ts b/webapp/src/app/modules/hierarchy/hierarchy.component.ts index f13daeb1..2f39b3a7 100644 --- a/webapp/src/app/modules/hierarchy/hierarchy.component.ts +++ b/webapp/src/app/modules/hierarchy/hierarchy.component.ts @@ -88,27 +88,34 @@ export class HierarchyComponent implements OnInit { } onHierarchyExpandedChange(expanded: boolean): void { + if (this.hierarchyExpanded() === expanded) return; this.hierarchyExpanded.set(expanded); this.syncPanelState({ [HIERARCHY_PANEL_PARAM]: expanded }); } onOrganizationExpandedChange(expanded: boolean): void { + if (this.organizationExpanded() === expanded) return; this.organizationExpanded.set(expanded); this.syncPanelState({ [ORGANIZATION_PANEL_PARAM]: expanded }); } onClassifiedPagesExpandedChange(expanded: boolean): void { + if (this.classifiedPagesExpanded() === expanded) return; 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); - void this.router.navigate([], { + async analyzeOrg(org: { name: string; url: string }): Promise { + const organizationUrl = org.url.trim(); + if (!organizationUrl) return; + + // No local signal.set() here: the queryParamMap subscription applies the state. + // Setting hierarchyExpanded directly made the expansion panel emit + // expandedChange, which started a second navigation without the org params. + const navigated = await this.router.navigate([], { relativeTo: this.route, queryParams: { - [ORGANIZATION_URL_PARAM]: org.url, + [ORGANIZATION_URL_PARAM]: organizationUrl, [ORGANIZATION_NAME_PARAM]: org.name, [ORGMINER_EXPANDED_PARAM]: null, [ORGMINER_SELECTION_CATEGORY_PARAM]: null, @@ -121,6 +128,7 @@ export class HierarchyComponent implements OnInit { queryParamsHandling: 'merge', replaceUrl: true, }); + if (!navigated) console.warn('[Hierarchy] navigation was cancelled'); } private syncPanelState(queryParams: Record): void { @@ -128,6 +136,7 @@ export class HierarchyComponent implements OnInit { relativeTo: this.route, queryParams, queryParamsHandling: 'merge', + replaceUrl: true, }); } diff --git a/webapp/src/app/modules/hierarchy/orgminer-content/orgminer-content.component.html b/webapp/src/app/modules/hierarchy/orgminer-content/orgminer-content.component.html index 9c3cfc15..a39f7582 100644 --- a/webapp/src/app/modules/hierarchy/orgminer-content/orgminer-content.component.html +++ b/webapp/src/app/modules/hierarchy/orgminer-content/orgminer-content.component.html @@ -1,247 +1,262 @@ -
- - - - -
- @if (!selection()) { -
-

Wählen Sie links ein Element aus, um Details anzuzeigen.

-
- } - - - @if (selectedStaff(); as staff) { -
-

{{ staff.name }}

- -
- @if (staff.email) { -
- E-Mail - {{ - staff.email - }} -
- } - @if (staff.telefon) { -
- Telefon - {{ - staff.telefon - }} -
- } - @if (staff.links?.length) { -
- Links - - } - @if (researchInterests(staff).length) { -
- Forschungsinteressen -
- @for (ri of researchInterests(staff); track ri) { - {{ ri }} - } + } +
+ + +
+ } + + + @if (selectedProject(); as project) { +
+
+

{{ project.title }}

+ @if (project.project_type) { + + {{ project.project_type }} + + } +
+ +
+ @if (project.topic) { +
+ Thema + {{ project.topic }}
-
- } -
- - -
- } - - - @if (selectedProject(); as project) { -
-
-

{{ project.title }}

- @if (project.project_type) { - - {{ project.project_type }} - - } -
- -
- @if (project.topic) { -
- Thema - {{ project.topic }} -
- } - @if (project.names) { -
- Verantwortlich - {{ project.names }} -
- } - @if (project.links?.length) { -
- Links - - } -
- -
- } - - - @if (selectedNews(); as news) { -
-

{{ news.title }}

- -
- @if (news.date) { -
- Datum - {{ news.date }} -
- } - @if (news.topic) { -
- Thema - {{ news.topic }} -
- } - @if (news.links?.length) { -
- Links - - } + } +
+
+ } - -
- } -
-
+ + @if (selectedNews(); as news) { +
+

{{ news.title }}

+ +
+ @if (news.date) { +
+ Datum + {{ news.date }} +
+ } + @if (news.topic) { +
+ Thema + {{ news.topic }} +
+ } + @if (news.links?.length) { +
+ Links + +
+ } +
+ + +
+ } + + +} diff --git a/webapp/src/app/modules/hierarchy/orgminer-content/orgminer-content.component.scss b/webapp/src/app/modules/hierarchy/orgminer-content/orgminer-content.component.scss index 4c5c98af..3671e393 100644 --- a/webapp/src/app/modules/hierarchy/orgminer-content/orgminer-content.component.scss +++ b/webapp/src/app/modules/hierarchy/orgminer-content/orgminer-content.component.scss @@ -1,3 +1,19 @@ +.orgminer-state { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + gap: 12px; + min-height: 320px; + padding: 24px; + border: 1px dashed var(--sg-border); + border-radius: 8px; + background: var(--sg-card-bg); + color: var(--sg-text-muted); + font-size: 0.95rem; + text-align: center; +} + .orgminer { display: flex; width: 100%; 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 d236e8e7..93a1e3bc 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 @@ -28,6 +28,7 @@ import { NEWS_ICON, } from '../../../shared/ui/icons'; import { MatTooltip } from '@angular/material/tooltip'; +import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; import { OrgminerService } from '../../../api/api/orgminer.service'; /* ------------------------------ Data model ------------------------------ */ @@ -50,6 +51,7 @@ interface Selection { MatIconModule, ChipComponent, MatTooltip, + MatProgressSpinnerModule, ], templateUrl: './orgminer-content.component.html', styleUrls: ['./orgminer-content.component.scss'], @@ -63,7 +65,11 @@ export class OrgminerContentComponent implements OnInit { private readonly route = inject(ActivatedRoute); private readonly destroyRef = inject(DestroyRef); private isOwnNavigation = false; - readonly data = toSignal( + /** + * `undefined` means the request is still running, `null` means the backend + * knows no orgminer document for this URL. + */ + readonly data = toSignal( toObservable(this.orgUrl).pipe( switchMap((orgUrl) => orgUrl @@ -73,8 +79,9 @@ export class OrgminerContentComponent implements OnInit { : of(null), ), ), - { initialValue: null }, + { initialValue: undefined }, ); + readonly loading = computed(() => this.data() === undefined); private readonly restoreStateEffect = effect(() => { if (this.data()) { this.restoreStateFromUrl();