Merge branch 'dev' of nes.uni-due.de:lbs/smartguide into feature/keywords-analysis

This commit is contained in:
2026-07-17 15:15:09 +02:00
36 changed files with 1078 additions and 548 deletions
@@ -0,0 +1,31 @@
import { Pipe, PipeTransform } from '@angular/core';
import { WorkPrimaryCategory } from '../../api';
export const workPrimaryCategoryLabels: Record<WorkPrimaryCategory, string> = {
[WorkPrimaryCategory.AppliedResearch]: 'Anwendungsbasierte Forschung',
[WorkPrimaryCategory.BasicResearch]: 'Grundlagenforschung',
[WorkPrimaryCategory.ExperimentalDevelopment]: 'Experimentelle Entwicklung',
[WorkPrimaryCategory.NonResearch]: 'Nicht-forschende Tätigkeit',
[WorkPrimaryCategory.NotClassified]: 'Nicht klassifiziert',
};
export const transformWorkPrimaryCategory = (
value: WorkPrimaryCategory | null | undefined,
): string => {
if (!value) {
return '';
}
return workPrimaryCategoryLabels[value] || value;
};
@Pipe({
name: 'workPrimaryCategory',
})
export class WorkPrimaryCategoryPipe implements PipeTransform {
transform(
value: WorkPrimaryCategory | null | undefined,
...args: unknown[]
): unknown {
return transformWorkPrimaryCategory(value);
}
}
@@ -58,6 +58,19 @@
}
</ng-template>
<ng-template #classificationTmp let-work>
@let classification = getWorkClassification(work.id);
@if (classification) {
<button type="button" class="cell-filter-pill" matTooltipPosition="above">
{{
classification.classification?.primary_category | workPrimaryCategory
}}
</button>
} @else {
<span class="empty-text">-</span>
}
</ng-template>
<ng-template #authorsTmp let-work>
@let workAuthors = getWorkAuthors(work);
@let workAuthorsExpanded = isWorkAuthorsExpanded(work);
@@ -1,9 +1,11 @@
import {
Component,
computed,
effect,
inject,
input,
OnInit,
signal,
TemplateRef,
viewChild,
} from '@angular/core';
@@ -16,6 +18,8 @@ import {
InseWorksV2ModelWorkPage,
Institution,
Work,
WorkClassification,
WorksV2Service,
WorkTopic,
} from '../../../api';
import { TopicChipComponent } from '../topic-chip/topic-chip.component';
@@ -29,6 +33,7 @@ import { MatTooltipModule } from '@angular/material/tooltip';
import { topicHierarchyColor } from '../../../resolvers/utils/topic-colors';
import { MatButtonModule } from '@angular/material/button';
import { workQueryParamKeys } from '../../../resolvers/work-page.resolver';
import { WorkPrimaryCategoryPipe } from '../../pipes/work-primary-category.pipe';
@Component({
selector: 'app-publication-table',
@@ -42,6 +47,7 @@ import { workQueryParamKeys } from '../../../resolvers/work-page.resolver';
ChipComponent,
WorkTypePipe,
LanguageCodePipe,
WorkPrimaryCategoryPipe,
],
templateUrl: './publication-table.component.html',
styleUrl: './publication-table.component.scss',
@@ -59,6 +65,7 @@ export class PublicationTableComponent implements OnInit {
typeTmp = viewChild.required<TemplateRef<any>>('typeTmp');
yearTmp = viewChild.required<TemplateRef<any>>('yearTmp');
languageTmp = viewChild.required<TemplateRef<any>>('languageTmp');
classificationTmp = viewChild.required<TemplateRef<any>>('classificationTmp');
authorsTmp = viewChild.required<TemplateRef<any>>('authorsTmp');
institutionsTmp = viewChild.required<TemplateRef<any>>('institutionsTmp');
topicsTmp = viewChild.required<TemplateRef<any>>('topicsTmp');
@@ -126,12 +133,19 @@ export class PublicationTableComponent implements OnInit {
accessorKey: 'language',
cellTemplate: this.languageTmp(),
},
{
id: 'classification',
header: 'Klassifikation',
type: 'display',
cellTemplate: this.classificationTmp(),
},
{
id: 'authors',
header: 'Autoren',
type: 'display',
cellTemplate: this.authorsTmp(),
},
{
id: 'institutions',
header: 'Institutionen',
@@ -161,6 +175,36 @@ export class PublicationTableComponent implements OnInit {
];
}
workIds = computed(
() =>
this.elements()
.map((work) => work.id)
.filter(Boolean) as string[],
);
workClassifications = signal<WorkClassification[]>([]);
getWorkClassification(workId: string): WorkClassification | undefined {
return this.workClassifications().find(
(classification) => classification.work_id === workId,
);
}
constructor(private readonly worksV2Service: WorksV2Service) {
effect(() => {
const ids = this.workIds();
if (ids.length > 0) {
this.worksV2Service
.getWorkClassificationsByWorkIds(ids)
.subscribe((classificationPage) => {
this.workClassifications.set(classificationPage.elements ?? []);
});
} else {
this.workClassifications.set([]);
}
});
}
isTypeActive(type: string): boolean {
return this.selectedTypesQueryParams().includes(type);
}