fix(person/publications): changed publications to generic data table
LocationBasedServices/smartguide/pipeline/head This commit looks good
LocationBasedServices/smartguide/pipeline/head This commit looks good
This commit is contained in:
@@ -322,7 +322,8 @@
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="table-wrap">
|
||||
|
||||
<!-- <div class="table-wrap">
|
||||
@if (loading) {
|
||||
<div class="table-status">
|
||||
<mat-spinner diameter="36"></mat-spinner>
|
||||
@@ -534,7 +535,177 @@
|
||||
[pageSizeOptions]="paginationService.options"
|
||||
(page)="onPage($event)">
|
||||
</mat-paginator>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<app-data-table [columns]="workColumns" [data]="publications" />
|
||||
<app-query-param-paginator
|
||||
[total]="total"
|
||||
queryParamPageKey="publicationPage"
|
||||
queryParamSizeKey="publicationPageSize"
|
||||
[pageSizeOptions]="paginationService.options"
|
||||
(handlePageChange)="onPage($event)" />
|
||||
</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)"
|
||||
matTooltip="Nach Sprache filtern"
|
||||
matTooltipPosition="above"
|
||||
(click)="toggleLanguageFilter(work.language)">
|
||||
{{ work.language | languageCode }}
|
||||
</button>
|
||||
} @else {
|
||||
<span class="empty-text">-</span>
|
||||
}
|
||||
</ng-template>
|
||||
|
||||
<ng-template #institutionsTmp let-work>
|
||||
@let publicationInstitutions = getInstitutions(work);
|
||||
@let institutionsExpanded = true;
|
||||
@let visibleInstitutions =
|
||||
institutionsExpanded
|
||||
? publicationInstitutions
|
||||
: publicationInstitutions.slice(0, 3);
|
||||
<div class="institution-tags" aria-label="Institutionen">
|
||||
@for (institution of visibleInstitutions; track institution.id) {
|
||||
<button
|
||||
type="button"
|
||||
class="publication-institution-tag"
|
||||
[class.active]="isInstitutionActive(institution.id!)"
|
||||
[matTooltip]="institution.display_name"
|
||||
matTooltipPosition="above"
|
||||
[attr.aria-label]="
|
||||
'Nach Institution ' + institution.display_name + ' filtern'
|
||||
"
|
||||
(click)="
|
||||
filterByInstitution({
|
||||
id: institution.id!,
|
||||
name: institution.display_name || '',
|
||||
})
|
||||
">
|
||||
<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)="toggleInstitutions(work)">
|
||||
{{
|
||||
institutionsExpanded
|
||||
? 'weniger'
|
||||
: '+' + (publicationInstitutions.length - 3)
|
||||
}}
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
<ng-template #topicsTmp let-work>
|
||||
@let publicationTopics = work.topics ?? [];
|
||||
@let topicsExpanded = isTopicsExpanded(work);
|
||||
@let visibleTopics =
|
||||
topicsExpanded ? publicationTopics : publicationTopics.slice(0, 3);
|
||||
<div class="topic-chips" aria-label="Themen" style="padding: 0.5rem 0">
|
||||
@for (topic of visibleTopics; 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]="getTopicColor(topic)"
|
||||
[disabled]="!topic.id"
|
||||
[active]="isTopicActive(topic)"
|
||||
(chipClick)="filterByTopic(topic)">
|
||||
</app-topic-chip>
|
||||
} @empty {
|
||||
<span class="empty-text">-</span>
|
||||
}
|
||||
@if (publicationTopics.length > 3) {
|
||||
<button
|
||||
type="button"
|
||||
class="publication-topic-more"
|
||||
[attr.aria-expanded]="topicsExpanded"
|
||||
(click)="toggleTopics(work)">
|
||||
{{ topicsExpanded ? 'weniger' : '+' + (publicationTopics.length - 3) }}
|
||||
</button>
|
||||
}
|
||||
</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', publicationKey(work)]"
|
||||
matTooltip="Details anzeigen">
|
||||
<mat-icon>open_in_new</mat-icon>
|
||||
</a>
|
||||
</ng-template>
|
||||
|
||||
@@ -2,11 +2,13 @@ import {
|
||||
Component,
|
||||
DestroyRef,
|
||||
OnInit,
|
||||
TemplateRef,
|
||||
ViewChild,
|
||||
computed,
|
||||
effect,
|
||||
inject,
|
||||
input,
|
||||
viewChild,
|
||||
} from '@angular/core';
|
||||
import { HttpClient, HttpParams } from '@angular/common/http';
|
||||
import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
|
||||
@@ -43,6 +45,7 @@ import {
|
||||
|
||||
import {
|
||||
AuthorWorkPurposes,
|
||||
Institution,
|
||||
InstitutionsService,
|
||||
SpecificWorkPurpose,
|
||||
Work,
|
||||
@@ -67,6 +70,13 @@ 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 { QueryParamPaginatorComponent } from '../../shared/ui/query-param-paginator/query-param-paginator.component';
|
||||
echarts.use([
|
||||
GridComponent,
|
||||
CanvasRenderer,
|
||||
@@ -144,6 +154,10 @@ const PURPOSE_LABELS: Record<'FOUNDATION' | 'APPLICATION', string> = {
|
||||
NgxEchartsDirective,
|
||||
MatCardModule,
|
||||
MatExpansionModule,
|
||||
DataTableComponent,
|
||||
WorkTypePipe,
|
||||
LanguageCodePipe,
|
||||
QueryParamPaginatorComponent,
|
||||
],
|
||||
templateUrl: './person-publications.component.html',
|
||||
styleUrl: './person-publications.component.scss',
|
||||
@@ -180,6 +194,16 @@ export class PersonPublicationsComponent implements OnInit {
|
||||
|
||||
chartOption!: echarts.EChartsCoreOption;
|
||||
|
||||
workColumns: GenericColumn<Work>[] = [];
|
||||
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');
|
||||
|
||||
displayedColumns: string[] = [
|
||||
'title',
|
||||
'type',
|
||||
@@ -362,6 +386,57 @@ export class PersonPublicationsComponent implements OnInit {
|
||||
this.setupInstitutionAutocomplete();
|
||||
this.setupTopicAutocomplete();
|
||||
|
||||
this.workColumns = [
|
||||
{
|
||||
id: 'title',
|
||||
header: 'Titel',
|
||||
type: 'display',
|
||||
cellTemplate: this.titleTmp(),
|
||||
},
|
||||
{
|
||||
id: 'type',
|
||||
header: 'Typ',
|
||||
type: 'display',
|
||||
cellTemplate: this.typeTmp(),
|
||||
},
|
||||
{
|
||||
id: 'publication_year',
|
||||
header: 'Jahr',
|
||||
type: 'display',
|
||||
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: 'display',
|
||||
cellTemplate: this.citationsTmp(),
|
||||
},
|
||||
{
|
||||
id: 'actions',
|
||||
header: 'Aktionen',
|
||||
type: 'display',
|
||||
cellTemplate: this.actionsTmp(),
|
||||
},
|
||||
];
|
||||
|
||||
const parentParamMap = this.route.parent?.paramMap;
|
||||
if (!parentParamMap) return;
|
||||
|
||||
@@ -707,6 +782,19 @@ export class PersonPublicationsComponent implements OnInit {
|
||||
return 'info';
|
||||
}
|
||||
|
||||
getInstitutions(work: Work): Array<Institution> {
|
||||
const institutions: Array<Institution> = [];
|
||||
for (const authorship of work.authorships ?? []) {
|
||||
for (const institution of authorship.institutions ?? []) {
|
||||
if (!institution.id || !institution.display_name) continue;
|
||||
if (!institutions.some((inst) => inst.id === institution.id)) {
|
||||
institutions.push(institution);
|
||||
}
|
||||
}
|
||||
}
|
||||
return institutions;
|
||||
}
|
||||
|
||||
institutions(
|
||||
publication: Work,
|
||||
): Array<{ id: string; name: string; country: string | null }> {
|
||||
|
||||
@@ -25,13 +25,13 @@
|
||||
<div class="hero-copy">
|
||||
<div class="eyebrow">
|
||||
@if (publication.type) {
|
||||
<span>{{ publication.type }}</span>
|
||||
<span>{{ publication.type | workType }}</span>
|
||||
}
|
||||
@if (publication.publication_year) {
|
||||
<span>{{ publication.publication_year }}</span>
|
||||
}
|
||||
@if (publication.language) {
|
||||
<span>{{ publication.language | uppercase }}</span>
|
||||
<span>{{ publication.language | languageCode }}</span>
|
||||
}
|
||||
</div>
|
||||
<h1>
|
||||
@@ -269,11 +269,11 @@
|
||||
</div>
|
||||
<div>
|
||||
<dt>Typ</dt>
|
||||
<dd>{{ publication.type || '-' }}</dd>
|
||||
<dd>{{ publication.type | workType }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Sprache</dt>
|
||||
<dd>{{ publication.language || '-' }}</dd>
|
||||
<dd>{{ publication.language | languageCode }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Open Access</dt>
|
||||
|
||||
@@ -17,6 +17,8 @@ import {
|
||||
} from '../../api';
|
||||
import { TopicChipComponent } from '../../shared/ui/topic-chip/topic-chip.component';
|
||||
import { topicHierarchyColor } from '../../resolvers/utils/topic-colors';
|
||||
import { WorkTypePipe } from '../../shared/pipes/work-type.pipe';
|
||||
import { LanguageCodePipe } from '../../shared/pipes/language-code.pipe';
|
||||
|
||||
interface DetailLink {
|
||||
label: string;
|
||||
@@ -41,6 +43,8 @@ interface InstitutionDetail {
|
||||
RouterLink,
|
||||
TopicChipComponent,
|
||||
UpperCasePipe,
|
||||
WorkTypePipe,
|
||||
LanguageCodePipe
|
||||
],
|
||||
templateUrl: './publication-detail.component.html',
|
||||
styleUrl: './publication-detail.component.scss',
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
import { ResolveFn } from '@angular/router';
|
||||
import { WorkPage, WorksService } from '../api';
|
||||
import { inject } from '@angular/core';
|
||||
|
||||
export const workPageResolver: ResolveFn<WorkPage> = (route, state) => {
|
||||
const authorId = route.paramMap.get('authorId');
|
||||
const page = Number(route.queryParamMap.get('page') || 0);
|
||||
const pageSize = Number(route.queryParamMap.get('pageSize') || 10);
|
||||
const publicationYears = route.queryParamMap
|
||||
.getAll('publicationYears')
|
||||
.map(Number);
|
||||
const type = route.queryParamMap.getAll('types');
|
||||
const languages = route.queryParamMap.getAll('languages');
|
||||
const institutionIds = route.queryParamMap.getAll('institutionIds');
|
||||
const topicsIds = route.queryParamMap.getAll('topicsIds');
|
||||
|
||||
return inject(WorksService).getAuthorWorks(
|
||||
authorId!,
|
||||
page,
|
||||
pageSize,
|
||||
publicationYears,
|
||||
type,
|
||||
languages,
|
||||
institutionIds,
|
||||
topicsIds,
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,66 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
|
||||
@Pipe({
|
||||
name: 'languageCode',
|
||||
})
|
||||
export class LanguageCodePipe implements PipeTransform {
|
||||
transform(
|
||||
languageCode: string | null | undefined,
|
||||
...args: unknown[]
|
||||
): string {
|
||||
switch (languageCode) {
|
||||
case 'en':
|
||||
return 'Englisch';
|
||||
case 'de':
|
||||
return 'Deutsch';
|
||||
case 'fr':
|
||||
return 'Französisch';
|
||||
case 'es':
|
||||
return 'Spanisch';
|
||||
case 'it':
|
||||
return 'Italienisch';
|
||||
case 'pt':
|
||||
return 'Portugiesisch';
|
||||
case 'ru':
|
||||
return 'Russisch';
|
||||
case 'zh':
|
||||
return 'Chinesisch';
|
||||
case 'ja':
|
||||
return 'Japanisch';
|
||||
case 'ar':
|
||||
return 'Arabisch';
|
||||
case 'ko':
|
||||
return 'Koreanisch';
|
||||
case 'nl':
|
||||
return 'Niederländisch';
|
||||
case 'sv':
|
||||
return 'Schwedisch';
|
||||
case 'no':
|
||||
return 'Norwegisch';
|
||||
case 'da':
|
||||
return 'Dänisch';
|
||||
case 'fi':
|
||||
return 'Finnisch';
|
||||
case 'pl':
|
||||
return 'Polnisch';
|
||||
case 'cs':
|
||||
return 'Tschechisch';
|
||||
case 'hu':
|
||||
return 'Ungarisch';
|
||||
case 'tr':
|
||||
return 'Türkisch';
|
||||
case 'el':
|
||||
return 'Griechisch';
|
||||
case 'he':
|
||||
return 'Hebräisch';
|
||||
case 'hi':
|
||||
return 'Hindi';
|
||||
case 'th':
|
||||
return 'Thailändisch';
|
||||
case 'vi':
|
||||
return 'Vietnamesisch';
|
||||
default:
|
||||
return languageCode ?? 'Unbekannte Sprache';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
|
||||
@Pipe({
|
||||
name: 'workType',
|
||||
})
|
||||
export class WorkTypePipe implements PipeTransform {
|
||||
transform(value: string | null | undefined, ...args: unknown[]): string {
|
||||
switch (value) {
|
||||
case 'article':
|
||||
return 'Artikel';
|
||||
case 'book':
|
||||
return 'Buch';
|
||||
case 'book-chapter':
|
||||
return 'Buchkapitel';
|
||||
case 'dataset':
|
||||
return 'Datensatz';
|
||||
case 'dissertation':
|
||||
return 'Dissertation';
|
||||
case 'report':
|
||||
return 'Bericht';
|
||||
case 'preprint':
|
||||
return 'Preprint';
|
||||
default:
|
||||
return value ?? 'Unbekannter Typ';
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user