Connect research timeline to topics by time in backend
LocationBasedServices/smartguide/pipeline/pr-dev This commit looks good

This commit is contained in:
2026-06-01 00:44:21 +02:00
parent 644b111280
commit de571d47bd
5 changed files with 154 additions and 214 deletions
@@ -19,57 +19,67 @@
</div>
</div>
<ng-container *ngIf="timelineItems.length > 0; else emptyTimeline">
<div class="timeline-wrapper">
<div class="timeline-inner" [style.min-width.px]="timelineMinWidth">
<div class="timeline-axis" aria-hidden="true"></div>
<div *ngIf="loading" class="timeline-state">
Forschungstimeline wird geladen ...
</div>
<div class="timeline-points" [style.grid-template-columns]="gridTemplateColumns">
<div
*ngFor="let item of timelineItems; let index = index; trackBy: trackByYear"
class="timeline-point"
[ngClass]="getColorClass(index)"
>
<span class="year">{{ item.year }}</span>
<span class="dot"></span>
<div *ngIf="!loading && loadFailed" class="timeline-state timeline-state-error">
Forschungstimeline konnte nicht geladen werden.
</div>
<ng-container *ngIf="!loading && !loadFailed">
<ng-container *ngIf="timelineItems.length > 0; else emptyTimeline">
<div class="timeline-wrapper">
<div class="timeline-inner" [style.min-width.px]="timelineMinWidth">
<div class="timeline-axis" aria-hidden="true"></div>
<div class="timeline-points" [style.grid-template-columns]="gridTemplateColumns">
<div
*ngFor="let item of timelineItems; let index = index; trackBy: trackByYear"
class="timeline-point"
[ngClass]="getColorClass(index)"
>
<span class="year">{{ item.year }}</span>
<span class="dot"></span>
</div>
</div>
<div class="timeline-content" [style.grid-template-columns]="gridTemplateColumns">
<article
*ngFor="let item of timelineItems; let index = index; trackBy: trackByYear"
class="timeline-item"
>
<h3>{{ getMainTopic(item) }}</h3>
<span class="publication-count">
{{ item.publication_count }}
{{ item.publication_count === 1 ? 'Publikation' : 'Publikationen' }}
</span>
<div class="topic-list">
<span
*ngFor="let topic of getTopTopics(item); trackBy: trackByTopic"
class="topic-chip"
[ngClass]="getColorClass(index)"
>
<span class="topic-name">{{ topic.name }}</span>
<span class="topic-count">{{ topic.count }}</span>
</span>
</div>
</article>
</div>
</div>
<div class="timeline-content" [style.grid-template-columns]="gridTemplateColumns">
<article
*ngFor="let item of timelineItems; let index = index; trackBy: trackByYear"
class="timeline-item"
>
<h3>{{ getMainTopic(item) }}</h3>
<span class="publication-count">
{{ item.publication_count }}
{{ item.publication_count === 1 ? 'Publikation' : 'Publikationen' }}
</span>
<div class="topic-list">
<span
*ngFor="let topic of getTopTopics(item); trackBy: trackByTopic"
class="topic-chip"
[ngClass]="getColorClass(index)"
>
<span class="topic-name">{{ topic.name }}</span>
<span class="topic-count">{{ topic.count }}</span>
</span>
</div>
</article>
</div>
</div>
</div>
<div class="timeline-note">
<span class="note-dot"></span>
<span>Die drei häufigsten Topics je Jahr, gezählt über Publikationen.</span>
</div>
<div class="timeline-note">
<span class="note-dot"></span>
<span>Die drei häufigsten Topics je Jahr, gezählt über Publikationen.</span>
</div>
</ng-container>
</ng-container>
<ng-template #emptyTimeline>
<div class="empty-timeline">
<div class="timeline-state">
Keine Timeline-Daten vorhanden.
</div>
</ng-template>
@@ -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;
}
}
}
@@ -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;
@@ -1,3 +1,7 @@
<section class="person-overview">
<app-research-timeline [elements]="topicTimelineElements"></app-research-timeline>
<app-research-timeline
[elements]="topicTimelineElements"
[loading]="loadingTimeline"
[loadFailed]="timelineLoadFailed"
></app-research-timeline>
</section>
@@ -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<TopicTimelineResponse>(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;
},
});
}
}