Merge branch 'dev' of https://project.nes.uni-due.de/gitea/lbs/smartguide into feature/Keyword_search_rework
This commit is contained in:
@@ -80,6 +80,8 @@ model/dehydratedAuthor.ts
|
||||
model/dehydratedFunder.ts
|
||||
model/dehydratedInstitution.ts
|
||||
model/dehydratedSource.ts
|
||||
model/dfgInstitutionSummary.ts
|
||||
model/dfgPersonSummary.ts
|
||||
model/dfgProjectDetails.ts
|
||||
model/dfgProjectPage.ts
|
||||
model/dfgProjectSummary.ts
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
export interface DfgInstitutionSummary {
|
||||
id: number;
|
||||
name_de?: string | null;
|
||||
name_en?: string | null;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { DfgInstitutionSummary } from './dfgInstitutionSummary';
|
||||
|
||||
export interface DfgPersonSummary {
|
||||
person_id: number;
|
||||
project_ref_id: number;
|
||||
full_name?: string | null;
|
||||
role_label_en?: string | null;
|
||||
role_label_de?: string | null;
|
||||
root_institution?: DfgInstitutionSummary | null;
|
||||
institution?: DfgInstitutionSummary | null;
|
||||
}
|
||||
@@ -1,27 +1,39 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { DfgInstitutionSummary } from './dfgInstitutionSummary';
|
||||
import { DfgPersonSummary } from './dfgPersonSummary';
|
||||
|
||||
|
||||
export interface DfgProjectSummary {
|
||||
/**
|
||||
* The unique identifier of the DFG project.
|
||||
*/
|
||||
id: string;
|
||||
link?: string | null;
|
||||
title?: string | null;
|
||||
professional_classification?: string | null;
|
||||
funding_start?: string | null;
|
||||
funding_end?: string | null;
|
||||
/**
|
||||
* The names of the researchers involved in the DFG project.
|
||||
*/
|
||||
names?: Array<string>;
|
||||
export interface DfgProjectSummary {
|
||||
/**
|
||||
* The unique identifier of the DFG project.
|
||||
*/
|
||||
id: string;
|
||||
link?: string | null;
|
||||
title?: string | null;
|
||||
professional_classification?: string | null;
|
||||
funding_start?: string | null;
|
||||
funding_end?: string | null;
|
||||
/**
|
||||
* Root institutions associated with the project (e.g. universities or umbrella organizations).
|
||||
*/
|
||||
root_institutions?: Array<DfgInstitutionSummary>;
|
||||
/**
|
||||
* Institutions associated with the project.
|
||||
*/
|
||||
institutions?: Array<DfgInstitutionSummary>;
|
||||
/**
|
||||
* The names of the persons involved in the DFG project.
|
||||
*/
|
||||
names?: Array<string>;
|
||||
/**
|
||||
* The persons involved in the DFG project.
|
||||
*/
|
||||
persons?: Array<DfgPersonSummary>;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,6 +49,8 @@ export * from './dehydratedAuthor';
|
||||
export * from './dehydratedFunder';
|
||||
export * from './dehydratedInstitution';
|
||||
export * from './dehydratedSource';
|
||||
export * from './dfgInstitutionSummary';
|
||||
export * from './dfgPersonSummary';
|
||||
export * from './dfgProjectDetails';
|
||||
export * from './dfgProjectPage';
|
||||
export * from './dfgProjectSummary';
|
||||
|
||||
@@ -34,6 +34,7 @@ import {
|
||||
} from './resolvers/work-page.resolver';
|
||||
import { selectedTopicsResolver } from './resolvers/selected-topics.resolver';
|
||||
import { selectedInstitutionsResolver } from './resolvers/selected-institutions.resolver';
|
||||
import { SearchResultsStateService } from './modules/keywords-search/search-results/search-results-state.service';
|
||||
import { roleGuard } from './shared/guards/role.guard';
|
||||
import { UserRole } from './api';
|
||||
import { personCordisEuProjectPageResolver } from './resolvers/person-cordis-eu-project-page.resolver';
|
||||
@@ -160,12 +161,22 @@ export const routes: Routes = [
|
||||
import('./modules/keywords-search/search-results/search-results.component').then(
|
||||
(mod) => mod.KeywordsSearchResultsComponent,
|
||||
),
|
||||
providers: [SearchResultsStateService],
|
||||
children: [
|
||||
{ path: '', pathMatch: 'full', redirectTo: 'persons' },
|
||||
{ path: 'persons', component: KeywordsToPersonsResultsComponent },
|
||||
{ path: 'projects', component: KeywordsToProjectsResultsComponent },
|
||||
{ path: 'patents', component: KeywordsToPatentsResultsComponent },
|
||||
{ path: 'works', component: KeywordsToWorksResultsComponent },
|
||||
{
|
||||
path: 'works',
|
||||
component: KeywordsToWorksResultsComponent,
|
||||
runGuardsAndResolvers: 'always',
|
||||
resolve: {
|
||||
selectedTopicsPage: selectedTopicsResolver,
|
||||
selectedAuthorsPage: selectedAuthorsResolver,
|
||||
selectedInstitutionsPage: selectedInstitutionsResolver,
|
||||
},
|
||||
},
|
||||
{ path: 'news', component: KeywordsToNewsResultsComponent },
|
||||
{ path: 'trends', component: UniTrendParentComponent },
|
||||
],
|
||||
@@ -369,13 +380,12 @@ export const routes: Routes = [
|
||||
resolve: {
|
||||
dfgProjectPage: dfgProjectsResolver,
|
||||
personCordisEuProjectPage: personCordisEuProjectPageResolver,
|
||||
selectedDfgInstitutions: selectedInstitutionsResolver,
|
||||
selectedDfgAuthors: selectedAuthorsResolver,
|
||||
selectedEuInstitutions: selectedInstitutionsResolver,
|
||||
selectedEuAuthors: selectedAuthorsResolver,
|
||||
},
|
||||
runGuardsAndResolvers: (from, to) => {
|
||||
const keys = ['page', 'size', 'sort_by', 'sort_direction', 'search'];
|
||||
return keys.some(
|
||||
(key) => from.queryParamMap.get(key) !== to.queryParamMap.get(key),
|
||||
);
|
||||
},
|
||||
runGuardsAndResolvers: 'always',
|
||||
},
|
||||
{
|
||||
path: 'publications',
|
||||
@@ -388,7 +398,8 @@ export const routes: Routes = [
|
||||
selectedTopicsPage: selectedTopicsResolver,
|
||||
selectedInstitutionsPage: selectedInstitutionsResolver,
|
||||
authorWorkPage: workPageResolver,
|
||||
authorWorkClassificationMergePage: authorWorkClassificationPageResolver,
|
||||
authorWorkClassificationMergePage:
|
||||
authorWorkClassificationPageResolver,
|
||||
},
|
||||
data: {
|
||||
resolvingFor: RESOLVING_WORK_PAGE_FOR.PERSON,
|
||||
|
||||
@@ -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([
|
||||
|
||||
+48
-13
@@ -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,
|
||||
});
|
||||
|
||||
+20
-29
@@ -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>
|
||||
|
||||
+71
-16
@@ -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;
|
||||
}
|
||||
|
||||
+194
-86
@@ -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';
|
||||
|
||||
+109
@@ -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>
|
||||
-5
@@ -1,10 +1,5 @@
|
||||
// Organizations
|
||||
|
||||
.organizations-tab {
|
||||
.card {
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.section-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
+148
@@ -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;
|
||||
}
|
||||
}
|
||||
-121
@@ -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>
|
||||
-49
@@ -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;
|
||||
}
|
||||
}
|
||||
+111
-128
@@ -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>
|
||||
|
||||
-25
@@ -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;
|
||||
}
|
||||
|
||||
+89
-13
@@ -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 {
|
||||
|
||||
@@ -2,26 +2,60 @@ import { inject } from '@angular/core';
|
||||
import { ResolveFn } from '@angular/router';
|
||||
import { DfgProjectPage, ProjectsService } from '../api';
|
||||
|
||||
export const projectQueryParamKeys = {
|
||||
page: 'page',
|
||||
size: 'size',
|
||||
title: 'title',
|
||||
institutionId: 'institutionId',
|
||||
years: 'years',
|
||||
authorId: 'authorId',
|
||||
topicId: 'topicId',
|
||||
sortBy: 'sort_by',
|
||||
sortDirection: 'sort_direction',
|
||||
} as const;
|
||||
|
||||
export const dfgProjectsResolver: ResolveFn<DfgProjectPage> = (
|
||||
route,
|
||||
state,
|
||||
) => {
|
||||
const page = route.queryParamMap.get('page') ?? '0';
|
||||
const size = route.queryParamMap.get('size') ?? '10';
|
||||
const rawAuthorId = route.parent?.params['id'];
|
||||
if (!rawAuthorId) {
|
||||
throw new Error('Author ID is required to resolve collaboration network');
|
||||
}
|
||||
|
||||
const searchTerm = route.queryParamMap.get('search');
|
||||
const sortBy = route.queryParamMap.get('sort_by') || 'title';
|
||||
const sortDirection = route.queryParamMap.get('sort_direction') || 'asc';
|
||||
const page = Number(route.queryParamMap.get(projectQueryParamKeys.page)) || 0;
|
||||
const size =
|
||||
Number(route.queryParamMap.get(projectQueryParamKeys.size)) || 10;
|
||||
const searchTerm =
|
||||
route.queryParamMap.get(projectQueryParamKeys.title) ?? undefined;
|
||||
const sortBy =
|
||||
route.queryParamMap.get(projectQueryParamKeys.sortBy) || 'title';
|
||||
const sortDirection =
|
||||
route.queryParamMap.get(projectQueryParamKeys.sortDirection) || 'asc';
|
||||
|
||||
// TODO: verify ProjectsService.getDfgProjects accepts institution/author
|
||||
// filters. Wire these in once the service signature supports them.
|
||||
const topics = route.queryParamMap.getAll(projectQueryParamKeys.topicId);
|
||||
|
||||
const years = route.queryParamMap.getAll(projectQueryParamKeys.years);
|
||||
const institutionIds = route.queryParamMap.getAll(
|
||||
projectQueryParamKeys.institutionId,
|
||||
);
|
||||
const authorIds = route.queryParamMap.getAll(projectQueryParamKeys.authorId);
|
||||
console.log(
|
||||
'RESOLVING',
|
||||
authorIds,
|
||||
institutionIds,
|
||||
topics,
|
||||
years,
|
||||
searchTerm,
|
||||
);
|
||||
return inject(ProjectsService).getDfgProjects(
|
||||
rawAuthorId,
|
||||
searchTerm ?? undefined,
|
||||
Number(page),
|
||||
Number(size),
|
||||
authorIds,
|
||||
institutionIds,
|
||||
searchTerm,
|
||||
topics,
|
||||
years,
|
||||
page,
|
||||
size,
|
||||
sortBy,
|
||||
sortDirection,
|
||||
);
|
||||
|
||||
@@ -1,13 +1,50 @@
|
||||
import { inject } from '@angular/core';
|
||||
import { ResolveFn } from '@angular/router';
|
||||
import { CordisEuProjectPage, ProjectsService } from '../api';
|
||||
import { inject } from '@angular/core';
|
||||
|
||||
export const euProjectQueryParamKeys = {
|
||||
page: 'page',
|
||||
size: 'size',
|
||||
title: 'title',
|
||||
institutionId: 'institutionId',
|
||||
authorId: 'authorId',
|
||||
sortBy: 'sort_by',
|
||||
sortDirection: 'sort_direction',
|
||||
} as const;
|
||||
|
||||
export const personCordisEuProjectPageResolver: ResolveFn<
|
||||
CordisEuProjectPage
|
||||
> = (route, state) => {
|
||||
const rawAuthorId = route.parent?.paramMap.get('id') ?? null;
|
||||
if (!rawAuthorId) {
|
||||
throw new Error('Author ID is required to resolve collaboration network');
|
||||
throw new Error('Author ID is required to resolve EU projects.');
|
||||
}
|
||||
return inject(ProjectsService).getEuProjectsForAuthor(rawAuthorId);
|
||||
|
||||
const page =
|
||||
Number(route.queryParamMap.get(euProjectQueryParamKeys.page)) || 0;
|
||||
const size =
|
||||
Number(route.queryParamMap.get(euProjectQueryParamKeys.size)) || 10;
|
||||
const searchTerm =
|
||||
route.queryParamMap.get(euProjectQueryParamKeys.title) ?? undefined;
|
||||
const sortBy =
|
||||
route.queryParamMap.get(euProjectQueryParamKeys.sortBy) || 'title';
|
||||
const sortDirection =
|
||||
route.queryParamMap.get(euProjectQueryParamKeys.sortDirection) || 'asc';
|
||||
|
||||
const institutionIds = route.queryParamMap.getAll(
|
||||
euProjectQueryParamKeys.institutionId,
|
||||
);
|
||||
const authorIds = route.queryParamMap.getAll(
|
||||
euProjectQueryParamKeys.authorId,
|
||||
);
|
||||
return inject(ProjectsService).getEuProjectsForAuthor(
|
||||
rawAuthorId,
|
||||
// searchTerm,
|
||||
// page,
|
||||
// size,
|
||||
// sortBy,
|
||||
// sortDirection,
|
||||
// institutionIds,
|
||||
// authorIds,
|
||||
);
|
||||
};
|
||||
|
||||
@@ -0,0 +1,160 @@
|
||||
<app-data-table
|
||||
[columns]="columns"
|
||||
[data]="elements()"
|
||||
[queryParamSortKey]="queryParamKeys.sortBy"
|
||||
[queryParamSortDirectionKey]="queryParamKeys.sortDirection" />
|
||||
|
||||
<app-query-param-paginator
|
||||
[total]="total()"
|
||||
[queryParamPageKey]="queryParamKeys.page"
|
||||
[queryParamSizeKey]="queryParamKeys.size"
|
||||
[pageSizeOptions]="[10]" />
|
||||
|
||||
<ng-template #fundingEndTmp let-element>
|
||||
{{ element.funding_end == '2999' ? 'laufend' : element.funding_end }}
|
||||
</ng-template>
|
||||
|
||||
<ng-template #actionsTmp 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 #authorsTmp let-project>
|
||||
@let projectAuthors = getProjectAuthors(project);
|
||||
@let isProjectAuthorsExpanded = isProjectPersonsExpanded(project);
|
||||
@let visibleAuthors =
|
||||
isProjectAuthorsExpanded ? projectAuthors : projectAuthors.slice(0, 3);
|
||||
<div class="author-tags" aria-label="Autoren" style="padding: 0.5rem 0">
|
||||
@for (author of visibleAuthors; track author.person_id) {
|
||||
<button
|
||||
type="button"
|
||||
class="publication-institution-tag"
|
||||
[class.active]="isAuthorActive(author.person_id!)"
|
||||
[matTooltip]="getAuthorTooltipText(author)"
|
||||
matTooltipPosition="above"
|
||||
[attr.aria-label]="getAuthorTooltipText(author)"
|
||||
(click)="filterByAuthor(author.person_id!)">
|
||||
<mat-icon class="institution-icon">person</mat-icon>
|
||||
<span class="institution-name">{{ author.full_name }}</span>
|
||||
</button>
|
||||
} @empty {
|
||||
<span class="empty-text">-</span>
|
||||
}
|
||||
@if (projectAuthors.length > 3) {
|
||||
<button
|
||||
type="button"
|
||||
class="publication-institution-more"
|
||||
[attr.aria-expanded]="isProjectAuthorsExpanded"
|
||||
(click)="toggleProjectAuthorsExpansion(project)">
|
||||
{{
|
||||
isProjectAuthorsExpanded
|
||||
? 'weniger'
|
||||
: '+' + (projectAuthors.length - 3)
|
||||
}}
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
<ng-template #institutionsTmp let-project>
|
||||
@let institutions = getProjectInstitutions(project);
|
||||
|
||||
<div
|
||||
class="institution-tags"
|
||||
aria-label="Institutionen"
|
||||
style="padding: 0.5rem 0">
|
||||
@for (
|
||||
institution of isProjectInstitutionsExpanded(project)
|
||||
? institutions
|
||||
: institutions.slice(0, 3);
|
||||
track getProjectInstitutionId(institution)
|
||||
) {
|
||||
<button
|
||||
type="button"
|
||||
class="publication-institution-tag"
|
||||
[class.active]="isInstitutionActive(institution.id!)"
|
||||
[matTooltip]="getInstitutionTooltipText(institution)"
|
||||
matTooltipPosition="above"
|
||||
[attr.aria-label]="getInstitutionTooltipText(institution)"
|
||||
(click)="filterByInstitution(institution)">
|
||||
<mat-icon class="institution-icon">apartment</mat-icon>
|
||||
<span class="institution-name">{{ institution.name_de }}</span>
|
||||
</button>
|
||||
} @empty {
|
||||
<span class="empty-text">-</span>
|
||||
}
|
||||
@if (institutions.length > 3) {
|
||||
<button
|
||||
type="button"
|
||||
class="publication-institution-more"
|
||||
(click)="toggleProjectInstitutionsExpansion(project)">
|
||||
@if (isProjectInstitutionsExpanded(project)) {
|
||||
Weniger anzeigen
|
||||
} @else {
|
||||
+{{ institutions.length - 3 }} weitere
|
||||
}
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</ng-template>
|
||||
<!--
|
||||
<ng-template #institutionsTmp let-work>
|
||||
@let publicationInstitutions = getWorkInstitutions(work);
|
||||
@let institutionsExpanded = isWorkInstitutionsExpanded(work);
|
||||
@let visibleInstitutions =
|
||||
institutionsExpanded
|
||||
? publicationInstitutions
|
||||
: publicationInstitutions.slice(0, 3);
|
||||
<div
|
||||
class="institution-tags"
|
||||
aria-label="Institutionen"
|
||||
style="padding: 0.5rem 0">
|
||||
@for (institution of visibleInstitutions; track institution.id) {
|
||||
<button
|
||||
type="button"
|
||||
class="publication-institution-tag"
|
||||
[class.active]="isInstitutionActive(institution.id!)"
|
||||
[matTooltip]="getInstitutionTooltipText(institution)"
|
||||
matTooltipPosition="above"
|
||||
[attr.aria-label]="getInstitutionTooltipText(institution)"
|
||||
(click)="filterByInstitution(institution)">
|
||||
<mat-icon class="institution-icon">apartment</mat-icon>
|
||||
<span class="institution-name">{{ institution.display_name }}</span>
|
||||
@if (institution.country_code) {
|
||||
<img
|
||||
alt=""
|
||||
class="flag-img"
|
||||
[src]="
|
||||
'https://flagcdn.io/' +
|
||||
institution.country_code.toLowerCase() +
|
||||
'.svg'
|
||||
"
|
||||
height="10" />
|
||||
<span class="country-code">{{
|
||||
institution.country_code.toUpperCase()
|
||||
}}</span>
|
||||
}
|
||||
</button>
|
||||
} @empty {
|
||||
<span class="empty-text">-</span>
|
||||
}
|
||||
@if (publicationInstitutions.length > 3) {
|
||||
<button
|
||||
type="button"
|
||||
class="publication-institution-more"
|
||||
[attr.aria-expanded]="institutionsExpanded"
|
||||
(click)="toggleWorkInstitutionsExpansion(work)">
|
||||
{{
|
||||
institutionsExpanded
|
||||
? 'weniger'
|
||||
: '+' + (publicationInstitutions.length - 3)
|
||||
}}
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</ng-template> -->
|
||||
@@ -0,0 +1,594 @@
|
||||
.page {
|
||||
padding: 28px 32px 42px;
|
||||
max-width: 100%;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.publication-filter-stack {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
padding-top: 10px;
|
||||
padding-bottom: 25px;
|
||||
}
|
||||
|
||||
.publication-filters {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.publication-filters mat-form-field {
|
||||
width: 175px;
|
||||
}
|
||||
|
||||
.publication-filters .institution-filter,
|
||||
.publication-filters .topic-filter {
|
||||
flex: 1 1 200px;
|
||||
width: auto;
|
||||
min-width: 180px;
|
||||
max-width: 320px;
|
||||
}
|
||||
|
||||
.publication-filters .sort-field {
|
||||
width: 235px;
|
||||
}
|
||||
|
||||
.publication-filters .reset-filter-btn {
|
||||
min-width: 132px;
|
||||
height: 42px;
|
||||
padding: 0 14px;
|
||||
border-color: #d9e2f0;
|
||||
border-radius: var(--sg-radius-sm);
|
||||
color: var(--sg-text);
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.publication-filters .reset-filter-btn mat-icon {
|
||||
margin-right: 6px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
::ng-deep .publication-filters .mat-mdc-form-field-subscript-wrapper {
|
||||
display: none;
|
||||
}
|
||||
|
||||
::ng-deep .publication-filters .mat-mdc-text-field-wrapper {
|
||||
height: 42px;
|
||||
background: var(--sg-surface-soft);
|
||||
border: 1px solid var(--sg-border);
|
||||
border-radius: var(--sg-radius-sm);
|
||||
transition:
|
||||
border-color 0.15s,
|
||||
box-shadow 0.15s;
|
||||
}
|
||||
|
||||
::ng-deep .publication-filters .mat-focused .mat-mdc-text-field-wrapper {
|
||||
border-color: var(--sg-primary);
|
||||
box-shadow: 0 0 0 2px var(--sg-primary-soft);
|
||||
}
|
||||
|
||||
::ng-deep .publication-filters .mat-mdc-form-field-flex {
|
||||
height: 100%;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
::ng-deep .publication-filters .mat-mdc-form-field-infix {
|
||||
min-height: 0;
|
||||
padding-top: 0;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
::ng-deep .publication-filters .mdc-notched-outline__leading,
|
||||
::ng-deep .publication-filters .mdc-notched-outline__notch,
|
||||
::ng-deep .publication-filters .mdc-notched-outline__trailing {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.filter-prefix-icon {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
font-size: 18px;
|
||||
color: var(--sg-text-soft);
|
||||
}
|
||||
|
||||
::ng-deep .publication-filters .mat-mdc-form-field-icon-prefix {
|
||||
padding: 0 4px 0 10px;
|
||||
color: var(--sg-text-soft);
|
||||
}
|
||||
|
||||
::ng-deep .publication-filters .mat-mdc-select-value,
|
||||
::ng-deep .publication-filters input.mat-mdc-input-element {
|
||||
color: var(--sg-text);
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
::ng-deep .publication-filters .mat-mdc-select-placeholder,
|
||||
::ng-deep .publication-filters input.mat-mdc-input-element::placeholder {
|
||||
color: var(--sg-text-muted);
|
||||
opacity: 1;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
::ng-deep .publication-filters .mat-mdc-form-field-icon-suffix,
|
||||
::ng-deep .publication-filters .mat-mdc-select-arrow-wrapper {
|
||||
transform: none;
|
||||
}
|
||||
|
||||
.active-filters-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
padding: 8px 16px;
|
||||
border: 1px solid var(--sg-border);
|
||||
border-radius: var(--sg-radius-sm);
|
||||
background: var(--sg-surface);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.active-filters-label {
|
||||
font-weight: 600;
|
||||
color: var(--sg-text-muted);
|
||||
}
|
||||
|
||||
.chips-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.filter-meta-chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 2px 8px;
|
||||
border: 1px solid var(--sg-border-strong);
|
||||
border-radius: 4px;
|
||||
background: var(--sg-surface-soft);
|
||||
color: var(--sg-text);
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.filter-topic-chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
max-width: min(320px, 46vw);
|
||||
padding: 3px 8px;
|
||||
border-radius: 7px;
|
||||
background: color-mix(in srgb, var(--topic-color) 22%, #ffffff);
|
||||
color: color-mix(in srgb, var(--topic-color) 45%, #07163d);
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
box-shadow: inset 0 0 0 1px
|
||||
color-mix(in srgb, var(--topic-color) 45%, transparent);
|
||||
}
|
||||
|
||||
.filter-topic-chip__icon {
|
||||
flex: 0 0 auto;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.active-institution-filter,
|
||||
.active-meta-filter {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.filter-institution-chip,
|
||||
.publication-institution-tag {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 2px 6px;
|
||||
border: 1px solid var(--sg-primary-border, var(--sg-border));
|
||||
border-radius: 4px;
|
||||
background: var(--sg-primary-soft);
|
||||
color: var(--sg-primary);
|
||||
font-size: 10px;
|
||||
font-weight: 600;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.filter-institution-chip {
|
||||
max-width: 340px;
|
||||
}
|
||||
|
||||
.publication-institution-tag {
|
||||
max-width: 100%;
|
||||
margin: 0;
|
||||
font-family: inherit;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
|
||||
&:hover,
|
||||
&:focus-visible {
|
||||
background: var(--sg-primary);
|
||||
color: #fff;
|
||||
border-color: var(--sg-primary);
|
||||
outline: none;
|
||||
box-shadow:
|
||||
0 0 0 2px var(--sg-background),
|
||||
0 0 0 4px var(--sg-primary);
|
||||
}
|
||||
|
||||
&.active {
|
||||
border-color: var(--sg-primary);
|
||||
box-shadow:
|
||||
0 0 0 1px #ffffff,
|
||||
0 0 0 3px var(--sg-primary);
|
||||
}
|
||||
|
||||
&.active:hover,
|
||||
&.active:focus-visible {
|
||||
background: var(--sg-primary);
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.filter-institution-chip .institution-icon,
|
||||
.publication-institution-tag .institution-icon,
|
||||
.filter-meta-chip__icon {
|
||||
flex-shrink: 0;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
margin-right: 4px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.filter-meta-chip__icon {
|
||||
color: var(--sg-text-soft);
|
||||
}
|
||||
|
||||
.filter-institution-chip .institution-name,
|
||||
.publication-institution-tag .institution-name {
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
min-width: 0;
|
||||
white-space: normal;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.filter-institution-chip .flag-img,
|
||||
.publication-institution-tag .flag-img {
|
||||
flex-shrink: 0;
|
||||
margin-left: 6px;
|
||||
border: 1px solid;
|
||||
}
|
||||
|
||||
.filter-institution-chip .country-code,
|
||||
.publication-institution-tag .country-code {
|
||||
flex-shrink: 0;
|
||||
margin-left: 2px;
|
||||
font-size: 9px;
|
||||
}
|
||||
|
||||
.filter-institution-chip .institution-open-icon,
|
||||
.publication-institution-tag .institution-open-icon {
|
||||
flex-shrink: 0;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
margin-left: 5px;
|
||||
font-size: 12px;
|
||||
line-height: 1;
|
||||
cursor: pointer;
|
||||
opacity: 0;
|
||||
transition: opacity 0.15s ease;
|
||||
}
|
||||
|
||||
.filter-institution-chip:hover .institution-open-icon,
|
||||
.publication-institution-tag:hover .institution-open-icon {
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.filter-institution-chip .institution-open-icon:hover,
|
||||
.publication-institution-tag .institution-open-icon:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.filter-meta-chip__label,
|
||||
.filter-topic-chip__label {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.active-institution-filter button,
|
||||
.active-meta-filter button {
|
||||
display: flex;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: var(--sg-text-soft);
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
color: var(--sg-text);
|
||||
}
|
||||
}
|
||||
|
||||
.active-institution-filter button mat-icon,
|
||||
.active-meta-filter button mat-icon {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.table-wrap {
|
||||
position: relative;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
min-width: 1120px;
|
||||
border-collapse: separate;
|
||||
border-spacing: 0 10px;
|
||||
box-shadow: none;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.title {
|
||||
display: inline-block;
|
||||
max-width: 520px;
|
||||
line-height: 1.35;
|
||||
color: var(--sg-text);
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a.title:hover {
|
||||
color: var(--sg-text);
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
table.is-hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.table-status {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 12px;
|
||||
min-height: 240px;
|
||||
padding: 32px;
|
||||
color: var(--sg-text-muted);
|
||||
font-size: 14px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.empty-text {
|
||||
color: rgba(0, 0, 0, 0.54);
|
||||
}
|
||||
|
||||
.cell-filter-pill {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
margin: 0;
|
||||
padding: 3px 10px;
|
||||
border: 1px solid var(--sg-border);
|
||||
border-radius: 999px;
|
||||
background: #fff;
|
||||
color: var(--sg-text);
|
||||
font-family: inherit;
|
||||
font-size: 12px;
|
||||
line-height: 1.2;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
|
||||
&:hover,
|
||||
&:focus-visible {
|
||||
border-color: var(--sg-primary);
|
||||
background: var(--sg-surface-soft);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
&.active {
|
||||
border-color: var(--sg-primary);
|
||||
color: var(--sg-primary);
|
||||
font-weight: 600;
|
||||
box-shadow:
|
||||
0 0 0 1px #ffffff,
|
||||
0 0 0 3px var(--sg-primary);
|
||||
}
|
||||
}
|
||||
|
||||
.type-filter-btn {
|
||||
display: inline-flex;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
border-radius: 7px;
|
||||
background: transparent;
|
||||
cursor: pointer;
|
||||
transition: box-shadow 0.2s ease;
|
||||
|
||||
&:hover,
|
||||
&:focus-visible {
|
||||
outline: none;
|
||||
box-shadow: 0 0 0 1px var(--sg-primary);
|
||||
}
|
||||
|
||||
&.active {
|
||||
box-shadow:
|
||||
0 0 0 1px #ffffff,
|
||||
0 0 0 3px var(--sg-primary);
|
||||
}
|
||||
}
|
||||
|
||||
.topic-chips,
|
||||
.institution-tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.topic-chips {
|
||||
max-width: 320px;
|
||||
}
|
||||
|
||||
.institution-tags {
|
||||
align-items: flex-start;
|
||||
max-width: 280px;
|
||||
}
|
||||
|
||||
.publication-institution-more,
|
||||
.publication-topic-more {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
min-height: 24px;
|
||||
padding: 3px 8px;
|
||||
border: 1px solid var(--sg-border);
|
||||
border-radius: var(--sg-radius-sm);
|
||||
background: #fff;
|
||||
color: var(--sg-text-muted);
|
||||
font-family: inherit;
|
||||
font-size: 11px;
|
||||
line-height: 1.2;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
|
||||
&:hover,
|
||||
&:focus-visible {
|
||||
border-color: var(--sg-primary);
|
||||
color: var(--sg-primary);
|
||||
background: var(--sg-surface-soft);
|
||||
outline: none;
|
||||
}
|
||||
}
|
||||
|
||||
.publication-topic-more {
|
||||
max-width: 180px;
|
||||
}
|
||||
|
||||
::ng-deep .mat-mdc-header-cell {
|
||||
color: var(--sg-text-muted);
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
::ng-deep .mat-mdc-row {
|
||||
height: 86px;
|
||||
}
|
||||
|
||||
::ng-deep .mat-mdc-cell {
|
||||
color: var(--sg-text);
|
||||
border-bottom-color: var(--sg-border);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.table-wrap ::ng-deep {
|
||||
.mat-column-type,
|
||||
.mat-column-year,
|
||||
.mat-column-language,
|
||||
.mat-column-citations,
|
||||
.mat-mdc-header-cell {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.mat-mdc-cell:not(:last-child),
|
||||
.mat-mdc-header-cell:not(:last-child) {
|
||||
border-right: 1px solid var(--sg-border);
|
||||
}
|
||||
|
||||
.mat-column-institutions,
|
||||
.mat-column-topics {
|
||||
overflow: visible;
|
||||
}
|
||||
}
|
||||
|
||||
mat-paginator {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.table-footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
min-height: 66px;
|
||||
padding: 0 22px 0 28px;
|
||||
border: 0;
|
||||
color: var(--sg-text-muted);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
.page {
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.table-footer {
|
||||
align-items: stretch;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.publication-filter-stack {
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.publication-filters {
|
||||
justify-content: stretch;
|
||||
max-width: none;
|
||||
}
|
||||
|
||||
.publication-filters mat-form-field,
|
||||
.publication-filters button {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.publication-filters .institution-filter,
|
||||
.publication-filters .topic-filter {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.active-filters-row {
|
||||
align-self: stretch;
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
mat-panel-description {
|
||||
font-size: 14px;
|
||||
color: var(--sg-text-muted);
|
||||
}
|
||||
// ------------------------
|
||||
|
||||
.author-tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.5rem;
|
||||
align-items: flex-start;
|
||||
max-width: 280px;
|
||||
}
|
||||
@@ -0,0 +1,285 @@
|
||||
import {
|
||||
Component,
|
||||
computed,
|
||||
input,
|
||||
OnInit,
|
||||
TemplateRef,
|
||||
viewChild,
|
||||
inject,
|
||||
} from '@angular/core';
|
||||
import { DfgProjectPage, DfgProjectSummary } from '../../../api';
|
||||
import {
|
||||
DataTableComponent,
|
||||
GenericColumn,
|
||||
} from '../data-table/data-table.component';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { QueryParamPaginatorComponent } from '../query-param-paginator/query-param-paginator.component';
|
||||
import { projectQueryParamKeys } from '../../../resolvers/dfg-projects.resolver';
|
||||
import { toSignal } from '@angular/core/rxjs-interop';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { DfgPersonSummary } from '../../../api/model/dfgPersonSummary';
|
||||
import { MatTooltip } from '@angular/material/tooltip';
|
||||
@Component({
|
||||
selector: 'app-dfg-project-table',
|
||||
imports: [
|
||||
DataTableComponent,
|
||||
RouterModule,
|
||||
MatIconModule,
|
||||
MatButtonModule,
|
||||
QueryParamPaginatorComponent,
|
||||
MatTooltip,
|
||||
],
|
||||
templateUrl: './dfg-project-table.component.html',
|
||||
styleUrl: './dfg-project-table.component.scss',
|
||||
})
|
||||
export class DfgProjectTableComponent implements OnInit {
|
||||
private readonly activatedRoute = inject(ActivatedRoute);
|
||||
private readonly router = inject(Router);
|
||||
|
||||
page = input.required<DfgProjectPage>();
|
||||
authorFilterEnabled = input<boolean>(false);
|
||||
institutionFilterEnabled = input<boolean>(false);
|
||||
topicFilterEnabled = input<boolean>(false);
|
||||
|
||||
elements = computed(() => this.page().elements ?? []);
|
||||
|
||||
queryParamMap = toSignal(this.activatedRoute.queryParamMap, {
|
||||
initialValue: this.activatedRoute.snapshot.queryParamMap,
|
||||
});
|
||||
queryParamKeys = projectQueryParamKeys;
|
||||
total = computed(() => this.page().total ?? 0);
|
||||
|
||||
columns: GenericColumn<DfgProjectSummary>[] = [];
|
||||
titleTmp = viewChild.required<TemplateRef<any>>('titleTmp');
|
||||
yearTmp = viewChild.required<TemplateRef<any>>('yearTmp');
|
||||
authorsTmp = viewChild.required<TemplateRef<any>>('authorsTmp');
|
||||
institutionsTmp = viewChild.required<TemplateRef<any>>('institutionsTmp');
|
||||
fundingEndTmp = viewChild.required<TemplateRef<any>>('fundingEndTmp');
|
||||
actionsTmp = viewChild.required<TemplateRef<any>>('actionsTmp');
|
||||
detailRowTmp = viewChild.required<TemplateRef<any>>('detailRowTmp');
|
||||
topicsTmp = viewChild.required<TemplateRef<any>>('topicsTmp');
|
||||
|
||||
expandedProjectAuthorsId: string[] = [];
|
||||
expandedProjectInstitutionsId: string[] = [];
|
||||
|
||||
selectedYearsQueryParams = computed(() => {
|
||||
return this.queryParamMap().getAll(this.queryParamKeys.years).map(Number);
|
||||
});
|
||||
|
||||
selectedAuthorIdsQueryParams = computed(() => {
|
||||
return this.queryParamMap().getAll(this.queryParamKeys.authorId);
|
||||
});
|
||||
|
||||
selectedInstitutionIdsQueryParams = computed(() => {
|
||||
return this.queryParamMap().getAll(this.queryParamKeys.institutionId);
|
||||
});
|
||||
|
||||
selectedTopicIdsQueryParams = computed(() => {
|
||||
return this.queryParamMap().getAll(this.queryParamKeys.topicId);
|
||||
});
|
||||
|
||||
ngOnInit(): void {
|
||||
console.log('DFG PROJECTS', this.page());
|
||||
this.columns = [
|
||||
{ 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.fundingEndTmp(),
|
||||
},
|
||||
{
|
||||
id: 'names',
|
||||
header: 'user',
|
||||
type: 'accessor',
|
||||
accessorKey: 'names',
|
||||
cellTemplate: this.authorsTmp(),
|
||||
},
|
||||
{
|
||||
id: 'institutions',
|
||||
header: 'Institutionen',
|
||||
type: 'display',
|
||||
cellTemplate: this.institutionsTmp(),
|
||||
},
|
||||
{
|
||||
id: 'professional_classification',
|
||||
header: 'Fachliche Zuordnung',
|
||||
type: 'accessor',
|
||||
accessorKey: 'professional_classification',
|
||||
},
|
||||
{
|
||||
id: 'actions',
|
||||
header: '',
|
||||
type: 'display',
|
||||
cellTemplate: this.actionsTmp(),
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
sortNames(names: string[] | undefined): string[] {
|
||||
return [...(names ?? [])].sort((a, b) => a.localeCompare(b));
|
||||
}
|
||||
isAuthorActive(authorId: number): boolean {
|
||||
return (
|
||||
!!authorId &&
|
||||
this.authorFilterEnabled() &&
|
||||
this.selectedAuthorIdsQueryParams().includes(String(authorId))
|
||||
);
|
||||
}
|
||||
getProjectAuthors(project: DfgProjectSummary): DfgPersonSummary[] {
|
||||
return project.persons?.filter((a): a is DfgPersonSummary => !!a) || [];
|
||||
}
|
||||
|
||||
toggleProjectAuthorsExpansion(project: DfgProjectSummary): void {
|
||||
if (!project.id) return;
|
||||
|
||||
if (this.expandedProjectAuthorsId.includes(project.id)) {
|
||||
this.expandedProjectAuthorsId = this.expandedProjectAuthorsId.filter(
|
||||
(id) => id !== project.id,
|
||||
);
|
||||
} else {
|
||||
this.expandedProjectAuthorsId.push(project.id);
|
||||
}
|
||||
}
|
||||
isProjectPersonsExpanded(project: DfgProjectSummary): boolean {
|
||||
if (!project.id) return false;
|
||||
|
||||
return this.expandedProjectAuthorsId.includes(project.id);
|
||||
}
|
||||
getAuthorTooltipText(author: DfgPersonSummary): string {
|
||||
if (this.authorFilterEnabled() && author.person_id) {
|
||||
return `Nach Autor filtern: ${author.full_name}`;
|
||||
}
|
||||
return `Autor: ${author.full_name}`;
|
||||
}
|
||||
filterByAuthor(authorId: number): void {
|
||||
if (!authorId || !this.authorFilterEnabled()) return;
|
||||
const selectedAuthorIds = this.selectedAuthorIdsQueryParams();
|
||||
if (selectedAuthorIds.includes(String(authorId))) {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[this.queryParamKeys.authorId]: selectedAuthorIds.filter(
|
||||
(id) => id !== String(authorId),
|
||||
),
|
||||
[this.queryParamKeys.page]: 0,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
} else {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[this.queryParamKeys.authorId]: [
|
||||
...selectedAuthorIds,
|
||||
String(authorId),
|
||||
],
|
||||
[this.queryParamKeys.page]: 0,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
isProjectInstitutionsExpanded(project: DfgProjectSummary): boolean {
|
||||
if (!project.id) return false;
|
||||
|
||||
return this.expandedProjectInstitutionsId.includes(project.id);
|
||||
}
|
||||
|
||||
toggleProjectInstitutionsExpansion(project: DfgProjectSummary): void {
|
||||
if (!project.id) return;
|
||||
|
||||
if (this.expandedProjectInstitutionsId.includes(project.id)) {
|
||||
this.expandedProjectInstitutionsId =
|
||||
this.expandedProjectInstitutionsId.filter((id) => id !== project.id);
|
||||
} else {
|
||||
this.expandedProjectInstitutionsId.push(project.id);
|
||||
}
|
||||
}
|
||||
|
||||
getProjectInstitutions(project: DfgProjectSummary): any[] {
|
||||
const institutions = new Map<string, any>();
|
||||
|
||||
for (const institution of project.institutions ?? []) {
|
||||
const id = this.getProjectInstitutionId(institution);
|
||||
if (!id) continue;
|
||||
|
||||
institutions.set(id, institution);
|
||||
}
|
||||
|
||||
return Array.from(institutions.values()).sort((a, b) =>
|
||||
this.getProjectInstitutionName(a).localeCompare(
|
||||
this.getProjectInstitutionName(b),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
getProjectInstitutionId(institution: any): string | null {
|
||||
const id = institution.id;
|
||||
|
||||
return id == null ? null : String(id);
|
||||
}
|
||||
|
||||
getProjectInstitutionName(institution: any): string {
|
||||
return institution.name_de ?? institution.name_en;
|
||||
}
|
||||
|
||||
isInstitutionActive(
|
||||
institutionId: string | number | null | undefined,
|
||||
): boolean {
|
||||
return (
|
||||
!!institutionId &&
|
||||
this.institutionFilterEnabled() &&
|
||||
this.selectedInstitutionIdsQueryParams().includes(String(institutionId))
|
||||
);
|
||||
}
|
||||
|
||||
filterByInstitution(institution: any): void {
|
||||
const institutionId = this.getProjectInstitutionId(institution);
|
||||
|
||||
if (!institutionId || !this.institutionFilterEnabled()) return;
|
||||
|
||||
const selectedInstitutionIds = this.selectedInstitutionIdsQueryParams();
|
||||
|
||||
if (selectedInstitutionIds.includes(institutionId)) {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[this.queryParamKeys.institutionId]: selectedInstitutionIds.filter(
|
||||
(id) => id !== institutionId,
|
||||
),
|
||||
[this.queryParamKeys.page]: 0,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
} else {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[this.queryParamKeys.institutionId]: [
|
||||
...selectedInstitutionIds,
|
||||
institutionId,
|
||||
],
|
||||
[this.queryParamKeys.page]: 0,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
getInstitutionTooltipText(institution: any): string {
|
||||
const name = this.getProjectInstitutionName(institution);
|
||||
|
||||
if (this.institutionFilterEnabled()) {
|
||||
return `Nach Institution filtern: ${name}`;
|
||||
}
|
||||
|
||||
return `Institution: ${name}`;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<app-data-table
|
||||
[columns]="columns"
|
||||
[data]="elements()"
|
||||
[queryParamSortKey]="queryParamKeys.sortBy"
|
||||
[queryParamSortDirectionKey]="queryParamKeys.sortDirection" />
|
||||
|
||||
<app-query-param-paginator
|
||||
[total]="total()"
|
||||
[queryParamPageKey]="queryParamKeys.page"
|
||||
[queryParamSizeKey]="queryParamKeys.size"
|
||||
[pageSizeOptions]="[10]" />
|
||||
|
||||
<ng-template #fundingStartTmp let-element>
|
||||
{{ element.startDate | date: 'dd.MM.yyyy' }}
|
||||
</ng-template>
|
||||
|
||||
<ng-template #fundingEndTmp let-element>
|
||||
{{ element.endDate | date: 'dd.MM.yyyy' }}
|
||||
</ng-template>
|
||||
|
||||
<ng-template #fundingAmountTmp let-element>
|
||||
{{ element.ecMaxContribution | currency: 'EUR' : 'symbol' : '1.0-0' : 'de' }}
|
||||
</ng-template>
|
||||
|
||||
<ng-template #actionsTmp 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>
|
||||
@@ -0,0 +1,78 @@
|
||||
import {
|
||||
Component,
|
||||
computed,
|
||||
input,
|
||||
OnInit,
|
||||
TemplateRef,
|
||||
viewChild,
|
||||
} from '@angular/core';
|
||||
import { CordisEuProject, CordisEuProjectPage } from '../../../api';
|
||||
import {
|
||||
DataTableComponent,
|
||||
GenericColumn,
|
||||
} from '../data-table/data-table.component';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { CurrencyPipe, DatePipe } from '@angular/common';
|
||||
import { QueryParamPaginatorComponent } from '../query-param-paginator/query-param-paginator.component';
|
||||
import { projectQueryParamKeys } from '../../../resolvers/dfg-projects.resolver';
|
||||
|
||||
@Component({
|
||||
selector: 'app-eu-project-table',
|
||||
imports: [
|
||||
DataTableComponent,
|
||||
RouterModule,
|
||||
MatIconModule,
|
||||
MatButtonModule,
|
||||
DatePipe,
|
||||
CurrencyPipe,
|
||||
QueryParamPaginatorComponent,
|
||||
],
|
||||
templateUrl: './eu-project-table.component.html',
|
||||
styleUrl: './eu-project-table.component.scss',
|
||||
})
|
||||
export class EuProjectTableComponent implements OnInit {
|
||||
page = input.required<CordisEuProjectPage>();
|
||||
queryParamKeys = projectQueryParamKeys;
|
||||
|
||||
elements = computed(() => this.page().elements ?? []);
|
||||
total = computed(() => this.page().total ?? 0);
|
||||
|
||||
columns: GenericColumn<CordisEuProject>[] = [];
|
||||
|
||||
fundingStartTmp = viewChild.required<TemplateRef<any>>('fundingStartTmp');
|
||||
fundingEndTmp = viewChild.required<TemplateRef<any>>('fundingEndTmp');
|
||||
fundingAmountTmp = viewChild.required<TemplateRef<any>>('fundingAmountTmp');
|
||||
actionsTmp = viewChild.required<TemplateRef<any>>('actionsTmp');
|
||||
|
||||
ngOnInit(): void {
|
||||
this.columns = [
|
||||
{ id: 'title', header: 'Titel', type: 'accessor', accessorKey: 'title' },
|
||||
{
|
||||
id: 'startDate',
|
||||
header: 'Startdatum',
|
||||
type: 'display',
|
||||
cellTemplate: this.fundingStartTmp(),
|
||||
},
|
||||
{
|
||||
id: 'endDate',
|
||||
header: 'Enddatum',
|
||||
type: 'display',
|
||||
cellTemplate: this.fundingEndTmp(),
|
||||
},
|
||||
{
|
||||
id: 'ecMaxContribution',
|
||||
header: 'Förderbetrag (EU)',
|
||||
type: 'display',
|
||||
cellTemplate: this.fundingAmountTmp(),
|
||||
},
|
||||
{
|
||||
id: 'actions',
|
||||
header: '',
|
||||
type: 'display',
|
||||
cellTemplate: this.actionsTmp(),
|
||||
},
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<div class="content">
|
||||
@if (showTitleFilter()) {
|
||||
<app-query-param-input
|
||||
[queryParamKey]="queryParamKeys.title"
|
||||
label="Suche nach Titel"
|
||||
placeholder="Suche"
|
||||
[debounceTime]="300" />
|
||||
}
|
||||
<div class="select-area">
|
||||
@if (showInstitutionFilter()) {
|
||||
<app-searchable-institution-select
|
||||
[label]="institutionLabel()"
|
||||
[selectedInstitutions]="selectedInstitutions()"
|
||||
(handleInstitutionSelectChange)="
|
||||
handleInstitutionSelectChange($event)
|
||||
" />
|
||||
}
|
||||
@if (showYearFilter()) {
|
||||
<app-searchable-year-select
|
||||
[label]="yearLabel()"
|
||||
[selectedYears]="selectedYears()"
|
||||
(handleYearSelectChange)="handleYearSelectChange($event)" />
|
||||
}
|
||||
@if (showAuthorFilter()) {
|
||||
<app-searchable-author-select
|
||||
[label]="authorLabel()"
|
||||
[selectedAuthors]="selectedAuthors()"
|
||||
(handleAuthorSelectChange)="handleAuthorSelectChange($event)" />
|
||||
}
|
||||
<button mat-stroked-button color="primary" (click)="resetFilters()">
|
||||
<mat-icon>filter_alt_off</mat-icon>
|
||||
Filter zurücksetzen
|
||||
</button>
|
||||
</div>
|
||||
<app-selected-filters [observers]="observers()" />
|
||||
</div>
|
||||
@@ -0,0 +1,13 @@
|
||||
.content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.select-area {
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
flex-wrap: wrap;
|
||||
width: 100%;
|
||||
align-items: center;
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
import { Component, computed, input } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { toSignal } from '@angular/core/rxjs-interop';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { Author, Institution } from '../../../api';
|
||||
import { QueryParamInputComponent } from '../query-param-input/query-param-input.component';
|
||||
import { SearchableInstitutionSelectComponent } from '../searchable-institution-select/searchable-institution-select.component';
|
||||
import { SearchableAuthorSelectComponent } from '../searchable-author-select/searchable-author-select.component';
|
||||
import { SearchableYearSelectComponent } from '../searchable-year-select/searchable-year-select.component';
|
||||
import { projectQueryParamKeys } from '../../../resolvers/dfg-projects.resolver';
|
||||
import {
|
||||
FilterObserver,
|
||||
SelectedFiltersComponent,
|
||||
} from '../selected-filters/selected-filters.component';
|
||||
import { map } from 'rxjs/internal/operators/map';
|
||||
|
||||
@Component({
|
||||
selector: 'app-project-filters',
|
||||
imports: [
|
||||
MatButtonModule,
|
||||
MatIconModule,
|
||||
QueryParamInputComponent,
|
||||
SearchableInstitutionSelectComponent,
|
||||
SearchableAuthorSelectComponent,
|
||||
SearchableYearSelectComponent,
|
||||
SelectedFiltersComponent,
|
||||
],
|
||||
templateUrl: './project-filters.component.html',
|
||||
styleUrl: './project-filters.component.scss',
|
||||
})
|
||||
export class ProjectFilterComponent {
|
||||
constructor(private readonly router: Router) {}
|
||||
|
||||
// Each tab (DFG / EU) passes its OWN key set so they never collide.
|
||||
queryParamKeys = projectQueryParamKeys;
|
||||
|
||||
selectedInstitutions = input<Institution[]>([]);
|
||||
selectedTopics = input<string[]>([]);
|
||||
selectedAuthors = input<Author[]>([]);
|
||||
|
||||
showTitleFilter = input<boolean>(true);
|
||||
showInstitutionFilter = input<boolean>(true);
|
||||
showAuthorFilter = input<boolean>(true);
|
||||
showYearFilter = input<boolean>(true);
|
||||
|
||||
queryParamMap = toSignal(this.router.routerState.root.queryParamMap, {
|
||||
initialValue: this.router.routerState.snapshot.root.queryParamMap,
|
||||
});
|
||||
|
||||
selectedInstitutionIds = computed(() =>
|
||||
this.queryParamMap().getAll(this.queryParamKeys.institutionId),
|
||||
);
|
||||
|
||||
selectedAuthorIds = computed(() =>
|
||||
this.queryParamMap().getAll(this.queryParamKeys.authorId),
|
||||
);
|
||||
|
||||
selectedYears = computed(() =>
|
||||
this.queryParamMap().getAll(this.queryParamKeys.years).map(Number),
|
||||
);
|
||||
yearLabel = computed(() => {
|
||||
const selectedYears = this.selectedYears();
|
||||
if (selectedYears.length === 0) {
|
||||
return 'Jahr';
|
||||
} else if (selectedYears.length === 1) {
|
||||
return selectedYears[0].toString();
|
||||
} else {
|
||||
return `${selectedYears.length} Jahre`;
|
||||
}
|
||||
});
|
||||
|
||||
institutionLabel = computed(() => {
|
||||
const selected = this.selectedInstitutions().filter((i) =>
|
||||
this.selectedInstitutionIds().includes(i.id!),
|
||||
);
|
||||
if (selected.length === 0) return 'Institution';
|
||||
if (selected.length === 1) return selected[0].display_name ?? 'Institution';
|
||||
return `${selected.length} Institutionen`;
|
||||
});
|
||||
|
||||
authorLabel = computed(() => {
|
||||
const selected = this.selectedAuthors().filter((a) =>
|
||||
this.selectedAuthorIds().includes(a.id!),
|
||||
);
|
||||
if (selected.length === 0) return 'Autor';
|
||||
if (selected.length === 1) return selected[0].display_name ?? 'Autor';
|
||||
return `${selected.length} Autoren`;
|
||||
});
|
||||
|
||||
observers = computed<FilterObserver[]>(() => {
|
||||
const keys = this.queryParamKeys;
|
||||
return [
|
||||
{ id: 'search', queryParamKey: keys.title, icon: 'search' },
|
||||
{
|
||||
id: 'years',
|
||||
queryParamKey: projectQueryParamKeys.years,
|
||||
icon: 'calendar_today',
|
||||
},
|
||||
{
|
||||
id: 'institutions',
|
||||
queryParamKey: keys.institutionId,
|
||||
icon: 'apartment',
|
||||
valueFormatter: (value: string) =>
|
||||
this.selectedInstitutions().find((i) => i.id === value)
|
||||
?.display_name ?? value,
|
||||
},
|
||||
{
|
||||
id: 'authors',
|
||||
queryParamKey: keys.authorId,
|
||||
icon: 'person',
|
||||
valueFormatter: (value: string) =>
|
||||
this.selectedAuthors().find((a) => a.id === value)?.display_name ??
|
||||
value,
|
||||
},
|
||||
];
|
||||
});
|
||||
|
||||
handleYearSelectChange = (selectedYear: number): void => {
|
||||
if (this.selectedYears().includes(selectedYear)) {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[projectQueryParamKeys.years]: this.selectedYears().filter(
|
||||
(year) => year !== selectedYear,
|
||||
),
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
} else {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[projectQueryParamKeys.years]: [
|
||||
...this.selectedYears(),
|
||||
selectedYear,
|
||||
],
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
}
|
||||
};
|
||||
handleInstitutionSelectChange = (institution: Institution): void => {
|
||||
if (!institution.id) return;
|
||||
const keys = this.queryParamKeys;
|
||||
const selectedIds = this.selectedInstitutionIds();
|
||||
const nextIds = selectedIds.includes(institution.id)
|
||||
? selectedIds.filter((id) => id !== institution.id)
|
||||
: [...selectedIds, institution.id];
|
||||
|
||||
this.router.navigate([], {
|
||||
queryParams: { [keys.institutionId]: nextIds, [keys.page]: 0 },
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
};
|
||||
|
||||
handleAuthorSelectChange = (author: Author): void => {
|
||||
if (!author.id) return;
|
||||
const keys = this.queryParamKeys;
|
||||
const selectedIds = this.selectedAuthorIds();
|
||||
const nextIds = selectedIds.includes(author.id)
|
||||
? selectedIds.filter((id) => id !== author.id)
|
||||
: [...selectedIds, author.id];
|
||||
|
||||
this.router.navigate([], {
|
||||
queryParams: { [keys.authorId]: nextIds, [keys.page]: 0 },
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
};
|
||||
|
||||
resetFilters = (): void => {
|
||||
const keys = this.queryParamKeys;
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[keys.title]: null,
|
||||
[keys.institutionId]: null,
|
||||
[keys.authorId]: null,
|
||||
[keys.years]: null,
|
||||
[keys.page]: 0,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
};
|
||||
}
|
||||
@@ -77,7 +77,10 @@
|
||||
@let visibleAuthors =
|
||||
workAuthorsExpanded ? workAuthors : workAuthors.slice(0, 3);
|
||||
<div class="author-tags" aria-label="Autoren" style="padding: 0.5rem 0">
|
||||
@for (author of visibleAuthors; track author.id) {
|
||||
@for (
|
||||
author of visibleAuthors;
|
||||
track author.id ?? 'name-' + author.display_name
|
||||
) {
|
||||
<button
|
||||
type="button"
|
||||
class="publication-institution-tag"
|
||||
|
||||
@@ -56,6 +56,7 @@ export class PublicationTableComponent implements OnInit {
|
||||
page = input.required<WorkPageV2>();
|
||||
authorFilterEnabled = input<boolean>(false);
|
||||
institutionFilterEnabled = input<boolean>(false);
|
||||
topicFilterEnabled = input<boolean>(false);
|
||||
|
||||
elements = computed(() => this.page().elements ?? []);
|
||||
|
||||
@@ -406,7 +407,7 @@ export class PublicationTableComponent implements OnInit {
|
||||
}
|
||||
|
||||
filterByTopic(topic: WorkTopic): void {
|
||||
if (!topic.id) return;
|
||||
if (!topic.id || !this.topicFilterEnabled()) return;
|
||||
const selectedTopicIds = this.selectedTopicIdsQueryParams();
|
||||
if (selectedTopicIds.includes(topic.id)) {
|
||||
this.router.navigate([], {
|
||||
@@ -458,7 +459,7 @@ export class PublicationTableComponent implements OnInit {
|
||||
}
|
||||
|
||||
getAuthorTooltipText(author: DehydratedAuthor): string {
|
||||
if (this.authorFilterEnabled()) {
|
||||
if (this.authorFilterEnabled() && author.id) {
|
||||
return `Nach Autor filtern: ${author.display_name}`;
|
||||
}
|
||||
return `Autor: ${author.display_name}`;
|
||||
|
||||
@@ -19,7 +19,7 @@ import {
|
||||
of,
|
||||
switchMap,
|
||||
} from 'rxjs';
|
||||
import { Topic } from '../../../api';
|
||||
import { Topic } from '../../../api/model/topic';
|
||||
|
||||
@Component({
|
||||
selector: 'app-topic-autocomplete',
|
||||
|
||||
Reference in New Issue
Block a user