Merge branch 'dev' of https://project.nes.uni-due.de/gitea/lbs/smartguide into feature/Keyword_search_rework
LocationBasedServices/smartguide/pipeline/head This commit looks good
LocationBasedServices/smartguide/pipeline/pr-dev This commit looks good

This commit is contained in:
Kazgatari
2026-07-19 20:27:45 +02:00
57 changed files with 56971 additions and 1952 deletions
@@ -159,7 +159,6 @@
</mat-button-toggle>
</mat-button-toggle-group>
</div>
<div class="toolbar-divider"></div>
</div>
<div class="spacer toolbar-controls manual-input-controls">
@@ -964,6 +964,7 @@ export class KeywordsSearchComponent {
const view = queryParams.get('view') ?? 'llm';
const legend = queryParams.get('legend') ?? 'on';
const legendExpanded = queryParams.get('legendExpanded') ?? 'off';
const fuzzy = queryParams.get('fuzzy') === 'true';
this.isRestoringState = true;
this.form.patchValue(
{
@@ -977,6 +978,7 @@ export class KeywordsSearchComponent {
this.subfieldLegendVisible.set(legend === 'on');
this.subfieldLegendExpanded.set(legendExpanded === 'on');
this.extractionSource.set(source as InputMode);
this.topicMappingSearch.set(fuzzy);
this.restoreStateFromSession();
const merged = this.uniqueKeywordEntries([
@@ -1,5 +1,6 @@
import { Injectable, computed, signal } from '@angular/core';
import { KeywordEntryWithTopic } from '../../../api/model/keywordEntryWithTopic';
import { Topic } from '../../../api';
export type KeywordPatentLevel = 'broad' | 'coarse' | 'fine' | 'custom';
@@ -36,6 +37,32 @@ export class SearchResultsStateService {
});
readonly keywords = computed(() => this._payload()?.keywords ?? []);
readonly topics = computed(() => {
const entries = this.selectedKeywordEntries();
const seen = new Set<string>();
const topics: Topic[] = [];
for (const entry of entries) {
const topic = entry.topic_mapping?.topic;
if (topic?.id && !seen.has(topic.id)) {
seen.add(topic.id);
topics.push(topic);
}
}
return topics;
});
readonly topicIds = computed(() => {
const entries = this.selectedKeywordEntries();
const ids = new Set<string>();
for (const entry of entries) {
const topicId = entry.topic_mapping?.topic?.id;
if (topicId) {
ids.add(topicId);
}
}
return Array.from(ids);
});
readonly fuzzySearch = computed(
() => this._payload()?.options.fuzzy ?? false,
);
@@ -46,21 +73,26 @@ export class SearchResultsStateService {
() => this._payload()?.manualKeywords ?? [],
);
// Compute unified list of KeywordEntryWithTopic matching selected keywords
// Compute unified list of KeywordEntryWithTopic matching selected keywords.
// Manual keywords intentionally take precedence over extracted ones when
// both normalize to the same keyword.
readonly selectedKeywordEntries = computed(() => {
const payload = this._payload();
if (!payload) return [];
const allEntries = [
...(payload.extractedKeywords ?? []),
...(payload.manualKeywords ?? []),
];
const entryByKeyword = new Map<string, KeywordEntryWithTopic>();
for (const entry of allEntries) {
const kw = entry.llm_keyword?.keyword;
for (const entry of payload.extractedKeywords ?? []) {
const kw = entry.llm_keyword?.keyword?.trim().toLowerCase();
if (kw && !entryByKeyword.has(kw)) {
entryByKeyword.set(kw, entry);
}
}
for (const entry of payload.manualKeywords ?? []) {
const kw = entry.llm_keyword?.keyword?.trim().toLowerCase();
if (kw) {
entryByKeyword.set(kw.trim().toLowerCase(), entry);
entryByKeyword.set(kw, entry);
}
}
@@ -78,7 +110,7 @@ export class SearchResultsStateService {
return result;
});
// Keywords that did not resolve to a mapped topic entry
// Keywords that did not resolve to a mapped topic entry.
readonly missingKeywordLabels = computed(() => {
const payload = this._payload();
if (!payload) return [];
@@ -86,7 +118,7 @@ export class SearchResultsStateService {
const entryKeywordSet = new Set(
this.selectedKeywordEntries()
.map((entry) => entry.llm_keyword?.keyword?.trim().toLowerCase())
.filter(Boolean),
.filter((kw): kw is string => !!kw),
);
return payload.keywords.filter(
@@ -94,8 +126,11 @@ export class SearchResultsStateService {
);
});
// Compute parallel keywords and topic names for trend dashboard strategies
readonly keywordsList = computed(() => this.keywords());
readonly keywordsList = this.keywords;
// Parallel topic-name list for trend dashboard strategies. Entries
// without a resolvable keyword are skipped when building the lookup map
// so they can never collide on an `undefined` key and shadow a real one.
readonly topicsList = computed(() => {
const list = this.keywords().map((kw) => {
const entry = this.selectedKeywordEntries().find(
@@ -23,7 +23,7 @@
<mat-slide-toggle
labelPosition="before"
(change)="onToggleFuzzySearch($event)"
[checked]="fuzzySearch()"
[checked]="state.fuzzySearch()"
matTooltip="Wenn aktiviert, werden die extrahierten Keywords auf bekannte Themenbereiche abgebildet, was die Suchergebnisse vermehrt">
Fuzzy Search
</mat-slide-toggle>
@@ -68,6 +68,7 @@
[queryParams]="{
keywords: state.payload()?.keywords?.join(','),
fuzzy: state.payload()?.options?.fuzzy,
topics: state.payload()?.options?.fuzzy ? state.topicIds() : null,
}">
<mat-icon>{{ route.icon }}</mat-icon>
{{ route.label }}
@@ -63,56 +63,19 @@ export class KeywordsSearchResultsComponent {
];
readonly selectedKeywordCount = computed(() => this.state.keywords().length);
readonly fuzzySearch = signal<boolean>(false);
readonly selectedKeywordEntries = computed(() => {
const payload = this.state.payload();
if (!payload) return [];
const allEntries = [
...(payload.extractedKeywords ?? []),
...(payload.manualKeywords ?? []),
];
const entryByKeyword = new Map<string, KeywordEntryWithTopic>();
for (const entry of allEntries) {
entryByKeyword.set(
this.normalizeKeyword(this.getKeywordLabel(entry)),
entry,
);
}
const result: KeywordEntryWithTopic[] = [];
readonly allKeywordEntries = computed(() => {
const seen = new Set<string>();
for (const keyword of payload.keywords) {
const normalized = this.normalizeKeyword(keyword);
const entry = entryByKeyword.get(normalized);
if (!entry || seen.has(normalized)) continue;
seen.add(normalized);
result.push(entry);
}
return result;
const all = [
...this.state.extractedKeywords(),
...this.state.manualKeywords(),
];
return all.filter((entry) => {
const kw = entry.llm_keyword?.keyword?.trim().toLowerCase();
if (!kw || seen.has(kw)) return false;
seen.add(kw);
return true;
});
});
readonly missingKeywordLabels = computed(() => {
const payload = this.state.payload();
if (!payload) return [];
const entryKeywordSet = new Set(
this.selectedKeywordEntries().map((entry) =>
this.normalizeKeyword(this.getKeywordLabel(entry)),
),
);
return payload.keywords.filter(
(keyword) => !entryKeywordSet.has(this.normalizeKeyword(keyword)),
);
});
constructor() {
// Query params are authoritative (URL survives reload, deep links,
// browser back/forward). sessionStorage is a best-effort cache for the
@@ -136,11 +99,8 @@ export class KeywordsSearchResultsComponent {
? cached!.patentKeywordEntries
: undefined,
});
this.fuzzySearch.set(fuzzySearch);
});
}
goBackToSearch(): void {
void this.router.navigate(['/keywords'], {
queryParamsHandling: 'merge',
@@ -148,7 +108,7 @@ export class KeywordsSearchResultsComponent {
}
getChipLabel(keyword: KeywordEntryWithTopic): string {
if (!this.fuzzySearch()) {
if (!this.state.fuzzySearch()) {
return keyword.llm_keyword?.keyword ?? '';
}
return (
@@ -226,9 +186,9 @@ export class KeywordsSearchResultsComponent {
}
private sameKeywordSet(a: string[], b: string[]): boolean {
if (a.length !== b.length) return false;
const setA = new Set(a.map((k) => this.normalizeKeyword(k)));
return b.every((k) => setA.has(this.normalizeKeyword(k)));
const setA = new Set(a.map(this.normalizeKeyword.bind(this)));
const setB = new Set(b.map(this.normalizeKeyword.bind(this)));
return setA.size === setB.size && [...setA].every((k) => setB.has(k));
}
private parseKeywordList(raw: string | null): string[] {
@@ -251,12 +211,18 @@ export class KeywordsSearchResultsComponent {
return value.trim().toLowerCase();
}
onToggleFuzzySearch(event: any): void {
this.fuzzySearch.set(event.checked);
this.updateQueryParams(event.checked);
}
updateQueryParams(fuzzy: boolean): void {
console.log('Updating query params with keywords:', fuzzy);
const queryParams = {
fuzzy: fuzzy,
topics: fuzzy ? this.state.topicIds() : null,
};
this.router.navigate([], {
relativeTo: this.route,
queryParams: {
fuzzy: this.fuzzySearch(),
},
queryParams,
queryParamsHandling: 'merge',
replaceUrl: true,
});
@@ -1,31 +1,22 @@
<div class="result-layout">
<mat-card class="results-card">
<mat-card-content class="results-placeholder">
<mat-icon>groups</mat-icon>
<h2>Publikationsliste</h2>
<p>
Die aktuelle Gewichtung ist unter <code>normalized</code> verfügbar.
</p>
</mat-card-content>
</mat-card>
<div class="content">
<app-publication-filter
[selectedTopicsPage]="selectedTopicsPage()"
[selectedInstitutionsPage]="selectedInstitutionsPage()"
[selectedAuthorsPage]="selectedAuthorsPage()"
[showTopicFilter]="fuzzySearch()" />
<mat-card class="weights-card">
<mat-card-content>
<app-weights-sliders
[options]="weightOptions"
[initialWeights]="defaultWeights"
title="Publikations-Gewichtung"
description="Werte zwischen 0 und 1. Summe wird normalisiert zu 1."
resetLabel="Ausgewogen"
applyLabel="Neu gewichten"
normalizedTitle="Normalisiert"
queryParamPrefix="workW_"
[persistInQueryParams]="true"
[showApplyButton]="true"
[showResetButton]="true"
[showNormalizedPreview]="true"
(weightsChange)="onWeightsChange($event)"
(applyWeights)="onApplyWeights($event)" />
</mat-card-content>
</mat-card>
@if (loading()) {
<app-loading [icon]="'article'" />
} @else {
<app-publication-table
[page]="works()"
[authorFilterEnabled]="true"
[institutionFilterEnabled]="true"
[topicFilterEnabled]="fuzzySearch()" />
}
<app-query-param-paginator
[total]="total()"
queryParamPageKey="page"
queryParamSizeKey="size" />
</div>
@@ -1,29 +1,84 @@
/* ============================================================
RESULT LAYOUT
============================================================ */
.result-layout {
display: grid;
grid-template-columns: minmax(300px, 420px) 1fr;
grid-template-areas: 'summary results';
.page {
display: flex;
flex-direction: column;
gap: 1rem;
}
.publication-filter-stack {
width: 100%;
}
.publication-filters {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 0.75rem;
align-items: start;
mat-form-field {
min-width: 180px;
}
.institution-filter {
min-width: 260px;
flex: 1 1 260px;
}
}
.search-summary-card {
grid-area: summary;
.filter-prefix-icon {
margin-right: 0.25rem;
color: rgba(0, 0, 0, 0.54);
}
.results-card {
grid-area: results;
.select-search {
display: flex;
align-items: center;
gap: 0.5rem;
padding: 0.5rem 0.75rem;
border-bottom: 1px solid rgba(0, 0, 0, 0.12);
&__icon {
color: rgba(0, 0, 0, 0.54);
}
&__input {
flex: 1;
border: none;
outline: none;
font: inherit;
background: transparent;
}
&__empty {
padding: 0.5rem 0.75rem;
color: rgba(0, 0, 0, 0.54);
font-size: 0.875rem;
}
}
.reset-filter-btn {
display: flex;
align-items: center;
gap: 0.25rem;
height: 40px;
}
.result-layout {
display: flex;
flex-direction: column;
gap: 1rem;
}
.search-summary-card,
.results-card {
background: var(--sg-surface, #ffffff);
border: 1px solid var(--sg-divider, rgba(0, 0, 0, 0.12));
box-shadow: none;
.mat-mdc-card-content {
padding: 0.75rem;
}
width: 100%;
}
.results-placeholder {
display: flex;
flex-direction: column;
align-items: center;
gap: 0.5rem;
}
@@ -1,111 +1,219 @@
import { Component, inject, signal } from '@angular/core';
import {
Component,
DestroyRef,
OnInit,
inject,
signal,
computed,
input,
} from '@angular/core';
import { ActivatedRoute, ParamMap, Router } from '@angular/router';
import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';
import { MatCardModule } from '@angular/material/card';
import { MatIconModule } from '@angular/material/icon';
import { MatButtonModule } from '@angular/material/button';
import { workQueryParamKeys } from '../../../../resolvers/work-page.resolver';
import { PublicationFilterComponent } from '../../../../shared/ui/publication-filters/publication-filters.component';
import { catchError, finalize, of, switchMap } from 'rxjs';
import { PublicationTableComponent } from '../../../../shared/ui/publication-table/publication-table.component';
import { LoadingComponent } from '../../../../shared/ui/loading/loading.component';
import { WorkPageV2 } from '../../../../api/model/workPageV2';
import { PaginationService } from '../../../../shared/services/pagination.service';
import { QueryParamPaginatorComponent } from '../../../../shared/ui/query-param-paginator/query-param-paginator.component';
import {
WeightMap,
WeightSliderOption,
WeightsSlidersComponent,
WeightsSlidersValue,
} from '../../../../shared/ui/weights-sliders/weights-sliders.component';
Author,
AuthorPage,
Institution,
InstitutionPageV2,
Topic,
TopicPageV2,
WorkTopic,
} from '../../../../api';
import { SortDirection, WorkSortBy, WorksV2Service } from '../../../../api';
import { SearchResultsStateService } from '../search-results-state.service';
const EMPTY_WORK_PAGE: WorkPageV2 = {
elements: [],
total: 0,
page: 0,
size: 10,
};
@Component({
selector: 'app-works-results',
imports: [MatCardModule, MatIconModule, WeightsSlidersComponent],
imports: [
MatCardModule,
MatIconModule,
MatButtonModule,
LoadingComponent,
PublicationTableComponent,
PublicationFilterComponent,
QueryParamPaginatorComponent,
],
templateUrl: './works-results.component.html',
styleUrl: './works-results.component.scss',
})
export class KeywordsToWorksResultsComponent {
// injects the state set by the parent route — no duplicate parsing here
export class KeywordsToWorksResultsComponent implements OnInit {
private readonly state = inject(SearchResultsStateService);
private readonly route = inject(ActivatedRoute);
private readonly router = inject(Router);
private readonly worksService = inject(WorksV2Service);
private readonly destroyRef = inject(DestroyRef);
public readonly paginationService = inject(PaginationService);
readonly defaultWeights: WeightMap = {
param1: 0.33,
param2: 0.33,
param3: 0.34,
};
loading = signal<boolean>(false);
readonly weightOptions: WeightSliderOption[] = [
{
key: 'param1',
label: 'Parameter 1',
icon: 'workspace_premium',
description: 'Gewichtet Parameter 1.',
defaultValue: 0.5,
queryParamName: 'wParam1',
},
{
key: 'param2',
label: 'Parameter 2',
icon: 'workspace_premium',
description: 'Gewichtet Parameter 2.',
defaultValue: 0.5,
queryParamName: 'wParam2',
},
{
key: 'param3',
label: 'Parameter 3',
icon: 'workspace_premium',
description: 'Gewichtet Parameter 3.',
defaultValue: 0.5,
queryParamName: 'wParam3',
},
];
private readonly yearParamKey = workQueryParamKeys.years;
private readonly typeParamKey = workQueryParamKeys.types;
private readonly languageParamKey = workQueryParamKeys.language;
private readonly institutionParamKey = workQueryParamKeys.institutionId;
private readonly authorParamKey = workQueryParamKeys.authorId;
private readonly topicParamKey = workQueryParamKeys.topicId;
private readonly pageParamKey = workQueryParamKeys.page;
readonly currentWeights = signal<WeightsSlidersValue>({
raw: this.defaultWeights,
normalized: {
param1: 0.33,
param2: 0.33,
param3: 0.34,
},
rawSum: 2.5,
normalizedSum: 1,
valid: true,
queryParamMap = toSignal(this.route.queryParamMap, {
initialValue: this.route.snapshot.queryParamMap,
});
readonly works = signal<unknown[]>([]); // placeholder until the results service lands
selectedInstitutionIdsQueryParams = computed(() =>
this.queryParamMap().getAll(this.institutionParamKey),
);
selectedAuthorIdsQueryParams = computed(() =>
this.queryParamMap().getAll(this.authorParamKey),
);
private hasLoadedInitial = false;
selectedTopicIdsQueryParams = computed(() =>
this.queryParamMap().getAll(this.topicParamKey),
);
onWeightsChange(value: WeightsSlidersValue): void {
this.currentWeights.set(value);
total = computed(() => this.works()?.total ?? 0);
totalElements = computed(() => this.works()?.total ?? 0);
elements = computed(() => this.works()?.elements ?? []);
fuzzySearch = computed(() => this.queryParamMap().get('fuzzy') === 'true');
// fires once with the query-param-aware initial state — use it to load
if (!this.hasLoadedInitial) {
this.hasLoadedInitial = true;
this.loadworks();
readonly works = toSignal(
this.route.queryParamMap.pipe(
switchMap((params) => this.fetchWorks(params)),
takeUntilDestroyed(this.destroyRef),
),
{ initialValue: EMPTY_WORK_PAGE },
);
private readonly institutionsFromWorks = computed(() => {
const map = new Map<string, Institution>();
for (const work of this.works().elements ?? []) {
for (const authorship of work.authorships ?? []) {
for (const institution of authorship.institutions ?? []) {
if (institution.id) map.set(institution.id, institution);
}
}
}
return map;
});
private readonly authorsFromWorks = computed(() => {
const map = new Map<string, Author>();
for (const work of this.works().elements ?? []) {
for (const authorship of work.authorships ?? []) {
const author = authorship.author;
if (author?.id) map.set(author.id, author);
}
}
return map;
});
private readonly topicsFromWorks = computed(() => {
const map = new Map<string, WorkTopic>();
for (const work of this.works().elements ?? []) {
for (const topic of work.topics ?? []) {
if (topic.id) map.set(topic.id, topic);
}
}
return map;
});
selectedAuthors = computed<Author[]>(() => {
const byId = this.authorsFromWorks();
return this.selectedAuthorIdsQueryParams()
.map((id) => byId.get(id))
.filter((author): author is Author => !!author);
});
selectedInstitutionsPage = input.required<InstitutionPageV2>();
selectedTopicsPage = input.required<TopicPageV2>();
selectedAuthorsPage = input.required<AuthorPage>();
ngOnInit(): void {}
private fetchWorks(params: ParamMap) {
this.loading.set(true);
// Base search topics — derived from the keyword→topic mapping.
// This remains the actual search criterion.
const baseTopicIds = this.state
.selectedKeywordEntries()
.map((entry) => entry.topic_mapping?.topic?.id)
.filter((id): id is string => !!id);
const keywords = this.state.keywords();
if (baseTopicIds.length === 0 && keywords.length === 0) {
this.loading.set(false);
return of(EMPTY_WORK_PAGE);
}
const title = params.get('title') ?? undefined;
const filterTopicIds = params.getAll(this.topicParamKey);
const page = Number(params.get(this.pageParamKey)) || 0;
const size = Number(params.get('size')) || 10;
const publicationYears = params
.getAll(this.yearParamKey)
.map(Number)
.filter((year) => !Number.isNaN(year));
const publicationTypes = params.getAll(this.typeParamKey);
const publicationLanguages = params.getAll(this.languageParamKey);
const institutionIds = params.getAll(this.institutionParamKey);
const authorIds = params.getAll(this.authorParamKey);
const fuzzy = params.get('fuzzy') === 'true';
const sortBy = (params.get('sort_by') ?? 'publication_year') as WorkSortBy;
const sortDirection = (params.get('sort_direction') ??
'desc') as SortDirection;
return this.worksService
.getWorksByKeywords(
[],
baseTopicIds,
filterTopicIds,
keywords,
fuzzy,
publicationYears,
publicationTypes,
institutionIds,
authorIds,
publicationLanguages,
title,
page,
size,
sortBy,
sortDirection,
)
.pipe(
catchError((err) => {
console.error(err);
return of(EMPTY_WORK_PAGE);
}),
finalize(() => this.loading.set(false)),
);
}
onApplyWeights(value: WeightsSlidersValue): void {
this.currentWeights.set(value);
this.loadworks();
}
private loadworks(): void {
const weights = this.currentWeights();
const requestPayload = {
manualKeywords: this.state.manualKeywords(),
extractedKeywords: this.state.extractedKeywords(),
keywords: this.state.keywords(),
fuzzy: this.state.fuzzySearch(),
weights: {
raw: weights.raw,
normalized: weights.normalized,
clearFilters(): void {
this.router.navigate([], {
queryParams: {
keywords: this.state.keywordsList().join(','),
topicId: this.state.topicIds(),
fuzzy: this.state.fuzzySearch(),
page: 0,
size: 10,
sort_by: 'publication_year',
sort_direction: 'desc',
},
};
console.log(requestPayload);
/**
* TODO:
* this.worksService.searchworks(requestPayload).subscribe({
* next: results => this.works.set(results),
* error: error => console.error(error),
* });
*/
});
}
}
@@ -66,10 +66,8 @@ export class PatentDetailComponent implements OnInit {
this.route.snapshot.queryParamMap.get('title') ?? undefined;
const prefix =
this.route.snapshot.queryParamMap.get('prefix') ?? undefined;
const fillingDate =
this.route.snapshot.queryParamMap.get('fillingDate') ?? undefined;
this.loadPatent(patentId, title, prefix, fillingDate);
this.loadPatent(patentId, title, prefix);
});
}
@@ -133,19 +131,14 @@ export class PatentDetailComponent implements OnInit {
return getDescriptionPreview(text);
}
private loadPatent(
patentId: string,
title?: string,
prefix?: string,
fillingDate?: string,
): void {
private loadPatent(patentId: string, title?: string, prefix?: string): void {
this.loading = true;
this.notFound = false;
this.patent = null;
this.expandedClassificationKeys.clear();
this.patentsService
.getPatentByIdOrTitle(patentId, prefix, title, fillingDate)
.getPatentByIdOrTitle(patentId, prefix, title)
.pipe(finalize(() => (this.loading = false)))
.subscribe({
next: (patent: PatentEntry) => {
@@ -5,78 +5,26 @@
</div>
<mat-card appearance="outlined">
<mat-card-content>
<app-query-param-input label="Suche nach Titel" queryParamKey="search" />
<mat-tab-group>
<mat-tab-group
[selectedIndex]="selectedTabIndex()"
(selectedIndexChange)="onTabChange($event)">
<mat-tab label="DFG">
<app-data-table
[columns]="dfgProjectColumns"
[data]="dfgProjectData"
[detailTemplate]="dfgProjectDetailRowTmp"
queryParamSortKey="sort_by"
queryParamSortDirectionKey="sort_direction" />
<app-project-filters
[selectedInstitutions]="selectedDfgInstitutions()"
[showAuthorFilter]="true"
[showInstitutionFilter]="true" />
<app-dfg-project-table
[page]="dfgProjectPage()"
[authorFilterEnabled]="true"
[institutionFilterEnabled]="true" />
</mat-tab>
<mat-tab label="EU">
<app-data-table
[columns]="personCordisEuProjectColumns"
[data]="personCordisEuProjectData"
queryParamSortKey="sort_by"
queryParamSortDirectionKey="sort_direction" />
<app-project-filters
[selectedInstitutions]="selectedEuInstitutions()"
[selectedAuthors]="selectedEuAuthors()" />
<app-eu-project-table [page]="personCordisEuProjectPage()" />
</mat-tab>
</mat-tab-group>
<app-query-param-paginator
[total]="this.pageTotal()"
[pageSizeOptions]="[10]" />
</mat-card-content>
</mat-card>
</div>
<ng-template #dfgProjectActionsTmp let-element>
<a
[routerLink]="['/projects/dfg', element.id]"
target="_blank"
mat-icon-button
color="primary">
<mat-icon>open_in_new</mat-icon>
</a>
</ng-template>
<ng-template #dfgProjectFundingEndTmp let-element>
{{ element.funding_end == '2999' ? 'laufend' : element.funding_end }}
</ng-template>
<ng-template #dfgProjectDetailRowTmp let-element>
<div class="detail-row">
<ul>
@for (
name of element.names.sort((a, b) => a.localeCompare(b));
track $index
) {
<li>
{{ name }}
</li>
}
</ul>
</div>
</ng-template>
<ng-template #euProjectsFundingStartTmp let-element>
{{ element.startDate | date: 'dd.MM.yyyy' }}
</ng-template>
<ng-template #euProjectsFundingEndTmp let-element>
{{ element.endDate | date: 'dd.MM.yyyy' }}
</ng-template>
<ng-template #euProjectsFundingAmountTmp let-element>
{{ element.ecMaxContribution | currency: 'EUR' : 'symbol' : '1.0-0' : 'de' }}
</ng-template>
<ng-template #euProjectsActionsTmp let-element>
<a
[routerLink]="['/projects/eu', element.id]"
target="_blank"
mat-icon-button
color="primary">
<mat-icon>open_in_new</mat-icon>
</a>
</ng-template>
@@ -1,160 +1,65 @@
import { Component, computed, input } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { toSignal } from '@angular/core/rxjs-interop';
import {
Component,
computed,
effect,
input,
OnInit,
TemplateRef,
viewChild,
} from '@angular/core';
import {
CordisEuProject,
CordisEuProjectPage,
DfgProjectPage,
DfgProjectSummary,
Author,
Institution,
} from '../../api';
import {
DataTableComponent,
GenericColumn,
} from '../../shared/ui/data-table/data-table.component';
import { MatIconModule } from '@angular/material/icon';
import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card';
import { MatTabsModule } from '@angular/material/tabs';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';
import { Router, RouterModule } from '@angular/router';
import { CurrencyPipe, DatePipe } from '@angular/common';
import { QueryParamPaginatorComponent } from '../../shared/ui/query-param-paginator/query-param-paginator.component';
import { QueryParamInputComponent } from '../../shared/ui/query-param-input/query-param-input.component';
import { ProjectFilterComponent } from '../../shared/ui/project-filters/project-filters.component';
import { DfgProjectTableComponent } from '../../shared/ui/dfg-project-table/dfg-project-table.component';
import { EuProjectTableComponent } from '../../shared/ui/eu-project-table/eu-project-table.component';
import { projectQueryParamKeys } from '../../resolvers/dfg-projects.resolver';
import { euProjectQueryParamKeys } from '../../resolvers/person-cordis-eu-project-page.resolver';
const PROJECT_TAB_QUERY_PARAM_KEY = 'project_type';
@Component({
selector: 'app-person-projects',
imports: [
DataTableComponent,
MatIconModule,
MatButtonModule,
MatCardModule,
MatTabsModule,
MatFormFieldModule,
MatInputModule,
RouterModule,
DatePipe,
CurrencyPipe,
QueryParamPaginatorComponent,
QueryParamInputComponent,
ProjectFilterComponent,
DfgProjectTableComponent,
EuProjectTableComponent,
],
templateUrl: './person-projects.component.html',
styleUrl: './person-projects.component.scss',
})
export class PersonProjectsComponent implements OnInit {
export class PersonProjectsComponent {
dfgProjectPage = input.required<DfgProjectPage>();
dfgProjectColumns: GenericColumn<DfgProjectSummary>[] = [];
dfgProjectData: DfgProjectSummary[] = [];
dfgProjectFundingEndTmp = viewChild.required<TemplateRef<any>>(
'dfgProjectFundingEndTmp',
);
dfgProjectActionsTmp = viewChild.required<TemplateRef<any>>(
'dfgProjectActionsTmp',
);
dfgProjectDetailRowTmp = viewChild.required<TemplateRef<any>>(
'dfgProjectDetailRowTmp',
);
personCordisEuProjectPage = input.required<CordisEuProjectPage>();
personCordisEuProjectColumns: GenericColumn<CordisEuProject>[] = [];
personCordisEuProjectData: CordisEuProject[] = [];
euProjectsFundingStartTmp = viewChild.required<TemplateRef<any>>(
'euProjectsFundingStartTmp',
);
euProjectsFundingEndTmp = viewChild.required<TemplateRef<any>>(
'euProjectsFundingEndTmp',
);
euProjectsFundingAmountTmp = viewChild.required<TemplateRef<any>>(
'euProjectsFundingAmountTmp',
);
euProjectsActionsTmp = viewChild.required<TemplateRef<any>>(
'euProjectsActionsTmp',
);
selectedDfgInstitutions = input.required<Institution[]>();
selectedDfgAuthors = input.required<Author[]>();
selectedEuInstitutions = input.required<Institution[]>();
selectedEuAuthors = input.required<Author[]>();
readonly pageTotal = computed(() => {
return this.dfgProjectPage()?.total ?? 0;
readonly dfgQueryParamKeys = projectQueryParamKeys;
readonly euQueryParamKeys = euProjectQueryParamKeys;
constructor(
private readonly router: Router,
private readonly activatedRoute: ActivatedRoute,
) {}
queryParamMap = toSignal(this.activatedRoute.queryParamMap, {
initialValue: this.activatedRoute.snapshot.queryParamMap,
});
constructor(private readonly router: Router) {
effect(() => {
this.dfgProjectData = this.dfgProjectPage().elements || [];
selectedTabIndex = computed(() => {
const type = this.queryParamMap().get(PROJECT_TAB_QUERY_PARAM_KEY);
return type === 'eu' ? 1 : 0;
});
onTabChange(index: number): void {
const type = index === 1 ? 'eu' : 'dfg';
this.router.navigate([], {
queryParams: { [PROJECT_TAB_QUERY_PARAM_KEY]: type },
queryParamsHandling: 'merge',
});
effect(() => {
this.personCordisEuProjectData =
this.personCordisEuProjectPage().elements || [];
});
}
ngOnInit(): void {
this.dfgProjectColumns = [
{ id: 'title', header: 'Titel', type: 'accessor', accessorKey: 'title' },
{
id: 'funding_start',
header: 'Förderbeginn',
type: 'accessor',
accessorKey: 'funding_start',
},
{
id: 'funding_end',
header: 'Förderende',
type: 'accessor',
accessorKey: 'funding_end',
cellTemplate: this.dfgProjectFundingEndTmp(),
},
{
id: 'professional_classification',
header: 'Fachliche Zuordnung',
type: 'accessor',
accessorKey: 'professional_classification',
},
{
id: 'actions',
header: '',
type: 'display',
cellTemplate: this.dfgProjectActionsTmp(),
},
];
this.personCordisEuProjectColumns = [
{
id: 'title',
header: 'Titel',
type: 'accessor',
accessorKey: 'title',
},
{
id: 'startDate',
header: 'Startdatum',
type: 'display',
cellTemplate: this.euProjectsFundingStartTmp(),
},
{
id: 'endDate',
header: 'Enddatum',
type: 'display',
cellTemplate: this.euProjectsFundingEndTmp(),
},
{
id: 'ecMaxContribution',
header: 'Förderbetrag (EU)',
type: 'display',
cellTemplate: this.euProjectsFundingAmountTmp(),
},
{
id: 'actions',
header: '',
type: 'display',
cellTemplate: this.euProjectsActionsTmp(),
},
];
}
}
@@ -11,7 +11,7 @@ import { MatTooltipModule } from '@angular/material/tooltip';
import { Subscription } from 'rxjs';
import { EuProjectData } from '../../../api/model/euProjectData';
import { TopicChipComponent } from '../../../shared/ui/topic-chip/topic-chip.component';
import { OrganizationsTableComponent } from './organizations-table/organizations-table/organizations-table.component';
import { OrganizationsTableComponent } from './organizations-table/organizations-table.component';
import { PublicationsTableComponent } from './publications-table/publications-table.component';
import { PatentsCardsComponent } from './patents-cards/patents-cards.component';
import { DeliverablesCardsComponent } from './deliverables-cards/deliverables-cards.component';
@@ -0,0 +1,109 @@
<div class="organizations-tab">
<mat-card appearance="outlined">
@if (showHeader) {
<div class="section-header">
<mat-icon>business</mat-icon>
<h2>{{ headerTitle }} ({{ getOrgsCount() }})</h2>
</div>
}
<div class="organizations-table-wrapper">
<app-data-table [data]="orgsToDisplay()" [columns]="columns()">
<ng-template #nameTemplate let-org>
<div
class="org-name-cell"
(click)="searchForInstitutionName(org.name || org.shortName || '')">
<span class="org-name-text">
{{ org.name || org.shortName || 'Unbekannte Organisation' }}
</span>
</div>
</ng-template>
<ng-template #roleTemplate let-org>
@if (org.role) {
<span class="role-chip">{{ org.role }}</span>
} @else {
<span class="empty-value">—</span>
}
</ng-template>
<ng-template #cityTemplate let-org>
@if (org.city) {
<span class="country-chip">
{{ org.city }}
@if (org.country) {
<img
alt=""
class="country-flag"
[src]="
'https://flagcdn.io/' +
getSvgByCountryCode(org.country) +
'.svg'
"
height="10" />
}
</span>
} @else {
<span class="empty-value">—</span>
}
</ng-template>
<ng-template #ecContributionTemplate let-org>
@if (
org.ecContribution !== undefined && org.ecContribution !== null
) {
<span class="currency-value">
{{
org.ecContribution | currency: 'EUR' : 'symbol' : '1.0-0' : 'de'
}}
</span>
} @else {
<span class="empty-value">—</span>
}
</ng-template>
<ng-template #activityTypeTemplate let-org>
@if (org.activityType) {
<span class="activity-chip">{{ org.activityType }}</span>
} @else {
<span class="empty-value">—</span>
}
</ng-template>
<ng-template #smeTemplate let-org>
@if (org.sme) {
<span class="sme-badge">SME</span>
} @else {
<span class="empty-value">—</span>
}
</ng-template>
<ng-template #organizationUrlTemplate let-org>
<div class="links-container">
@if (org.organizationURL) {
<a
[href]="org.organizationURL"
target="_blank"
rel="noopener noreferrer"
class="link-button"
matTooltip="Website öffnen"
(click)="$event.stopPropagation()">
<mat-icon class="link-icon">open_in_new</mat-icon>
<span class="link-label">Web</span>
</a>
} @else {
<span class="empty-value">—</span>
}
</div>
</ng-template>
</app-data-table>
<mat-paginator
[length]="orgs.length"
[pageSize]="pageSize()"
(page)="onPageChange($event)"
[pageSizeOptions]="paginationService.options">
</mat-paginator>
</div>
</mat-card>
</div>
@@ -1,10 +1,5 @@
// Organizations
.organizations-tab {
.card {
margin-bottom: 24px;
}
.section-header {
display: flex;
align-items: center;
@@ -0,0 +1,148 @@
import {
Component,
computed,
inject,
Input,
signal,
TemplateRef,
viewChild,
} from '@angular/core';
import { CurrencyPipe } from '@angular/common';
import { Router } from '@angular/router';
import { MatIcon } from '@angular/material/icon';
import { MatCard } from '@angular/material/card';
import { MatTooltipModule } from '@angular/material/tooltip';
import { MatPaginatorModule, PageEvent } from '@angular/material/paginator';
import { PaginationService } from '../../../../shared/services/pagination.service';
import { HEUOrganization } from '../../../../api';
import {
DataTableComponent,
GenericColumn,
} from '../../../../shared/ui/data-table/data-table.component';
@Component({
selector: 'app-organizations-table',
imports: [
MatIcon,
MatCard,
MatTooltipModule,
CurrencyPipe,
DataTableComponent,
MatPaginatorModule,
],
templateUrl: './organizations-table.component.html',
styleUrl: './organizations-table.component.scss',
})
export class OrganizationsTableComponent {
private readonly router = inject(Router);
public paginationService = inject(PaginationService);
@Input() orgs: HEUOrganization[] = [];
@Input() showHeader: boolean = true;
@Input() headerTitle: string = 'Organisationen';
pageIndex = signal(0);
pageSize = signal(10);
orgsToDisplay = computed(() => {
const startIndex = this.pageIndex() * this.pageSize();
return this.orgs.slice(startIndex, startIndex + this.pageSize());
});
nameTemplate = viewChild<TemplateRef<any>>('nameTemplate');
roleTemplate = viewChild<TemplateRef<any>>('roleTemplate');
cityTemplate = viewChild<TemplateRef<any>>('cityTemplate');
ecContributionTemplate = viewChild<TemplateRef<any>>(
'ecContributionTemplate',
);
activityTypeTemplate = viewChild<TemplateRef<any>>('activityTypeTemplate');
smeTemplate = viewChild<TemplateRef<any>>('smeTemplate');
organizationUrlTemplate = viewChild<TemplateRef<any>>(
'organizationUrlTemplate',
);
columns = computed<GenericColumn<HEUOrganization>[]>(() => [
{
id: 'name',
header: 'Name',
type: 'accessor',
accessorKey: 'name',
cellTemplate: this.nameTemplate(),
},
{
id: 'role',
header: 'Rolle',
type: 'accessor',
accessorKey: 'role',
cellTemplate: this.roleTemplate(),
},
{
id: 'city',
header: 'Stadt',
type: 'accessor',
accessorKey: 'city',
cellTemplate: this.cityTemplate(),
},
{
id: 'ecContribution',
header: 'EU-Beitrag',
type: 'accessor',
accessorKey: 'ecContribution',
cellTemplate: this.ecContributionTemplate(),
},
{
id: 'activityType',
header: 'Aktivitätstyp',
type: 'accessor',
accessorKey: 'activityType',
cellTemplate: this.activityTypeTemplate(),
},
{
id: 'sme',
header: 'SME',
type: 'accessor',
accessorKey: 'SME',
cellTemplate: this.smeTemplate(),
},
{
id: 'organizationURL',
header: 'URL',
type: 'accessor',
accessorKey: 'organizationURL',
cellTemplate: this.organizationUrlTemplate(),
},
]);
searchForInstitutionName(institutionName: string): void {
if (!institutionName) {
return;
}
this.router.navigate(['/institutions'], {
queryParams: {
search: institutionName,
},
});
}
onPageChange(event: PageEvent): void {
this.pageIndex.set(event.pageIndex);
this.pageSize.set(event.pageSize);
}
getSvgByCountryCode(code: string | undefined | null): string {
if (!code) {
return '';
}
const codeLower = code.toLowerCase();
if (codeLower === 'uk') {
return 'gb';
}
return codeLower;
}
getOrgsCount(): number {
return this.orgs?.length || 0;
}
}
@@ -1,121 +0,0 @@
<div class="organizations-tab">
<mat-card appearance="outlined">
<div class="section-header">
<mat-icon>business</mat-icon>
<h2>Organisationen ({{ orgs.length || 0 }})</h2>
</div>
<div class="organizations-table-wrapper">
<table mat-table [dataSource]="orgs" class="mat-elevation-z2">
<!-- Name Column -->
<ng-container matColumnDef="name">
<th mat-header-cell *matHeaderCellDef>Name</th>
<td mat-cell *matCellDef="let org">
<div
class="org-name-cell"
(click)="searchForInstitutionName(org.name || '')">
<span class="org-name-text">{{
org.name || org.shortName || 'Unbekannte Organisation'
}}</span>
</div>
</td>
</ng-container>
<!-- Role Column -->
<ng-container matColumnDef="role">
<th mat-header-cell *matHeaderCellDef>Rolle</th>
<td mat-cell *matCellDef="let org">
@if (org.role) {
<span class="role-chip">{{ org.role }}</span>
} @else {
<span class="empty-value">—</span>
}
</td>
</ng-container>
<!-- Country Column -->
<ng-container matColumnDef="country">
<th mat-header-cell *matHeaderCellDef>Stadt</th>
<td mat-cell *matCellDef="let org">
@if (org.city) {
<span class="country-chip">
{{ org.city }}
<img
alt=""
class="country-flag"
[src]="`https://flagcdn.io/${getSvgByCountryCode(org.country)}.svg`"
height="10" />
</span>
} @else {
<span class="empty-value">—</span>
}
</td>
</ng-container>
<!-- EU Contribution Column -->
<ng-container matColumnDef="ecContribution">
<th mat-header-cell *matHeaderCellDef>EU-Beitrag</th>
<td mat-cell *matCellDef="let org">
@if (org.ecContribution) {
<span class="currency-value">{{
org.ecContribution | currency: 'EUR' : 'symbol' : '1.0-0' : 'de'
}}</span>
} @else {
<span class="empty-value">—</span>
}
</td>
</ng-container>
<!-- Activity Type Column -->
<ng-container matColumnDef="activityType">
<th mat-header-cell *matHeaderCellDef>Aktivitätstyp</th>
<td mat-cell *matCellDef="let org">
@if (org.activityType) {
<span class="activity-chip">{{ org.activityType }}</span>
} @else {
<span class="empty-value">—</span>
}
</td>
</ng-container>
<!-- SME Badge Column -->
<ng-container matColumnDef="sme">
<th mat-header-cell *matHeaderCellDef>SME</th>
<td mat-cell *matCellDef="let org">
@if (org.sme) {
<span class="sme-badge">SME</span>
} @else {
<span class="empty-value">—</span>
}
</td>
</ng-container>
<!-- URL Badge Column -->
<ng-container matColumnDef="organizationURL">
<th mat-header-cell *matHeaderCellDef>URL</th>
<td mat-cell *matCellDef="let org">
<div class="links-container">
@if (org.organizationURL) {
<a
[href]="org.organizationURL"
target="_blank"
class="link-button"
matTooltip="Website öffnen">
<mat-icon class="link-icon">open_in_new</mat-icon>
<span class="link-label">Web</span>
</a>
} @else {
<span class="empty-value">—</span>
}
</div>
</td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="organizationDisplayedColumns"></tr>
<tr
mat-row
*matRowDef="let row; columns: organizationDisplayedColumns"></tr>
</table>
</div>
</mat-card>
</div>
@@ -1,49 +0,0 @@
import { Component, inject, Input } from '@angular/core';
import { MatTableModule } from '@angular/material/table';
import { Router } from '@angular/router';
import { MatIcon } from '@angular/material/icon';
import { MatCard } from '@angular/material/card';
import { HEUOrganization } from '../../../../../api';
import { CurrencyPipe } from '@angular/common';
@Component({
selector: 'app-organizations-table',
imports: [MatTableModule, MatIcon, MatCard, CurrencyPipe],
templateUrl: './organizations-table.component.html',
styleUrl: './organizations-table.component.scss',
})
export class OrganizationsTableComponent {
private readonly router = inject(Router);
@Input() orgs!: HEUOrganization[];
@Input() showHeader: boolean = true;
@Input() headerTitle: string = 'Organizationen';
// Displayed columns for the organizations table
organizationDisplayedColumns: string[] = [
'name',
'role',
'country',
'ecContribution',
'activityType',
'sme',
'organizationURL',
];
searchForInstitutionName(institutionName: string): void {
this.router.navigate(['/institutions'], {
queryParams: {
search: institutionName,
},
});
}
getSvgByCountryCode(code: string) {
const codeLower = code.toLowerCase();
if (codeLower === 'uk') {
return 'gb';
}
return codeLower;
}
getOrgsCount(): number {
return this.orgs?.length || 0;
}
}
@@ -6,138 +6,121 @@
<h2>{{ headerTitle }} ({{ getPublicationCount() }})</h2>
</div>
}
<div>
<table mat-table [dataSource]="publications" class="mat-elevation-z2">
<!-- Title Column -->
<ng-container matColumnDef="title">
<th mat-header-cell *matHeaderCellDef>Titel</th>
<td mat-cell *matCellDef="let pub">
<div class="pub-title-cell" (click)="searchForPublication(pub)">
<span class="pub-title-text">
{{ pub.title || 'Kein Titel' }}
</span>
</div>
</td>
</ng-container>
<!-- Authors Column -->
<ng-container matColumnDef="authors">
<th mat-header-cell *matHeaderCellDef>Autoren</th>
<td mat-cell *matCellDef="let pub">
@if (pub.authors) {
@let authorList = parseAuthors(pub.authors);
@if (authorList.length > 0) {
<div class="authors-container">
@for (author of authorList; track author; let last = $last) {
<span class="author-wrapper">
<span
class="author-name"
(click)="
searchForPersonName(author); $event.stopPropagation()
">
{{ author }}
</span>
@if (!last) {
<span class="author-separator">, </span>
}
</span>
<app-data-table [data]="publicationsToDisplay()" [columns]="columns()">
<ng-template #titleTemplate let-pub>
<div class="pub-title-cell" (click)="searchForPublication(pub)">
<span class="pub-title-text">
{{ pub.title || 'Kein Titel' }}
</span>
</div>
</ng-template>
<ng-template #authorsTemplate let-pub>
@if (pub.authors) {
@let authorList = parseAuthors(pub.authors);
@if (authorList.length > 0) {
<div class="authors-container">
@for (author of authorList; track author; let last = $last) {
<span class="author-wrapper">
<span
class="author-name"
(click)="
searchForPersonName(author); $event.stopPropagation()
">
{{ author }}
</span>
@if (!last) {
<span class="author-separator">, </span>
}
</div>
} @else {
<span class="empty-value">—</span>
}
} @else {
<span class="empty-value">—</span>
}
</td>
</ng-container>
<!-- Journal Column -->
<ng-container matColumnDef="journal">
<th mat-header-cell *matHeaderCellDef>Zeitschrift</th>
<td mat-cell *matCellDef="let pub">
@if (pub.journalNumber) {
<span class="journal-chip" [matTooltip]="pub.journalNumber">{{
pub.journalNumber
}}</span>
} @else {
<span class="empty-value">—</span>
}
</td>
</ng-container>
<!-- Year Column -->
<ng-container matColumnDef="year">
<th mat-header-cell *matHeaderCellDef>Jahr</th>
<td mat-cell *matCellDef="let pub">
@if (pub.publishedYear) {
<span class="year-value">{{ pub.publishedYear }}</span>
} @else {
<span class="empty-value">—</span>
}
</td>
</ng-container>
<!-- Publisher Column -->
<ng-container matColumnDef="publisher">
<th mat-header-cell *matHeaderCellDef>Verlag</th>
<td mat-cell *matCellDef="let pub">
@if (pub.publisher) {
<span class="publisher-text">{{ pub.publisher }}</span>
} @else {
<span class="empty-value">—</span>
}
</td>
</ng-container>
<!-- Links Column -->
<ng-container matColumnDef="links">
<th mat-header-cell *matHeaderCellDef>Links</th>
<td mat-cell *matCellDef="let pub">
<div class="links-container">
@if (pub.doi) {
<a
[href]="'https://doi.org/' + pub.doi"
target="_blank"
class="link-button"
matTooltip="DOI öffnen">
<mat-icon class="link-icon">open_in_new</mat-icon>
<span class="link-label">DOI</span>
</a>
}
@if (pub.repositoryUrl) {
<a
[href]="pub.repositoryUrl"
target="_blank"
class="link-button"
matTooltip="Repository öffnen">
<mat-icon class="link-icon">folder_open</mat-icon>
<span class="link-label">Repo</span>
</a>
}
@if (pub.publicationUrl) {
<a
[href]="pub.publicationUrl"
target="_blank"
class="link-button"
matTooltip="Publikation öffnen">
<mat-icon class="link-icon">article</mat-icon>
<span class="link-label">Link</span>
</a>
}
@if (!pub.doi && !pub.repositoryUrl && !pub.publicationUrl) {
<span class="empty-value">—</span>
</span>
}
</div>
</td>
</ng-container>
} @else {
<span class="empty-value">—</span>
}
} @else {
<span class="empty-value">—</span>
}
</ng-template>
<tr mat-header-row *matHeaderRowDef="publicationDisplayedColumns"></tr>
<tr
mat-row
*matRowDef="let row; columns: publicationDisplayedColumns"
class="publication-row"></tr>
</table>
</div>
<ng-template #journalTemplate let-pub>
@if (pub.journalNumber) {
<span class="journal-chip" [matTooltip]="pub.journalNumber">
{{ pub.journalNumber }}
</span>
} @else {
<span class="empty-value">—</span>
}
</ng-template>
<ng-template #yearTemplate let-pub>
@if (pub.publishedYear) {
<span class="year-value">{{ pub.publishedYear }}</span>
} @else {
<span class="empty-value">—</span>
}
</ng-template>
<ng-template #publisherTemplate let-pub>
@if (pub.publisher) {
<span class="publisher-text">{{ pub.publisher }}</span>
} @else {
<span class="empty-value">—</span>
}
</ng-template>
<ng-template #linksTemplate let-pub>
<div class="links-container">
@if (pub.doi) {
<a
[href]="'https://doi.org/' + pub.doi"
target="_blank"
class="link-button doi-link"
matTooltip="DOI öffnen"
(click)="$event.stopPropagation()">
<mat-icon class="link-icon">link</mat-icon>
<span class="link-label">DOI</span>
</a>
}
@if (pub.repositoryUrl) {
<a
[href]="pub.repositoryUrl"
target="_blank"
class="link-button"
matTooltip="Repository öffnen"
(click)="$event.stopPropagation()">
<mat-icon class="link-icon">folder_open</mat-icon>
<span class="link-label">Repo</span>
</a>
}
@if (pub.publicationUrl) {
<a
[href]="pub.publicationUrl"
target="_blank"
class="link-button"
matTooltip="Publikation öffnen"
(click)="$event.stopPropagation()">
<mat-icon class="link-icon">article</mat-icon>
<span class="link-label">Link</span>
</a>
}
@if (!pub.doi && !pub.repositoryUrl && !pub.publicationUrl) {
<span class="empty-value">—</span>
}
</div>
</ng-template>
</app-data-table>
<mat-paginator
[length]="publications.length"
[pageSize]="pageSize()"
(page)="onPageChange($event)"
[pageSizeOptions]="paginationService.options">
</mat-paginator>
</mat-card>
</div>
@@ -77,12 +77,6 @@
text-decoration: underline;
}
.authors-text {
color: #4a5a6a;
font-size: 13px;
color: #1a1a1a;
line-height: 1.4;
}
.author-name:hover {
color: #005a9c;
text-decoration: underline;
@@ -172,13 +166,6 @@
font-size: 12px;
}
.publicationDisplayedColumns {
// Hide less important columns on mobile
.mat-column-publisher {
display: none;
}
}
.journal-chip {
max-width: 120px;
font-size: 11px;
@@ -212,15 +199,6 @@
font-size: 11px;
}
.authors-text {
font-size: 11px;
max-width: 100px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
display: inline-block;
}
.links-container {
gap: 4px;
}
@@ -231,6 +209,3 @@
}
}
}
.deliverable-item {
flex-wrap: wrap;
}
@@ -1,36 +1,112 @@
import { Component, computed, inject, Input } from '@angular/core';
import { MatTableModule } from '@angular/material/table';
import { Router } from '@angular/router';
import {
Component,
computed,
inject,
Input,
viewChild,
signal,
} from '@angular/core';
import { MatIcon } from '@angular/material/icon';
import { MatCard } from '@angular/material/card';
import { MatTooltipModule } from '@angular/material/tooltip';
import { CommonModule } from '@angular/common';
import { HEUPublication } from '../../../../api';
import { Router } from '@angular/router';
import { TemplateRef } from '@angular/core';
import { PaginationService } from '../../../../shared/services/pagination.service';
import { MatPaginatorModule, PageEvent } from '@angular/material/paginator';
import {
DataTableComponent,
GenericColumn,
} from '../../../../shared/ui/data-table/data-table.component';
@Component({
selector: 'app-publications-table',
imports: [CommonModule, MatTableModule, MatIcon, MatCard, MatTooltipModule],
imports: [
CommonModule,
MatIcon,
MatCard,
MatTooltipModule,
DataTableComponent,
MatPaginatorModule,
],
templateUrl: './publications-table.component.html',
styleUrl: './publications-table.component.scss',
})
export class PublicationsTableComponent {
private router = inject(Router);
public paginationService = inject(PaginationService);
@Input() publications: HEUPublication[] = [];
@Input() showHeader: boolean = true;
@Input() headerTitle: string = 'Publikationen';
pageIndex = signal(0);
pageSize = signal(10);
publicationsToDisplay = computed(() => {
const startIndex = this.pageIndex() * this.pageSize();
return this.publications.slice(startIndex, startIndex + this.pageSize());
});
// Templates for custom cell rendering
titleTemplate = viewChild<TemplateRef<any>>('titleTemplate');
authorsTemplate = viewChild<TemplateRef<any>>('authorsTemplate');
journalTemplate = viewChild<TemplateRef<any>>('journalTemplate');
yearTemplate = viewChild<TemplateRef<any>>('yearTemplate');
publisherTemplate = viewChild<TemplateRef<any>>('publisherTemplate');
linksTemplate = viewChild<TemplateRef<any>>('linksTemplate');
// Displayed columns for the publications table
publicationDisplayedColumns: string[] = [
'title',
'authors',
'journal',
'year',
'publisher',
'links',
];
author_names = computed(() => 'keka');
columns = computed<GenericColumn<HEUPublication>[]>(() => [
{
id: 'title',
header: 'Titel',
type: 'accessor',
accessorKey: 'title',
cellTemplate: this.titleTemplate(),
},
{
id: 'authors',
header: 'Autoren',
type: 'display',
cellTemplate: this.authorsTemplate(),
},
{
id: 'journalNumber',
header: 'Zeitschrift',
type: 'accessor',
accessorKey: 'journalNumber',
cellTemplate: this.journalTemplate(),
},
{
id: 'publishedYear',
header: 'Jahr',
type: 'accessor',
accessorKey: 'publishedYear',
cellTemplate: this.yearTemplate(),
},
{
id: 'publisher',
header: 'Verlag',
type: 'accessor',
accessorKey: 'publisher',
cellTemplate: this.publisherTemplate(),
},
{
id: 'links',
header: 'Links',
type: 'display',
cellTemplate: this.linksTemplate(),
},
]);
onPageChange(event: PageEvent): void {
this.pageIndex.set(event.pageIndex);
this.pageSize.set(event.pageSize);
}
/**
* Navigate to publication details
*/
searchForPublication(pub: HEUPublication): void {