From de571d47bd2db0c5185d95cf2baf7ed0994a1024 Mon Sep 17 00:00:00 2001 From: louis-19041904 Date: Mon, 1 Jun 2026 00:44:21 +0200 Subject: [PATCH] Connect research timeline to topics by time in backend --- .../research-timeline.component.html | 96 +++---- .../research-timeline.component.scss | 22 +- .../research-timeline.component.ts | 4 +- .../person-overview.component.html | 6 +- .../person-overview.component.ts | 240 ++++++------------ 5 files changed, 154 insertions(+), 214 deletions(-) diff --git a/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.html b/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.html index 5f469cd8..2034bfd4 100644 --- a/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.html +++ b/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.html @@ -19,57 +19,67 @@ - -
-
- +
+ Forschungstimeline wird geladen ... +
-
-
- {{ item.year }} - +
+ Forschungstimeline konnte nicht geladen werden. +
+ + + +
+
+ + +
+
+ {{ item.year }} + +
+
+ +
+
+

{{ getMainTopic(item) }}

+ + + {{ item.publication_count }} + {{ item.publication_count === 1 ? 'Publikation' : 'Publikationen' }} + + +
+ + {{ topic.name }} + {{ topic.count }} + +
+
- -
-
-

{{ getMainTopic(item) }}

- - - {{ item.publication_count }} - {{ item.publication_count === 1 ? 'Publikation' : 'Publikationen' }} - - -
- - {{ topic.name }} - {{ topic.count }} - -
-
-
-
-
- - Die drei häufigsten Topics je Jahr, gezählt über Publikationen. -
+
+ + Die drei häufigsten Topics je Jahr, gezählt über Publikationen. +
+ -
+
Keine Timeline-Daten vorhanden.
diff --git a/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.scss b/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.scss index 4a3d9654..f41b3916 100644 --- a/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.scss +++ b/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.scss @@ -5,6 +5,7 @@ border-radius: 16px; background: #ffffff; box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04); + box-sizing: border-box; } .timeline-header { @@ -19,6 +20,7 @@ color: #07163d; font-size: 20px; font-weight: 700; + line-height: 1.25; } p { @@ -36,6 +38,7 @@ .view-toggle { display: flex; gap: 4px; + flex: 0 0 auto; padding: 4px; border: 1px solid #dbe5f6; border-radius: 10px; @@ -74,6 +77,7 @@ .timeline-wrapper { width: 100%; overflow-x: auto; + overflow-y: hidden; padding: 4px 0 8px; } @@ -285,13 +289,19 @@ background: #52627f; } -.empty-timeline { +.timeline-state { display: flex; - min-height: 120px; + min-height: 140px; align-items: center; justify-content: center; + padding: 20px; color: #68748f; font-size: 14px; + text-align: center; +} + +.timeline-state-error { + color: #b42318; } @media (max-width: 700px) { @@ -302,4 +312,12 @@ .timeline-header { flex-direction: column; } + + .view-toggle { + width: 100%; + + button { + flex: 1; + } + } } \ No newline at end of file diff --git a/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.ts b/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.ts index 665acc45..fa6bd6f3 100644 --- a/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.ts +++ b/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.ts @@ -17,10 +17,12 @@ export interface TopicTimelineElement { standalone: true, imports: [CommonModule], templateUrl: './research-timeline.component.html', - styleUrls: ['./research-timeline.component.scss'], + styleUrl: './research-timeline.component.scss', }) export class ResearchTimelineComponent { @Input() elements: TopicTimelineElement[] = []; + @Input() loading = false; + @Input() loadFailed = false; private readonly colors = ['purple', 'blue', 'green', 'orange', 'pink']; private readonly columnWidth = 240; diff --git a/webapp/src/app/modules/person-overview/person-overview.component.html b/webapp/src/app/modules/person-overview/person-overview.component.html index 8831e155..3f70b27a 100644 --- a/webapp/src/app/modules/person-overview/person-overview.component.html +++ b/webapp/src/app/modules/person-overview/person-overview.component.html @@ -1,3 +1,7 @@
- +
\ No newline at end of file diff --git a/webapp/src/app/modules/person-overview/person-overview.component.ts b/webapp/src/app/modules/person-overview/person-overview.component.ts index 6416bbf3..ff40b5a9 100644 --- a/webapp/src/app/modules/person-overview/person-overview.component.ts +++ b/webapp/src/app/modules/person-overview/person-overview.component.ts @@ -1,178 +1,84 @@ -import { Component } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { HttpClient } from '@angular/common/http'; +import { Component, DestroyRef, OnInit, inject } from '@angular/core'; +import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; +import { ActivatedRoute, ParamMap } from '@angular/router'; +import { combineLatest, distinctUntilChanged, map } from 'rxjs'; + import { ResearchTimelineComponent, TopicTimelineElement, } from './components/research-timeline/research-timeline.component'; +interface TopicTimelineResponse { + elements: TopicTimelineElement[]; + total: number; +} + @Component({ selector: 'app-person-overview', - imports: [ResearchTimelineComponent], + standalone: true, + imports: [CommonModule, ResearchTimelineComponent], templateUrl: './person-overview.component.html', styleUrl: './person-overview.component.scss', }) -export class PersonOverviewComponent { - topicTimelineElements: TopicTimelineElement[] = [ - { - year: 2009, - publication_count: 1, - topics: [ - { name: 'Security and Verification in Computing', count: 1 }, - { name: 'Advanced Malware Detection Techniques', count: 1 }, - { name: 'Cloud Data Security Solutions', count: 1 }, - ], - }, - { - year: 2010, - publication_count: 2, - topics: [ - { name: 'Security and Verification in Computing', count: 2 }, - { name: 'Distributed systems and fault tolerance', count: 2 }, - { name: 'Parallel Computing and Optimization Techniques', count: 1 }, - ], - }, - { - year: 2011, - publication_count: 9, - topics: [ - { name: 'Advanced Malware Detection Techniques', count: 8 }, - { name: 'Security and Verification in Computing', count: 8 }, - { name: 'Digital and Cyber Forensics', count: 3 }, - ], - }, - { - year: 2012, - publication_count: 5, - topics: [ - { name: 'Advanced Malware Detection Techniques', count: 3 }, - { name: 'Security and Verification in Computing', count: 3 }, - { name: 'Network Security and Intrusion Detection', count: 3 }, - ], - }, - { - year: 2013, - publication_count: 6, - topics: [ - { name: 'Security and Verification in Computing', count: 6 }, - { name: 'Advanced Malware Detection Techniques', count: 6 }, - { name: 'Network Security and Intrusion Detection', count: 2 }, - ], - }, - { - year: 2014, - publication_count: 14, - topics: [ - { name: 'Advanced Malware Detection Techniques', count: 9 }, - { name: 'Security and Verification in Computing', count: 8 }, - { name: 'Diamond and Carbon-based Materials Research', count: 3 }, - ], - }, - { - year: 2015, - publication_count: 19, - topics: [ - { name: 'Security and Verification in Computing', count: 19 }, - { name: 'Advanced Malware Detection Techniques', count: 19 }, - { name: 'Diamond and Carbon-based Materials Research', count: 6 }, - ], - }, - { - year: 2016, - publication_count: 23, - topics: [ - { name: 'Security and Verification in Computing', count: 13 }, - { name: 'Advanced Malware Detection Techniques', count: 8 }, - { name: 'Cloud Data Security Solutions', count: 4 }, - ], - }, - { - year: 2017, - publication_count: 7, - topics: [ - { name: 'Security and Verification in Computing', count: 7 }, - { name: 'Advanced Malware Detection Techniques', count: 5 }, - { name: 'Diamond and Carbon-based Materials Research', count: 4 }, - ], - }, - { - year: 2018, - publication_count: 5, - topics: [ - { name: 'Security and Verification in Computing', count: 5 }, - { name: 'Advanced Malware Detection Techniques', count: 4 }, - { name: 'Diamond and Carbon-based Materials Research', count: 2 }, - ], - }, - { - year: 2019, - publication_count: 4, - topics: [ - { name: 'Advanced Malware Detection Techniques', count: 2 }, - { name: 'Security and Verification in Computing', count: 2 }, - { name: 'Blockchain Technology Applications and Security', count: 2 }, - ], - }, - { - year: 2020, - publication_count: 5, - topics: [ - { name: 'Security and Verification in Computing', count: 5 }, - { name: 'Advanced Malware Detection Techniques', count: 4 }, - { name: 'Diamond and Carbon-based Materials Research', count: 2 }, - ], - }, - { - year: 2021, - publication_count: 7, - topics: [ - { name: 'Physical Unclonable Functions (PUFs) and Hardware Security', count: 3 }, - { name: 'Parallel Computing and Optimization Techniques', count: 2 }, - { name: 'Security and Verification in Computing', count: 2 }, - ], - }, - { - year: 2022, - publication_count: 5, - topics: [ - { name: 'Security and Verification in Computing', count: 5 }, - { name: 'Advanced Malware Detection Techniques', count: 5 }, - { name: 'Physical Unclonable Functions (PUFs) and Hardware Security', count: 2 }, - ], - }, - { - year: 2023, - publication_count: 6, - topics: [ - { name: 'Security and Verification in Computing', count: 5 }, - { name: 'Advanced Malware Detection Techniques', count: 5 }, - { name: 'Blockchain Technology Applications and Security', count: 2 }, - ], - }, - { - year: 2024, - publication_count: 6, - topics: [ - { name: 'Security and Verification in Computing', count: 5 }, - { name: 'Advanced Malware Detection Techniques', count: 3 }, - { name: 'User Authentication and Security Systems', count: 2 }, - ], - }, - { - year: 2025, - publication_count: 6, - topics: [ - { name: 'Blockchain Technology Applications and Security', count: 2 }, - { name: 'Radiation Effects in Electronics', count: 1 }, - { name: 'Risk and Safety Analysis', count: 1 }, - ], - }, - { - year: 2026, - publication_count: 6, - topics: [ - { name: 'Advanced Malware Detection Techniques', count: 6 }, - { name: 'Security and Verification in Computing', count: 6 }, - { name: 'Web Application Security Vulnerabilities', count: 2 }, - ], - }, - ]; +export class PersonOverviewComponent implements OnInit { + private readonly route = inject(ActivatedRoute); + private readonly http = inject(HttpClient); + private readonly destroyRef = inject(DestroyRef); + + topicTimelineElements: TopicTimelineElement[] = []; + loadingTimeline = false; + timelineLoadFailed = false; + + ngOnInit(): void { + combineLatest(this.route.pathFromRoot.map((route) => route.paramMap)) + .pipe( + map((paramMaps) => this.findAuthorId(paramMaps)), + distinctUntilChanged(), + takeUntilDestroyed(this.destroyRef), + ) + .subscribe((authorId) => { + this.loadTopicTimeline(authorId); + }); + } + + private findAuthorId(paramMaps: readonly ParamMap[]): string { + return ( + paramMaps + .map((paramMap) => paramMap.get('id')) + .find((id): id is string => Boolean(id)) ?? '' + ); + } + + private loadTopicTimeline(authorId: string): void { + if (!authorId || authorId === '0') { + this.topicTimelineElements = []; + this.loadingTimeline = false; + this.timelineLoadFailed = false; + return; + } + + this.loadingTimeline = true; + this.timelineLoadFailed = false; + + const url = `/inse-service/authors/${encodeURIComponent(authorId)}/topics-by-time`; + + this.http + .get(url) + .pipe(takeUntilDestroyed(this.destroyRef)) + .subscribe({ + next: (response) => { + this.topicTimelineElements = response.elements ?? []; + this.loadingTimeline = false; + this.timelineLoadFailed = false; + }, + error: (error) => { + console.error('Topic timeline could not be loaded.', error); + this.topicTimelineElements = []; + this.loadingTimeline = false; + this.timelineLoadFailed = true; + }, + }); + } } \ No newline at end of file