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

This commit is contained in:
2026-07-13 13:23:39 +02:00
46 changed files with 1415 additions and 166 deletions
@@ -186,7 +186,7 @@ export class AccountComponent {
constructor() {
effect(() => {
this.roles = [this.accountProfile().role];
this.roles = this.accountProfile().roles;
});
}
}
@@ -24,7 +24,7 @@
<mat-form-field appearance="outline">
<mat-label>Rolle</mat-label>
<mat-select formControlName="role">
<mat-select formControlName="roles" multiple>
@for (role of data.roles; track role) {
<mat-option [value]="role">{{ role }}</mat-option>
}
@@ -35,7 +35,7 @@ export interface AccountDialogData {
export interface AccountPayload {
email?: string;
name?: string;
role?: UserRole;
roles?: UserRole[];
organization_id?: string;
password?: string;
deleted?: boolean;
@@ -45,7 +45,7 @@ export interface AccountPayload {
export interface CreateAccountPayload {
email: string;
name: string;
role: UserRole;
roles: UserRole[];
organization_id: string;
password: string;
}
@@ -85,7 +85,7 @@ export class AccountDialogComponent {
name: new FormControl<string>(this.data.account?.name ?? '', [
Validators.required,
]),
role: new FormControl<UserRole>(this.data.account?.role ?? 'USER', [
roles: new FormControl<UserRole[]>(this.data.account?.roles ?? ['USER'], [
Validators.required,
]),
organizationId: new FormControl<string>(
@@ -115,7 +115,7 @@ export class AccountDialogComponent {
payload: {
email: value.email ?? '',
name: value.name ?? '',
role: value.role ?? 'USER',
roles: value.roles ?? ['USER'],
organization_id: value.organizationId ?? '',
password: value.password ?? '',
},
@@ -128,7 +128,7 @@ export class AccountDialogComponent {
const email = (value.email ?? '').trim();
const name = (value.name ?? '').trim();
const role = value.role ?? account.role;
const roles = value.roles ?? account.roles;
const organizationId = value.organizationId ?? account.organization_id;
const password = value.password?.trim() ?? '';
@@ -140,8 +140,8 @@ export class AccountDialogComponent {
payload.name = name;
}
if (role !== account.role) {
payload.role = role;
if (!this.sameRoles(roles, account.roles)) {
payload.roles = roles;
}
if (password) {
@@ -166,4 +166,10 @@ export class AccountDialogComponent {
protected close(): void {
this.dialogRef.close();
}
private sameRoles(left: UserRole[], right: UserRole[]): boolean {
return (
left.length === right.length && left.every((role) => right.includes(role))
);
}
}
@@ -44,7 +44,9 @@
</section>
<ng-template #accountRoleTmp let-row>
<span class="role">{{ row.role | role }}</span>
@for (role of row.roles; track role) {
<span class="role">{{ role | role }}</span>
}
</ng-template>
<ng-template #accountStatusTmp let-row>
@@ -126,10 +126,10 @@ export class AccountsComponent implements OnInit {
accessorKey: 'organization_name',
},
{
id: 'role',
id: 'roles',
header: 'Rolle',
type: 'accessor',
accessorKey: 'role',
accessorKey: 'roles',
cellTemplate: this.accountRoleTmp(),
},
{
@@ -325,7 +325,22 @@ export class AccountsComponent implements OnInit {
return (
this.credentialService.isEffectiveAdmin() &&
(account.role === 'MANAGER' || account.role === 'USER')
(this.effectiveRole(account) === 'MANAGER' ||
this.effectiveRole(account) === 'USER')
);
}
protected effectiveRole(account: AccountProfile): UserRole {
const roles = account.roles;
if (roles.includes('SUPER_ADMIN')) {
return 'SUPER_ADMIN';
}
if (roles.includes('ADMIN')) {
return 'ADMIN';
}
if (roles.includes('MANAGER')) {
return 'MANAGER';
}
return 'USER';
}
}
@@ -43,25 +43,25 @@
</mat-card>
<div class="funding-info-cards">
<app-person-network-info-card
<app-info-card
[description]="'Gesamte Förderung durch Bund'"
[value]="
(bundTotalFunding()
| currency: 'EUR' : 'symbol' : '1.0-0' : 'de') ?? undefined
" />
<app-person-network-info-card
<app-info-card
[description]="'Durchschnittliche jährliche Förderung durch Bund'"
[value]="
(bundAverageAnnualFunding()
| currency: 'EUR' : 'symbol' : '1.0-0' : 'de') ?? undefined
" />
<app-person-network-info-card
<app-info-card
[description]="'Gesamte Förderung durch die Europäische Union'"
[value]="
(euTotalFunding() | currency: 'EUR' : 'symbol' : '1.0-0' : 'de') ??
undefined
" />
<app-person-network-info-card
<app-info-card
[description]="'Durchschnittliche jährliche Förderung durch die Europäische Union'"
[value]="
(euAverageAnnualFunding()
@@ -24,7 +24,7 @@ mat-paginator {
flex-direction: row;
gap: 1rem;
app-person-network-info-card {
app-info-card {
width: 100%;
height: 100%;
}
@@ -29,7 +29,7 @@ import { toSignal } from '@angular/core/rxjs-interop';
import { MatIconModule } from '@angular/material/icon';
import { MatButtonModule } from '@angular/material/button';
import { InstitutionProjectsFundingGraphComponent } from '../institution-projects-funding-graph/institution-projects-funding-graph.component';
import { PersonNetworkInfoCardComponent } from '../person-network-info-card/person-network-info-card.component';
import { AppInfoCardComponent } from '../../shared/ui/app-info-card/app-info-card.component';
import { QueryParamPaginatorComponent } from '../../shared/ui/query-param-paginator/query-param-paginator.component';
import { QueryParamInputComponent } from '../../shared/ui/query-param-input/query-param-input.component';
@@ -64,7 +64,7 @@ type EuProjectRow = {
MatIconModule,
MatButtonModule,
InstitutionProjectsFundingGraphComponent,
PersonNetworkInfoCardComponent,
AppInfoCardComponent,
RouterModule,
QueryParamPaginatorComponent,
QueryParamInputComponent,
@@ -1,9 +0,0 @@
<mat-card appearance="outlined" class="info-card">
<mat-card-content>
<mat-icon>{{ icon() }}</mat-icon>
<div>
<span class="number">{{ value() }}</span>
<span class="description">{{ description() }}</span>
</div>
</mat-card-content>
</mat-card>
@@ -1,34 +0,0 @@
.info-card {
--info-card-icon-size: 40px;
background-color: var(--sg-background);
padding: 10px 20px;
}
.info-card mat-card-content {
display: flex;
align-items: start;
gap: 10px;
}
.info-card mat-icon {
width: var(--info-card-icon-size);
height: var(--info-card-icon-size);
font-size: var(--info-card-icon-size);
color: var(--sg-blue-highlight);
}
.info-card div {
display: flex;
flex-direction: column;
gap: 4px;
}
.info-card .number {
font-weight: var(--sg-default-bold-weight);
font-size: 1.5em;
}
.info-card .description {
color: var(--sg-text-muted);
font-size: 0.9em;
}
@@ -1,15 +0,0 @@
import { Component, input } from '@angular/core';
import { MatCardModule } from '@angular/material/card';
import { MatIconModule } from '@angular/material/icon';
@Component({
selector: 'app-person-network-info-card',
imports: [MatIconModule, MatCardModule],
templateUrl: './person-network-info-card.component.html',
styleUrl: './person-network-info-card.component.scss',
})
export class PersonNetworkInfoCardComponent {
readonly icon = input<string>();
readonly value = input<string>();
readonly description = input<string>();
}
@@ -79,7 +79,7 @@
<div class="summary-container">
@for (summary of this.summaryCards(); track $index) {
<app-person-network-info-card
<app-info-card
[icon]="summary.icon"
[value]="summary.value.toString()"
[description]="summary.description" />
@@ -47,7 +47,7 @@ form > div > mat-button-toggle-group {
gap: 20px;
}
.summary-container app-person-network-info-card {
.summary-container app-info-card {
flex: 1 1 0;
}
@@ -37,7 +37,7 @@ import { MatSelectModule } from '@angular/material/select';
import { MatExpansionModule } from '@angular/material/expansion';
import { MatDialog, MatDialogModule } from '@angular/material/dialog';
import { PersonNetworkFilterDialogComponent } from '../person-network-filter-dialog/person-network-filter-dialog.component';
import { PersonNetworkInfoCardComponent } from '../person-network-info-card/person-network-info-card.component';
import { AppInfoCardComponent } from '../../shared/ui/app-info-card/app-info-card.component';
import {
GenericColumn,
DataTableComponent,
@@ -95,7 +95,7 @@ type IInstitution = {
MatSelectModule,
MatExpansionModule,
MatDialogModule,
PersonNetworkInfoCardComponent,
AppInfoCardComponent,
DataTableComponent,
],
templateUrl: './person-network.component.html',
@@ -7,16 +7,38 @@
<mat-expansion-panel class="mat-elevation-z1">
<mat-expansion-panel-header>
<mat-panel-title>Forschungszwecke</mat-panel-title>
<mat-panel-description
>{{ foundationAmount() }} Grundlagenforschung,
{{ applicationAmount() }} anwendungsbasierte
Forschung</mat-panel-description
>
</mat-expansion-panel-header>
@if (this.authorWorkPurposes().purposes?.length === 0) {
<div class="no-results">
Keine klassifizierten Publikationen gefunden.
</div>
} @else {
<div
echarts
[options]="chartOption"
style="height: 300px; width: 100%"></div>
}
<div
echarts
[options]="chartOption"
style="height: 300px; width: 100%"></div>
style="
width: 100%;
display: flex;
gap: 1rem;
flex-wrap: wrap;
margin-top: 1rem;
">
<app-info-card
[value]="this.basicResearchAmount() + ''"
description="Grundlagenforschung" />
<app-info-card
[value]="this.appliedResearchAmount() + ''"
description="Anwendungsbasierte Forschung" />
<app-info-card
[value]="this.nonResearchAmount() + ''"
description="Nicht-forschende Tätigkeit" />
<app-info-card
[value]="this.experimentalDevelopmentAmount() + ''"
description="Experimentelle Entwicklung" />
</div>
</mat-expansion-panel>
<mat-expansion-panel class="mat-elevation-z1" [expanded]="true">
<mat-expansion-panel-header>
@@ -11,18 +11,14 @@ import {
viewChild,
} from '@angular/core';
import { HttpClient, HttpParams } from '@angular/common/http';
import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
import { ActivatedRoute, ParamMap, Router, RouterLink } from '@angular/router';
import { FormControl, ReactiveFormsModule } from '@angular/forms';
import { ActivatedRoute, Router, RouterLink } from '@angular/router';
import {
MatAutocompleteModule,
MatAutocompleteSelectedEvent,
} from '@angular/material/autocomplete';
import { MatIconModule } from '@angular/material/icon';
import {
MatPaginator,
MatPaginatorModule,
PageEvent,
} from '@angular/material/paginator';
import { MatPaginator, MatPaginatorModule } from '@angular/material/paginator';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar';
import { MatTableModule } from '@angular/material/table';
@@ -34,7 +30,6 @@ import { MatTooltipModule } from '@angular/material/tooltip';
import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';
import {
catchError,
combineLatest,
debounceTime,
distinctUntilChanged,
finalize,
@@ -78,6 +73,7 @@ import {
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';
import { AppInfoCardComponent } from '../../shared/ui/app-info-card/app-info-card.component';
echarts.use([
GridComponent,
CanvasRenderer,
@@ -114,17 +110,25 @@ interface TopicAutocompleteResponse {
results?: TopicAutocompleteOption[] | null;
}
type PublicationSort = 'year' | 'citations';
interface YearlyPurposeCounts {
year: number;
FOUNDATION: number;
APPLICATION: number;
basicResearch: number;
appliedResearch: number;
nonResearch: number;
experimentalDevelopment: number;
}
const PURPOSE_LABELS: Record<'FOUNDATION' | 'APPLICATION', string> = {
FOUNDATION: 'Grundlagenforschung',
APPLICATION: 'anwendungsbasierte Forschung',
const PURPOSE_LABELS: Record<
| 'BASIC_RESEARCH'
| 'APPLIED_RESEARCH'
| 'NON_RESEARCH'
| 'EXPERIMENTAL_DEVELOPMENT',
string
> = {
BASIC_RESEARCH: 'Grundlagenforschung',
APPLIED_RESEARCH: 'anwendungsbasierte Forschung',
NON_RESEARCH: 'nicht-forschende Tätigkeit',
EXPERIMENTAL_DEVELOPMENT: 'experimentelle Entwicklung',
};
@Component({
selector: 'app-person-publications',
@@ -151,12 +155,12 @@ const PURPOSE_LABELS: Record<'FOUNDATION' | 'APPLICATION', string> = {
WorkTypePipe,
LanguageCodePipe,
QueryParamPaginatorComponent,
AppInfoCardComponent,
],
templateUrl: './person-publications.component.html',
styleUrl: './person-publications.component.scss',
})
export class PersonPublicationsComponent implements OnInit {
@ViewChild(MatPaginator) paginator?: MatPaginator;
private readonly destroyRef = inject(DestroyRef);
private readonly worksService = inject(WorksService);
@@ -173,26 +177,43 @@ export class PersonPublicationsComponent implements OnInit {
const authorWorkPurposes = this.authorWorkPurposes();
return this.getAuthorSpecificWorkPurposesByYear(authorWorkPurposes);
});
foundationAmount = computed(() => {
const authorWorkPurposes = this.authorWorkPurposes();
basicResearchAmount = computed(() => {
return this.countPurpose(
this.authorWorkPurposes().purposes || [],
WorkPurpose.BasicResearch,
);
});
appliedResearchAmount = computed(() => {
return this.countPurpose(
this.authorWorkPurposes().purposes || [],
WorkPurpose.AppliedResearch,
);
});
nonResearchAmount = computed(() => {
return this.countPurpose(
this.authorWorkPurposes().purposes || [],
WorkPurpose.NonResearch,
);
});
experimentalDevelopmentAmount = computed(() => {
return this.countPurpose(
this.authorWorkPurposes().purposes || [],
WorkPurpose.ExperimentalDevelopment,
);
});
countPurpose = (
specificWorkPurposes: SpecificWorkPurpose[],
purpose: WorkPurpose,
) => {
let count = 0;
for (const purpose of authorWorkPurposes.purposes ?? []) {
if (purpose.purpose === WorkPurpose.Foundation) {
for (const specificWorkPurpose of specificWorkPurposes) {
if (specificWorkPurpose.purpose == purpose) {
count++;
}
}
return count;
});
applicationAmount = computed(() => {
const authorWorkPurposes = this.authorWorkPurposes();
let count = 0;
for (const purpose of authorWorkPurposes.purposes ?? []) {
if (purpose.purpose === WorkPurpose.Application) {
count++;
}
}
return count;
});
};
chartOption!: echarts.EChartsCoreOption;
@@ -223,9 +244,6 @@ export class PersonPublicationsComponent implements OnInit {
readonly yearSearchControl = new FormControl('', { nonNullable: true });
readonly typeSearchControl = new FormControl('', { nonNullable: true });
readonly languageSearchControl = new FormControl('', { nonNullable: true });
readonly sortControl = new FormControl<PublicationSort>('year', {
nonNullable: true,
});
readonly publicationYearOptions = this.createPublicationYearOptions();
@@ -379,14 +397,20 @@ export class PersonPublicationsComponent implements OnInit {
.map(([year, purposes]) => {
const counts: YearlyPurposeCounts = {
year: Number(year),
FOUNDATION: 0,
APPLICATION: 0,
basicResearch: 0,
appliedResearch: 0,
nonResearch: 0,
experimentalDevelopment: 0,
};
for (const purpose of purposes) {
if (purpose.purpose === WorkPurpose.Foundation) {
counts.FOUNDATION++;
} else if (purpose.purpose === WorkPurpose.Application) {
counts.APPLICATION++;
if (purpose.purpose == WorkPurpose.BasicResearch) {
counts.basicResearch++;
} else if (purpose.purpose == WorkPurpose.AppliedResearch) {
counts.appliedResearch++;
} else if (purpose.purpose == WorkPurpose.NonResearch) {
counts.nonResearch++;
} else if (purpose.purpose == WorkPurpose.ExperimentalDevelopment) {
counts.experimentalDevelopment++;
}
}
return counts;
@@ -398,15 +422,20 @@ export class PersonPublicationsComponent implements OnInit {
return {
tooltip: { trigger: 'axis', axisPointer: { type: 'shadow' } },
legend: {
data: [PURPOSE_LABELS.FOUNDATION, PURPOSE_LABELS.APPLICATION],
top: 0,
data: [
PURPOSE_LABELS.BASIC_RESEARCH,
PURPOSE_LABELS.APPLIED_RESEARCH,
PURPOSE_LABELS.NON_RESEARCH,
PURPOSE_LABELS.EXPERIMENTAL_DEVELOPMENT,
],
bottom: 0,
itemGap: 40,
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
top: '10%',
bottom: '10%',
top: '3%',
containLabel: true,
},
xAxis: {
@@ -416,18 +445,32 @@ export class PersonPublicationsComponent implements OnInit {
yAxis: { type: 'value' },
series: [
{
name: PURPOSE_LABELS.FOUNDATION,
name: PURPOSE_LABELS.BASIC_RESEARCH,
type: 'bar',
stack: 'total',
emphasis: { focus: 'series' },
data: data.map((d) => d.FOUNDATION),
data: data.map((d) => d.basicResearch),
},
{
name: PURPOSE_LABELS.APPLICATION,
name: PURPOSE_LABELS.APPLIED_RESEARCH,
type: 'bar',
stack: 'total',
emphasis: { focus: 'series' },
data: data.map((d) => d.APPLICATION),
data: data.map((d) => d.appliedResearch),
},
{
name: PURPOSE_LABELS.NON_RESEARCH,
type: 'bar',
stack: 'total',
emphasis: { focus: 'series' },
data: data.map((d) => d.nonResearch),
},
{
name: PURPOSE_LABELS.EXPERIMENTAL_DEVELOPMENT,
type: 'bar',
stack: 'total',
emphasis: { focus: 'series' },
data: data.map((d) => d.experimentalDevelopment),
},
],
};