Merge branch 'dev' into ts-136-patent-to-researchers-v2
LocationBasedServices/smartguide/pipeline/pr-dev This commit looks good

This commit is contained in:
2026-07-16 13:44:48 +02:00
262 changed files with 11404 additions and 16375 deletions
@@ -38,6 +38,9 @@
<app-info-card
[value]="this.experimentalDevelopmentAmount() + ''"
description="Experimentelle Entwicklung" />
<app-info-card
[value]="this.notClassifiedAmmount() + ''"
description="Nicht klassifiziert" />
</div>
</mat-expansion-panel>
<mat-expansion-panel class="mat-elevation-z1" [expanded]="true">
@@ -215,153 +218,13 @@
<span>Zurücksetzen</span>
</button>
</form>
@if (
selectedInstitutionIdsQueryParams().length ||
selectedTopicIdsQueryParams().length ||
selectedYearsQueryParams().length ||
selectedTypesQueryParams().length ||
selectedLanguagesQueryParams().length
) {
<div class="active-filters-row" aria-label="Aktive Filter">
<span class="active-filters-label">Aktive Filter:</span>
<div class="chips-container">
@for (year of selectedYearsQueryParams(); track year) {
<span class="active-meta-filter">
<span class="filter-meta-chip">
<mat-icon class="filter-meta-chip__icon"
>calendar_today</mat-icon
>
<span class="filter-meta-chip__label">{{ year }}</span>
</span>
<button
type="button"
class="remove-chip-btn"
(click)="toggleYearFilter(year)"
[attr.aria-label]="'Jahresfilter ' + year + ' entfernen'">
<mat-icon>close</mat-icon>
</button>
</span>
}
@for (type of selectedTypesQueryParams(); track type) {
<span class="active-meta-filter">
<span class="filter-meta-chip">
<mat-icon class="filter-meta-chip__icon">category</mat-icon>
<span class="filter-meta-chip__label">{{ type }}</span>
</span>
<button
type="button"
class="remove-chip-btn"
(click)="toggleTypeFilter(type)"
[attr.aria-label]="'Typfilter ' + type + ' entfernen'">
<mat-icon>close</mat-icon>
</button>
</span>
}
@for (
language of selectedLanguagesQueryParams();
track language
) {
<span class="active-meta-filter">
<span class="filter-meta-chip">
<mat-icon class="filter-meta-chip__icon"
>translate</mat-icon
>
<span class="filter-meta-chip__label">{{
language | languageCode
}}</span>
</span>
<button
type="button"
class="remove-chip-btn"
(click)="toggleLanguageFilter(language)"
[attr.aria-label]="
'Sprachfilter ' + (language | languageCode) + ' entfernen'
">
<mat-icon>close</mat-icon>
</button>
</span>
}
@for (topic of selectedTopics(); track topic.id) {
<span class="active-meta-filter">
<span
class="filter-topic-chip"
[style.--topic-color]="getWorkTopicColor(topic)"
[matTooltip]="getSelectedWorkTopicTooltip(topic)"
matTooltipClass="topic-chip-tooltip"
[matTooltipDisabled]="!getSelectedWorkTopicTooltip(topic)">
<mat-icon class="filter-topic-chip__icon">label</mat-icon>
<span class="filter-topic-chip__label">{{
topic.display_name
}}</span>
</span>
<button
type="button"
class="remove-chip-btn"
(click)="removeTopic(topic)"
[attr.aria-label]="
'Themenfilter ' + topic.display_name + ' entfernen'
">
<mat-icon>close</mat-icon>
</button>
</span>
}
@for (
institution of selectedInstitutions();
track institution.id
) {
@let instCountry = selectedInstitutionCountry(institution);
<span class="active-institution-filter">
<span class="filter-institution-chip">
<mat-icon class="institution-icon">apartment</mat-icon>
<span class="institution-name">{{
institution.display_name
}}</span>
@if (instCountry) {
<img
alt=""
class="flag-img"
[src]="
'https://flagcdn.io/' +
instCountry.toLowerCase() +
'.svg'
"
height="10" />
<span class="country-code">{{
instCountry.toUpperCase()
}}</span>
}
<mat-icon
class="institution-open-icon"
[routerLink]="[
'/institution',
extractRawId(institution.id),
]"
aria-label="Institutionsseite öffnen"
>open_in_new</mat-icon
>
</span>
<button
type="button"
class="remove-chip-btn"
(click)="removeInstitution(institution)"
aria-label="Institutionsfilter entfernen">
<mat-icon>close</mat-icon>
</button>
</span>
}
</div>
</div>
}
</div>
<div class="table-wrap">
<app-data-table
[columns]="workColumns"
[data]="elements()"
queryParamSortKey="sort_by"
queryParamSortDirectionKey="sort_direction" />
</div>
<app-selected-filters [observers]="observers" />
<app-publication-table
[page]="authorWorkPage()"
[institutionFilterEnabled]="true" />
<app-query-param-paginator
[total]="totalElements()"
queryParamPageKey="page"
@@ -370,165 +233,3 @@
</mat-expansion-panel>
</mat-accordion>
</div>
<ng-template #titleTmp let-work>
<span>{{ work.title }}</span>
</ng-template>
<ng-template #typeTmp let-work>
@if (work.type) {
<button
type="button"
class="type-filter-btn"
[class.active]="isTypeActive(work.type)"
matTooltip="Nach Typ filtern"
matTooltipPosition="above"
(click)="toggleTypeFilter(work.type)">
<app-chip [color]="typeColor(work.type)">
{{ work.type | workType }}
</app-chip>
</button>
} @else {
<span class="empty-text">-</span>
}
</ng-template>
<ng-template #yearTmp let-work>
@if (work.publication_year) {
<button
type="button"
class="cell-filter-pill"
[class.active]="isYearActive(work.publication_year)"
matTooltip="Nach Jahr filtern"
matTooltipPosition="above"
(click)="toggleYearFilter(work.publication_year)">
{{ work.publication_year }}
</button>
} @else {
<span class="empty-text">-</span>
}
</ng-template>
<ng-template #languageTmp let-work>
@if (work.language) {
<button
type="button"
class="cell-filter-pill"
[class.active]="isLanguageActive(work.language_code)"
matTooltip="Nach Sprache filtern"
matTooltipPosition="above"
(click)="toggleLanguageFilter(work.language_code)">
{{ work.language_code | languageCode }}
</button>
} @else {
<span class="empty-text">-</span>
}
</ng-template>
<ng-template #institutionsTmp let-work>
@let publicationInstitutions = work.institutions ?? [];
@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.institution_id
) {
<button
type="button"
class="publication-institution-tag"
[class.active]="isInstitutionActive(institution.institution_id!)"
[matTooltip]="institution.institution_name"
matTooltipPosition="above"
[attr.aria-label]="
'Nach Institution ' + institution.institution_name + ' filtern'
"
(click)="
filterByInstitution({
id: institution.institution_id!,
name: institution.institution_name || '',
})
">
<mat-icon class="institution-icon">apartment</mat-icon>
<span class="institution-name">{{ institution.institution_name }}</span>
@if (institution.institution_country_code) {
<img
alt=""
class="flag-img"
[src]="
'https://flagcdn.io/' +
institution.institution_country_code.toLowerCase() +
'.svg'
"
height="10" />
<span class="country-code">{{
institution.institution_country_code.toUpperCase()
}}</span>
}
<mat-icon
class="institution-open-icon"
(click)="openInstitutionPage(institution.institution_id, $event)"
aria-label="Institutionsseite öffnen"
>open_in_new</mat-icon
>
</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>
<ng-template #topicsTmp let-work>
@let workTopics = work.topics ?? [];
<div class="topic-chips" aria-label="Themen" style="padding: 0.5rem 0">
@for (topic of workTopics; track topic.id) {
<app-topic-chip
size="mini"
[label]="topic.display_name || ''"
[description]="topic.description"
[subfieldName]="topic.subfield?.display_name"
[fieldName]="topic.field?.display_name"
[domainName]="topic.domain?.display_name"
[color]="getWorkTopicColor(topic)"
[disabled]="!topic.id"
[active]="isTopicActive(topic)"
(chipClick)="filterByTopic(topic)">
</app-topic-chip>
} @empty {
<span class="empty-text">-</span>
}
</div>
</ng-template>
<ng-template #citationsTmp let-work>
{{ work.cited_by_count ?? 0 }}
</ng-template>
<ng-template #actionsTmp let-work>
<a
mat-icon-button
color="primary"
[routerLink]="['/publication', extractRawId(work.id)]"
matTooltip="Details anzeigen">
<mat-icon>open_in_new</mat-icon>
</a>
</ng-template>
@@ -2,23 +2,21 @@ import {
Component,
DestroyRef,
OnInit,
TemplateRef,
computed,
effect,
inject,
input,
viewChild,
} from '@angular/core';
import { HttpClient, HttpParams } from '@angular/common/http';
import { FormControl, ReactiveFormsModule } from '@angular/forms';
import { ActivatedRoute, Router, RouterLink } from '@angular/router';
import { ActivatedRoute, Router } from '@angular/router';
import {
MatAutocompleteModule,
MatAutocompleteSelectedEvent,
} from '@angular/material/autocomplete';
import { MatIconModule } from '@angular/material/icon';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar';
import { MatSnackBarModule } from '@angular/material/snack-bar';
import { MatTableModule } from '@angular/material/table';
import { MatButtonModule } from '@angular/material/button';
import { MatFormFieldModule } from '@angular/material/form-field';
@@ -37,20 +35,17 @@ import {
} from 'rxjs';
import {
AuthorWork,
AuthorWorkInstitution,
AuthorWorkPage,
AuthorWorkPurposes,
InseWorksV2ModelWorkPage,
Institution,
InstitutionsService,
SpecificWorkPurpose,
Work,
WorkPurpose,
WorksService,
WorkTopic,
} from '../../api';
import { PaginationService } from '../../shared/services/pagination.service';
import { ChipComponent } from '../../shared/ui/chip/chip.component';
import { TopicChipComponent } from '../../shared/ui/topic-chip/topic-chip.component';
import { topicHierarchyColor } from '../../resolvers/utils/topic-colors';
import { buildTopicHierarchyTooltip } from '../../resolvers/utils/topic-tooltip';
import { NgxEchartsDirective } from 'ngx-echarts';
@@ -64,14 +59,16 @@ import { CanvasRenderer } from 'echarts/renderers';
import { GraphChart } from 'echarts/charts';
import { MatCardModule } from '@angular/material/card';
import { MatExpansionModule } from '@angular/material/expansion';
import {
GenericColumn,
DataTableComponent,
} from '../../shared/ui/data-table/data-table.component';
import { WorkTypePipe } from '../../shared/pipes/work-type.pipe';
import { LanguageCodePipe } from '../../shared/pipes/language-code.pipe';
import { translateWorkType } from '../../shared/pipes/work-type.pipe';
import { translateLanguageCode } from '../../shared/pipes/language-code.pipe';
import { QueryParamPaginatorComponent } from '../../shared/ui/query-param-paginator/query-param-paginator.component';
import { AppInfoCardComponent } from '../../shared/ui/app-info-card/app-info-card.component';
import { PublicationTableComponent } from '../../shared/ui/publication-table/publication-table.component';
import { workQueryParamKeys } from '../../resolvers/work-page.resolver';
import {
FilterObserver,
SelectedFiltersComponent,
} from '../../shared/ui/selected-filters/selected-filters.component';
echarts.use([
GridComponent,
CanvasRenderer,
@@ -114,26 +111,28 @@ interface YearlyPurposeCounts {
appliedResearch: number;
nonResearch: number;
experimentalDevelopment: number;
notClassified: number;
}
const PURPOSE_LABELS: Record<
| 'BASIC_RESEARCH'
| 'APPLIED_RESEARCH'
| 'NON_RESEARCH'
| 'EXPERIMENTAL_DEVELOPMENT',
| 'EXPERIMENTAL_DEVELOPMENT'
| 'NOT_CLASSIFIED',
string
> = {
BASIC_RESEARCH: 'Grundlagenforschung',
APPLIED_RESEARCH: 'anwendungsbasierte Forschung',
NON_RESEARCH: 'nicht-forschende Tätigkeit',
EXPERIMENTAL_DEVELOPMENT: 'experimentelle Entwicklung',
NOT_CLASSIFIED: 'nicht klassifiziert',
};
@Component({
selector: 'app-person-publications',
imports: [
MatButtonModule,
MatAutocompleteModule,
ChipComponent,
MatIconModule,
MatFormFieldModule,
MatInputModule,
@@ -143,16 +142,13 @@ const PURPOSE_LABELS: Record<
MatTableModule,
MatTooltipModule,
ReactiveFormsModule,
RouterLink,
TopicChipComponent,
NgxEchartsDirective,
MatCardModule,
MatExpansionModule,
DataTableComponent,
WorkTypePipe,
LanguageCodePipe,
QueryParamPaginatorComponent,
AppInfoCardComponent,
PublicationTableComponent,
SelectedFiltersComponent,
],
templateUrl: './person-publications.component.html',
styleUrl: './person-publications.component.scss',
@@ -162,7 +158,7 @@ export class PersonPublicationsComponent implements OnInit {
private readonly worksService = inject(WorksService);
authorWorkPage = input.required<AuthorWorkPage>();
authorWorkPage = input.required<InseWorksV2ModelWorkPage>();
totalElements = computed(() => this.authorWorkPage().total ?? 0);
elements = computed(() => this.authorWorkPage().elements ?? []);
@@ -198,14 +194,69 @@ export class PersonPublicationsComponent implements OnInit {
WorkPurpose.ExperimentalDevelopment,
);
});
notClassifiedAmmount = computed(() => {
return this.countPurpose(
this.authorWorkPurposes().purposes || [],
WorkPurpose.NotClassified,
);
});
expandedWorkInstitutionsId: string[] = [];
isWorkInstitutionsExpanded(work: AuthorWork): boolean {
observers: FilterObserver[] = [
{
id: 'types',
queryParamKey: workQueryParamKeys.types,
icon: 'category',
valueFormatter: (value: string) => {
return translateWorkType(value) || value;
},
},
{
id: 'years',
queryParamKey: workQueryParamKeys.years,
icon: 'calendar_today',
},
{
id: 'languages',
queryParamKey: workQueryParamKeys.language,
icon: 'translate',
valueFormatter: (value: string) => {
return translateLanguageCode(value) || value;
},
},
{
id: 'institutions',
queryParamKey: workQueryParamKeys.institutionId,
icon: 'apartment',
valueFormatter: (value: string) => {
const institution = this.selectedInstitutions().find(
(inst) => inst.id === value,
);
return institution ? institution.display_name : value;
},
},
{
id: 'topics',
queryParamKey: workQueryParamKeys.topicId,
icon: 'label',
valueFormatter: (value: string) => {
const topic = this.selectedTopics().find((t) => t.id === value);
return topic ? topic.display_name : value;
},
},
];
isWorkInstitutionsExpanded(work: Work): boolean {
if (!work.id) return false;
return this.expandedWorkInstitutionsId.includes(work.id);
}
toggleWorkInstitutionsExpansion(work: AuthorWork): void {
toggleWorkInstitutionsExpansion(work: Work): void {
if (!work.id) return;
if (this.expandedWorkInstitutionsId.includes(work.id)) {
this.expandedWorkInstitutionsId = this.expandedWorkInstitutionsId.filter(
(id) => id !== work.id,
@@ -230,16 +281,6 @@ export class PersonPublicationsComponent implements OnInit {
chartOption!: echarts.EChartsCoreOption;
workColumns: GenericColumn<AuthorWork>[] = [];
titleTmp = viewChild.required<TemplateRef<any>>('titleTmp');
typeTmp = viewChild.required<TemplateRef<any>>('typeTmp');
yearTmp = viewChild.required<TemplateRef<any>>('yearTmp');
languageTmp = viewChild.required<TemplateRef<any>>('languageTmp');
institutionsTmp = viewChild.required<TemplateRef<any>>('institutionsTmp');
topicsTmp = viewChild.required<TemplateRef<any>>('topicsTmp');
citationsTmp = viewChild.required<TemplateRef<any>>('citationsTmp');
actionsTmp = viewChild.required<TemplateRef<any>>('actionsTmp');
institutionLookupLoading = false;
topicLookupLoading = false;
institutionOptions: InstitutionAutocompleteOption[] = [];
@@ -258,20 +299,6 @@ export class PersonPublicationsComponent implements OnInit {
readonly publicationYearOptions = this.createPublicationYearOptions();
private readonly queryParamKeys = {
page: 'page',
pageSize: 'size',
years: 'publicationYear',
types: 'publicationType',
languages: 'publicationLanguage',
institutionIds: 'publicationInstitutionId',
institutionNames: 'publicationInstitutionName',
topicIds: 'publicationTopicId',
topicNames: 'publicationTopicName',
topicFields: 'publicationTopicField',
topicDomains: 'publicationTopicDomain',
} as const;
readonly typeOptions = [
{ value: 'article', label: 'article' },
{ value: 'book', label: 'book' },
@@ -304,7 +331,6 @@ export class PersonPublicationsComponent implements OnInit {
private readonly router: Router,
private readonly httpClient: HttpClient,
public readonly paginationService: PaginationService,
private readonly snackBar: MatSnackBar,
private readonly institutionsService: InstitutionsService,
) {
effect(() => {
@@ -320,28 +346,28 @@ export class PersonPublicationsComponent implements OnInit {
});
selectedYearsQueryParams = computed(() => {
return this.queryParamMap().getAll(this.queryParamKeys.years).map(Number);
return this.queryParamMap().getAll(workQueryParamKeys.years).map(Number);
});
handleYearSelectionChange(event: MatSelectChange): void {
this.router.navigate([], {
queryParams: {
[this.queryParamKeys.years]: event.value,
[this.queryParamKeys.page]: 0,
[workQueryParamKeys.years]: event.value,
[workQueryParamKeys.page]: 0,
},
queryParamsHandling: 'merge',
});
}
selectedTypesQueryParams = computed(() => {
return this.queryParamMap().getAll(this.queryParamKeys.types);
return this.queryParamMap().getAll(workQueryParamKeys.types);
});
handleTypeSelectionChange(event: MatSelectChange): void {
this.router.navigate([], {
queryParams: {
[this.queryParamKeys.types]: event.value,
[this.queryParamKeys.page]: 0,
[workQueryParamKeys.types]: event.value,
[workQueryParamKeys.page]: 0,
},
queryParamsHandling: 'merge',
});
@@ -349,15 +375,19 @@ export class PersonPublicationsComponent implements OnInit {
}
selectedLanguagesQueryParams = computed(() => {
return this.queryParamMap().getAll(this.queryParamKeys.languages);
return this.queryParamMap().getAll(workQueryParamKeys.language);
});
resolvedInstitutions = computed(() => {
const institutionMap = new Map<string, AuthorWorkInstitution>();
const institutionMap = new Map<string, Institution>();
for (const work of this.elements()) {
for (const institution of work.institutions ?? []) {
if (!institutionMap.has(institution.institution_id)) {
institutionMap.set(institution.institution_id, institution);
for (const authorship of work.authorships ?? []) {
for (const institution of authorship.institutions ?? []) {
if (!institution.id) continue;
if (!institutionMap.has(institution.id)) {
institutionMap.set(institution.id, institution);
}
}
}
}
@@ -367,8 +397,8 @@ export class PersonPublicationsComponent implements OnInit {
handleLanguageSelectionChange(event: MatSelectChange): void {
this.router.navigate([], {
queryParams: {
[this.queryParamKeys.languages]: event.value,
[this.queryParamKeys.page]: 0,
[workQueryParamKeys.language]: event.value,
[workQueryParamKeys.page]: 0,
},
queryParamsHandling: 'merge',
});
@@ -376,11 +406,11 @@ export class PersonPublicationsComponent implements OnInit {
}
selectedInstitutionIdsQueryParams = computed(() => {
return this.queryParamMap().getAll(this.queryParamKeys.institutionIds);
return this.queryParamMap().getAll(workQueryParamKeys.institutionId);
});
selectedTopicIdsQueryParams = computed(() => {
return this.queryParamMap().getAll(this.queryParamKeys.topicIds);
return this.queryParamMap().getAll(workQueryParamKeys.topicId);
});
getAuthorSpecificWorkPurposesByYear(
@@ -411,6 +441,7 @@ export class PersonPublicationsComponent implements OnInit {
appliedResearch: 0,
nonResearch: 0,
experimentalDevelopment: 0,
notClassified: 0,
};
for (const purpose of purposes) {
if (purpose.purpose == WorkPurpose.BasicResearch) {
@@ -421,6 +452,8 @@ export class PersonPublicationsComponent implements OnInit {
counts.nonResearch++;
} else if (purpose.purpose == WorkPurpose.ExperimentalDevelopment) {
counts.experimentalDevelopment++;
} else if (purpose.purpose == WorkPurpose.NotClassified) {
counts.notClassified++;
}
}
return counts;
@@ -437,6 +470,7 @@ export class PersonPublicationsComponent implements OnInit {
PURPOSE_LABELS.APPLIED_RESEARCH,
PURPOSE_LABELS.NON_RESEARCH,
PURPOSE_LABELS.EXPERIMENTAL_DEVELOPMENT,
PURPOSE_LABELS.NOT_CLASSIFIED,
],
bottom: 0,
itemGap: 40,
@@ -482,6 +516,13 @@ export class PersonPublicationsComponent implements OnInit {
emphasis: { focus: 'series' },
data: data.map((d) => d.experimentalDevelopment),
},
{
name: PURPOSE_LABELS.NOT_CLASSIFIED,
type: 'bar',
stack: 'total',
emphasis: { focus: 'series' },
data: data.map((d) => d.notClassified),
},
],
};
}
@@ -489,61 +530,6 @@ export class PersonPublicationsComponent implements OnInit {
ngOnInit(): void {
this.setupInstitutionAutocomplete();
this.setupTopicAutocomplete();
this.workColumns = [
{
id: 'title',
header: 'Titel',
type: 'accessor',
accessorKey: 'title',
cellTemplate: this.titleTmp(),
},
{
id: 'type',
header: 'Typ',
type: 'accessor',
accessorKey: 'type',
cellTemplate: this.typeTmp(),
},
{
id: 'publication_year',
header: 'Jahr',
type: 'accessor',
accessorKey: 'publication_year',
cellTemplate: this.yearTmp(),
},
{
id: 'language',
header: 'Sprache',
type: 'display',
cellTemplate: this.languageTmp(),
},
{
id: 'institutions',
header: 'Institutionen',
type: 'display',
cellTemplate: this.institutionsTmp(),
},
{
id: 'topics',
header: 'Themen',
type: 'display',
cellTemplate: this.topicsTmp(),
},
{
id: 'cited_by_count',
header: 'Zitiert von',
type: 'accessor',
accessorKey: 'cited_by_count',
cellTemplate: this.citationsTmp(),
},
{
id: 'actions',
header: 'Aktionen',
type: 'display',
cellTemplate: this.actionsTmp(),
},
];
}
clearFilters(): void {
@@ -567,11 +553,11 @@ export class PersonPublicationsComponent implements OnInit {
if (!this.selectedInstitutionIdsQueryParams().includes(institution.id)) {
this.router.navigate([], {
queryParams: {
[this.queryParamKeys.institutionIds]: [
[workQueryParamKeys.institutionId]: [
...this.selectedInstitutionIdsQueryParams(),
institution.id,
],
[this.queryParamKeys.page]: 0,
[workQueryParamKeys.page]: 0,
},
queryParamsHandling: 'merge',
});
@@ -581,11 +567,11 @@ export class PersonPublicationsComponent implements OnInit {
removeInstitution(institution: InstitutionAutocompleteOption): void {
this.router.navigate([], {
queryParams: {
[this.queryParamKeys.institutionIds]:
[workQueryParamKeys.institutionId]:
this.selectedInstitutionIdsQueryParams().filter(
(id) => id !== institution.id,
),
[this.queryParamKeys.page]: 0,
[workQueryParamKeys.page]: 0,
},
queryParamsHandling: 'merge',
});
@@ -597,21 +583,21 @@ export class PersonPublicationsComponent implements OnInit {
if (selectedInstitutionIds.includes(institution.id)) {
this.router.navigate([], {
queryParams: {
[this.queryParamKeys.institutionIds]: selectedInstitutionIds.filter(
[workQueryParamKeys.institutionId]: selectedInstitutionIds.filter(
(id) => id !== institution.id,
),
[this.queryParamKeys.page]: 0,
[workQueryParamKeys.page]: 0,
},
queryParamsHandling: 'merge',
});
} else {
this.router.navigate([], {
queryParams: {
[this.queryParamKeys.institutionIds]: [
[workQueryParamKeys.institutionId]: [
...selectedInstitutionIds,
institution.id,
],
[this.queryParamKeys.page]: 0,
[workQueryParamKeys.page]: 0,
},
queryParamsHandling: 'merge',
});
@@ -629,12 +615,11 @@ export class PersonPublicationsComponent implements OnInit {
const authorWorkPage = this.authorWorkPage();
if (!authorWorkPage?.elements) return null;
for (const publication of authorWorkPage.elements) {
for (const inst of publication.institutions ?? []) {
if (
institution.id === inst.institution_id &&
inst.institution_country_code
) {
return inst.institution_country_code;
for (const authorship of publication.authorships ?? []) {
for (const inst of authorship.institutions ?? []) {
if (institution.id === inst.id && inst.country_code) {
return inst.country_code;
}
}
}
}
@@ -646,16 +631,16 @@ export class PersonPublicationsComponent implements OnInit {
if (selectedYears.includes(year)) {
this.router.navigate([], {
queryParams: {
[this.queryParamKeys.years]: selectedYears.filter((y) => y !== year),
[this.queryParamKeys.page]: 0,
[workQueryParamKeys.years]: selectedYears.filter((y) => y !== year),
[workQueryParamKeys.page]: 0,
},
queryParamsHandling: 'merge',
});
} else {
this.router.navigate([], {
queryParams: {
[this.queryParamKeys.years]: [...selectedYears, year],
[this.queryParamKeys.page]: 0,
[workQueryParamKeys.years]: [...selectedYears, year],
[workQueryParamKeys.page]: 0,
},
queryParamsHandling: 'merge',
});
@@ -667,16 +652,16 @@ export class PersonPublicationsComponent implements OnInit {
if (selectedTopics.includes(type)) {
this.router.navigate([], {
queryParams: {
[this.queryParamKeys.types]: selectedTopics.filter((t) => t !== type),
[this.queryParamKeys.page]: 0,
[workQueryParamKeys.types]: selectedTopics.filter((t) => t !== type),
[workQueryParamKeys.page]: 0,
},
queryParamsHandling: 'merge',
});
} else {
this.router.navigate([], {
queryParams: {
[this.queryParamKeys.types]: [...selectedTopics, type],
[this.queryParamKeys.page]: 0,
[workQueryParamKeys.types]: [...selectedTopics, type],
[workQueryParamKeys.page]: 0,
},
queryParamsHandling: 'merge',
});
@@ -688,18 +673,18 @@ export class PersonPublicationsComponent implements OnInit {
if (selectedLanguages.includes(language)) {
this.router.navigate([], {
queryParams: {
[this.queryParamKeys.languages]: selectedLanguages.filter(
[workQueryParamKeys.language]: selectedLanguages.filter(
(l) => l !== language,
),
[this.queryParamKeys.page]: 0,
[workQueryParamKeys.page]: 0,
},
queryParamsHandling: 'merge',
});
} else {
this.router.navigate([], {
queryParams: {
[this.queryParamKeys.languages]: [...selectedLanguages, language],
[this.queryParamKeys.page]: 0,
[workQueryParamKeys.language]: [...selectedLanguages, language],
[workQueryParamKeys.page]: 0,
},
queryParamsHandling: 'merge',
});
@@ -728,40 +713,29 @@ export class PersonPublicationsComponent implements OnInit {
if (!this.selectedTopicIdsQueryParams().includes(topic.id)) {
this.router.navigate([], {
queryParams: {
[this.queryParamKeys.topicIds]: [
[workQueryParamKeys.topicId]: [
...this.selectedTopicIdsQueryParams(),
topic.id,
],
[this.queryParamKeys.page]: 0,
[workQueryParamKeys.page]: 0,
},
queryParamsHandling: 'merge',
});
}
}
private fieldNameFromHint(
hint: string | null | undefined,
): string | undefined {
const fieldName = (hint ?? '').split('·')[0]?.trim();
return fieldName || undefined;
}
removeTopic(topic: TopicAutocompleteOption): void {
this.router.navigate([], {
queryParams: {
[this.queryParamKeys.topicIds]:
this.selectedTopicIdsQueryParams().filter((id) => id !== topic.id),
[this.queryParamKeys.page]: 0,
[workQueryParamKeys.topicId]: this.selectedTopicIdsQueryParams().filter(
(id) => id !== topic.id,
),
[workQueryParamKeys.page]: 0,
},
queryParamsHandling: 'merge',
});
}
doiUrl(doi: string | null | undefined): string | null {
if (!doi) return null;
return doi.startsWith('http') ? doi : `https://doi.org/${doi}`;
}
extractRawId(id: string | null | undefined): string | null {
if (!id) return null;
return id.split('/').filter(Boolean).pop() ?? null;
@@ -801,80 +775,6 @@ export class PersonPublicationsComponent implements OnInit {
});
}
getSelectedTopicTooltip(topic: TopicAutocompleteOption): string {
const workTopic = this.findPublicationTopic(topic.id);
return buildTopicHierarchyTooltip({
topicName: topic.display_name,
description: workTopic?.description,
subfieldName: workTopic?.subfield?.display_name,
fieldName: workTopic?.field?.display_name ?? topic.field_name,
domainName: workTopic?.domain?.display_name ?? topic.domain_name,
});
}
private findPublicationTopic(
topicId: string | null | undefined,
): WorkTopic | undefined {
if (!topicId) return undefined;
const authorWorkPage = this.authorWorkPage();
if (!authorWorkPage?.elements) return undefined;
for (const publication of authorWorkPage.elements) {
const topic = publication.topics?.find((item) => item.id === topicId);
if (topic) return topic;
}
return undefined;
}
getSelectedTopicColor(topic: TopicAutocompleteOption): string {
return topicHierarchyColor({
id: topic.id,
name: topic.display_name,
field_id: topic.field_id,
field_name: topic.field_name,
domain_id: topic.domain_id,
domain_name: topic.domain_name,
});
}
isTopicActive(topic: WorkTopic): boolean {
return !!topic.id && this.selectedTopicIdsQueryParams().includes(topic.id);
}
filterByTopic(topic: WorkTopic): void {
if (!topic.id) return;
const selectedTopicIds = this.selectedTopicIdsQueryParams();
if (selectedTopicIds.includes(topic.id)) {
this.router.navigate([], {
queryParams: {
[this.queryParamKeys.topicIds]: selectedTopicIds.filter(
(id) => id !== topic.id,
),
[this.queryParamKeys.page]: 0,
},
queryParamsHandling: 'merge',
});
} else {
this.router.navigate([], {
queryParams: {
[this.queryParamKeys.topicIds]: [...selectedTopicIds, topic.id],
[this.queryParamKeys.page]: 0,
},
queryParamsHandling: 'merge',
});
}
}
typeColor(type: string | null | undefined): string {
const normalized = (type ?? '').toLowerCase();
if (normalized.includes('conference')) return 'success';
if (normalized.includes('book')) return 'help';
return 'info';
}
yearSelectionSummary(): string {
return this.summarizeSelection(this.selectedYearsQueryParams().map(String));
}