diff --git a/webapp/src/app/app.config.ts b/webapp/src/app/app.config.ts
index 7aaeef9e..89c90655 100644
--- a/webapp/src/app/app.config.ts
+++ b/webapp/src/app/app.config.ts
@@ -1,5 +1,11 @@
-import { ApplicationConfig, LOCALE_ID } from '@angular/core';
-import { provideRouter } from '@angular/router';
+import { ApplicationConfig, inject, LOCALE_ID } from '@angular/core';
+import {
+ NavigationError,
+ provideRouter,
+ Router,
+ withComponentInputBinding,
+ withNavigationErrorHandler,
+} from '@angular/router';
import { routes } from './app.routes';
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
@@ -22,7 +28,19 @@ export const appConfig: ApplicationConfig = {
useValue: { appearance: 'outline' },
},
{ provide: MatPaginatorIntl, useClass: PaginatorIntl },
- provideRouter(routes),
+ provideRouter(
+ routes,
+ withComponentInputBinding(),
+ withNavigationErrorHandler((error) => {
+ const router = inject(Router);
+
+ if (error) {
+ console.error('Navigation error occurred:', error);
+ }
+
+ router.navigate(['/error']);
+ }),
+ ),
provideHttpClient(withInterceptors([authenticationInterceptor])),
// provideApi('/inse-service'),
provideAnimationsAsync(),
diff --git a/webapp/src/app/app.routes.ts b/webapp/src/app/app.routes.ts
index ed9c7421..675d87a8 100644
--- a/webapp/src/app/app.routes.ts
+++ b/webapp/src/app/app.routes.ts
@@ -191,6 +191,13 @@ export const routes: Routes = [
);
},
},
+ {
+ path: 'error',
+ loadComponent: () =>
+ import('./modules/error-page/error-page.component').then(
+ (mod) => mod.ErrorPageComponent,
+ ),
+ },
{
path: '**',
redirectTo: 'login',
diff --git a/webapp/src/app/modules/error-page/error-page.component.html b/webapp/src/app/modules/error-page/error-page.component.html
new file mode 100644
index 00000000..7e9d75af
--- /dev/null
+++ b/webapp/src/app/modules/error-page/error-page.component.html
@@ -0,0 +1 @@
+
error-page works!
diff --git a/webapp/src/app/modules/error-page/error-page.component.scss b/webapp/src/app/modules/error-page/error-page.component.scss
new file mode 100644
index 00000000..e69de29b
diff --git a/webapp/src/app/modules/error-page/error-page.component.ts b/webapp/src/app/modules/error-page/error-page.component.ts
new file mode 100644
index 00000000..eaf0c9ba
--- /dev/null
+++ b/webapp/src/app/modules/error-page/error-page.component.ts
@@ -0,0 +1,11 @@
+import { Component } from '@angular/core';
+
+@Component({
+ selector: 'app-error-page',
+ imports: [],
+ templateUrl: './error-page.component.html',
+ styleUrl: './error-page.component.scss',
+})
+export class ErrorPageComponent {
+
+}
diff --git a/webapp/src/app/modules/institution-projects/institution-projects.component.ts b/webapp/src/app/modules/institution-projects/institution-projects.component.ts
index 662a5c75..b5218f2a 100644
--- a/webapp/src/app/modules/institution-projects/institution-projects.component.ts
+++ b/webapp/src/app/modules/institution-projects/institution-projects.component.ts
@@ -2,6 +2,7 @@ import {
Component,
computed,
effect,
+ input,
OnInit,
signal,
TemplateRef,
@@ -70,11 +71,11 @@ export class InstitutionProjectsComponent implements OnInit {
fundingEndTmp = viewChild.required>('fundingEndTmp');
grantAmountTmp = viewChild.required>('grantAmountTmp');
- euProjectPage = signal(null);
+ euProjectPage = input.required();
euProjectColumns: GenericColumn[] = [];
euProjectData: EuProjectRow[] = [];
- bundProjectPage = signal(null);
+ bundProjectPage = input.required();
bundProjectColumns: GenericColumn[] = [];
bundProjectData: BundProjectRow[] = [];
@@ -86,11 +87,6 @@ export class InstitutionProjectsComponent implements OnInit {
private readonly activatedRoute: ActivatedRoute,
private readonly router: Router,
) {
- this.activatedRoute.data.subscribe((data) => {
- this.euProjectPage.set(data['euProjectPage']);
- this.bundProjectPage.set(data['bundProjectPage']);
- });
-
this.activatedRoute.queryParams
.pipe(takeUntilDestroyed())
.subscribe((params) => {
diff --git a/webapp/src/app/modules/person-network-collaborators/person-network-collaborators.component.html b/webapp/src/app/modules/person-network-collaborators/person-network-collaborators.component.html
deleted file mode 100644
index 0c95379c..00000000
--- a/webapp/src/app/modules/person-network-collaborators/person-network-collaborators.component.html
+++ /dev/null
@@ -1,52 +0,0 @@
-
-
-
- | Name |
-
- {{ element.name }}
- |
-
-
- Häufigkeit |
-
- {{ element.works.length }}
- |
-
-
- |
-
-
- open_in_new
-
- |
-
-
-
-
-
-
-@if (dataSource.filteredData.length === 0) {
- Keine Kollaborierenden gefunden.
-}
-
-
-
-
diff --git a/webapp/src/app/modules/person-network-collaborators/person-network-collaborators.component.scss b/webapp/src/app/modules/person-network-collaborators/person-network-collaborators.component.scss
deleted file mode 100644
index 4dfb4f9e..00000000
--- a/webapp/src/app/modules/person-network-collaborators/person-network-collaborators.component.scss
+++ /dev/null
@@ -1,38 +0,0 @@
-.table {
- overflow: auto;
- width: 100%;
- max-height: 100%;
-}
-
-.mat-mdc-table {
- background-color: var(--sg-background);
-}
-
-.element-row {
- position: relative;
-}
-
-.element-row:not(.expanded) {
- cursor: pointer;
-}
-
-.element-row:not(.expanded):hover {
- background: #f5f5f5;
-}
-
-.element-row.expanded {
- border-bottom-color: transparent;
-}
-
-.detail-row {
- width: 100%;
-}
-
-.work-link {
- color: var(--sg-primary);
- text-decoration: none;
-
- &:hover {
- text-decoration: underline;
- }
-}
diff --git a/webapp/src/app/modules/person-network-collaborators/person-network-collaborators.component.ts b/webapp/src/app/modules/person-network-collaborators/person-network-collaborators.component.ts
deleted file mode 100644
index f86545d4..00000000
--- a/webapp/src/app/modules/person-network-collaborators/person-network-collaborators.component.ts
+++ /dev/null
@@ -1,156 +0,0 @@
-import {
- AfterViewInit,
- Component,
- input,
- effect,
- ViewChild,
-} from '@angular/core';
-import { CollaborationNetwork } from '../../api';
-import { RouterModule } from '@angular/router';
-
-import { MatTableDataSource, MatTableModule } from '@angular/material/table';
-import { MatButtonModule } from '@angular/material/button';
-import { MatIconModule } from '@angular/material/icon';
-import { MatSort, MatSortModule } from '@angular/material/sort';
-import { CdkDetailRowDirective } from '../../directives/cdk-detail-row.directive';
-
-type Work = {
- id: string;
- title: string;
-};
-
-type Collaborator = {
- id: string;
- name: string;
- category: string;
- works: Work[];
-};
-
-@Component({
- selector: 'app-person-network-collaborators',
- imports: [
- MatTableModule,
- MatIconModule,
- MatSortModule,
- MatButtonModule,
- RouterModule,
- CdkDetailRowDirective,
- ],
- templateUrl: './person-network-collaborators.component.html',
- styleUrl: './person-network-collaborators.component.scss',
-})
-export class PersonNetworkCollaboratorsComponent implements AfterViewInit {
- collaborationNetwork = input.required();
- searchTerm = input.required();
-
- displayedColumns: string[] = ['name', 'count', 'actions'];
-
- dataSource = new MatTableDataSource();
-
- trackBy = (index: number, item: Collaborator) => item.id;
-
- @ViewChild(MatSort) sort!: MatSort;
-
- constructor() {
- effect(() => {
- const collaborationNetwork = this.collaborationNetwork();
- this.dataSource = this.buildCollaboratorsDataSource(collaborationNetwork);
- this.dataSource.sortingDataAccessor = (item, property) => {
- if (property === 'count') {
- return item.works.length;
- }
- return (item as Record)[property] as string | number;
- };
- this.dataSource.filterPredicate = (data, filter) => {
- const value = filter.trim().toLowerCase();
- return (
- data.id.toLowerCase().includes(value) ||
- data.name.toLowerCase().includes(value)
- );
- };
- if (this.sort) {
- this.dataSource.sort = this.sort;
- this.setDefaultSort();
- }
- const currentSearchTerm = this.searchTerm().trim().toLowerCase();
- this.dataSource.filter = currentSearchTerm;
- });
-
- effect(() => {
- const searchTerm = this.searchTerm();
- const normalizedTerm = searchTerm.trim().toLowerCase();
- this.dataSource.filter = normalizedTerm;
- });
- }
-
- ngAfterViewInit() {
- this.dataSource.sort = this.sort;
- }
-
- private setDefaultSort(): void {
- this.sort.active = 'name';
- this.sort.direction = 'asc';
- this.sort.sortChange.emit({ active: 'name', direction: 'asc' });
- }
-
- buildCollaboratorsDataSource(
- collaborationNetwork: CollaborationNetwork,
- ): MatTableDataSource {
- // key: collaborator id, value: set of work ids
- const worksByCollaborator: Record> = {};
- // key: work id, value: work
- const works: Record = {};
-
- const allWorks: Record = collaborationNetwork.work_nodes
- .map((node) => ({
- id: node.raw_id,
- title: node.display_name,
- }))
- .reduce(
- (acc, work) => {
- acc[work.id] = work;
- return acc;
- },
- {} as Record,
- );
-
- const allAuthors: Record =
- collaborationNetwork.author_nodes
- .map((node) => ({
- id: node.raw_id,
- name: node.display_name,
- category: node.category,
- works: [],
- }))
- .reduce(
- (acc, author) => {
- acc[author.id] = author;
- return acc;
- },
- {} as Record,
- );
-
- collaborationNetwork.collaboration_edges.forEach((edge) => {
- if (
- edge.raw_source_id.toUpperCase().startsWith('A') &&
- edge.raw_target_id.toUpperCase().startsWith('W')
- ) {
- allAuthors[edge.raw_source_id]?.works.push(
- allWorks[edge.raw_target_id],
- );
- }
- });
-
- Object.values(allAuthors).forEach((author) => {
- author.works.sort((a, b) => a.title.localeCompare(b.title));
- });
-
- return new MatTableDataSource(
- Object.values(allAuthors).filter(
- (author) =>
- author.works.length > 0 &&
- author.id !== collaborationNetwork.raw_person_id,
- ),
- );
- }
-}
diff --git a/webapp/src/app/modules/person-network-institutions/person-network-institutions.component.html b/webapp/src/app/modules/person-network-institutions/person-network-institutions.component.html
deleted file mode 100644
index 39a86dd9..00000000
--- a/webapp/src/app/modules/person-network-institutions/person-network-institutions.component.html
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
-
- | Name |
-
- {{ element.name }}
- |
-
-
- Mitwirkende |
-
- {{ element.collaborators.length }}
- |
-
-
-
-
-
-
-@if (dataSource.filteredData.length === 0) {
- Keine Institutionen gefunden.
-}
-
-
-
- |
-
- |
-
-
diff --git a/webapp/src/app/modules/person-network-institutions/person-network-institutions.component.scss b/webapp/src/app/modules/person-network-institutions/person-network-institutions.component.scss
deleted file mode 100644
index 7cb09d57..00000000
--- a/webapp/src/app/modules/person-network-institutions/person-network-institutions.component.scss
+++ /dev/null
@@ -1,38 +0,0 @@
-.table {
- overflow: auto;
- width: 100%;
- max-height: 100%;
-}
-
-.mat-mdc-table {
- background-color: var(--sg-background);
-}
-
-.element-row {
- position: relative;
-}
-
-.element-row:not(.expanded) {
- cursor: pointer;
-}
-
-.element-row:not(.expanded):hover {
- background: #f5f5f5;
-}
-
-.element-row.expanded {
- border-bottom-color: transparent;
-}
-
-.detail-row {
- width: 100%;
-}
-
-.person-link {
- color: var(--sg-primary);
- text-decoration: none;
-
- &:hover {
- text-decoration: underline;
- }
-}
diff --git a/webapp/src/app/modules/person-network-institutions/person-network-institutions.component.ts b/webapp/src/app/modules/person-network-institutions/person-network-institutions.component.ts
deleted file mode 100644
index c992a06e..00000000
--- a/webapp/src/app/modules/person-network-institutions/person-network-institutions.component.ts
+++ /dev/null
@@ -1,124 +0,0 @@
-import {
- AfterViewInit,
- Component,
- effect,
- input,
- ViewChild,
-} from '@angular/core';
-import { CollaborationNetwork } from '../../api';
-import { MatTableDataSource, MatTableModule } from '@angular/material/table';
-import { MatSort, MatSortModule } from '@angular/material/sort';
-import { MatIconModule } from '@angular/material/icon';
-import { RouterModule } from '@angular/router';
-import { CdkDetailRowDirective } from '../../directives/cdk-detail-row.directive';
-import { MatButtonModule } from '@angular/material/button';
-
-type Collaborator = {
- id: string;
- name: string;
-};
-
-type Institution = {
- id: string;
- name: string;
- collaborators: Collaborator[];
-};
-
-@Component({
- selector: 'app-person-network-institutions',
- imports: [
- MatTableModule,
- MatIconModule,
- MatSortModule,
- RouterModule,
- CdkDetailRowDirective,
- MatButtonModule,
- ],
- templateUrl: './person-network-institutions.component.html',
- styleUrl: './person-network-institutions.component.scss',
-})
-export class PersonNetworkInstitutionsComponent implements AfterViewInit {
- collaborationNetwork = input.required();
- searchTerm = input.required();
-
- displayedColumns: string[] = ['name', 'collaborators'];
-
- dataSource = new MatTableDataSource();
-
- trackBy = (index: number, item: Institution) => item.id;
-
- @ViewChild(MatSort) sort!: MatSort;
-
- constructor() {
- effect(() => {
- const collaborationNetwork = this.collaborationNetwork();
- if (!collaborationNetwork) {
- return;
- }
-
- this.dataSource = this.buildInstitutionsDataSource(collaborationNetwork);
- this.dataSource.sortingDataAccessor = (item, property) => {
- if (property === 'collaborators') {
- return item.collaborators.length;
- }
- return (item as any)[property];
- };
- if (this.sort) {
- this.dataSource.sort = this.sort;
- this.setDefaultSort();
- }
- });
-
- effect(() => {
- const searchTerm = this.searchTerm().toLowerCase();
- this.dataSource.filter = searchTerm;
- });
- }
-
- ngAfterViewInit() {
- if (this.sort) {
- this.dataSource.sort = this.sort;
- }
- }
-
- private setDefaultSort(): void {
- this.sort.active = 'name';
- this.sort.direction = 'asc';
- this.sort.sortChange.emit({ active: 'name', direction: 'asc' });
- }
-
- buildInstitutionsDataSource(
- collaborationNetwork: CollaborationNetwork,
- ): MatTableDataSource {
- const institutionsMap: Record = {};
-
- for (const node of collaborationNetwork.institution_nodes) {
- institutionsMap[node.raw_id] = {
- id: node.raw_id,
- name: node.display_name,
- collaborators: [],
- };
- }
-
- for (const edge of collaborationNetwork.collaboration_edges) {
- if (edge.raw_target_id in institutionsMap) {
- const institution = institutionsMap[edge.raw_target_id];
- institution.collaborators.push({
- id: edge.raw_source_id,
- name:
- collaborationNetwork.author_nodes.find(
- (node) => node.raw_id === edge.raw_source_id,
- )?.display_name || 'Unbekannt',
- });
- }
- }
-
- for (const institution of Object.values(institutionsMap)) {
- institution.collaborators.sort((a, b) =>
- a.name.localeCompare(b.name, 'de', { sensitivity: 'base' }),
- );
- }
-
- return new MatTableDataSource(Object.values(institutionsMap));
- }
-}
diff --git a/webapp/src/app/modules/person-network-publications/person-network-publications.component.html b/webapp/src/app/modules/person-network-publications/person-network-publications.component.html
deleted file mode 100644
index 83bcc41c..00000000
--- a/webapp/src/app/modules/person-network-publications/person-network-publications.component.html
+++ /dev/null
@@ -1,54 +0,0 @@
-
-
-
- | Titel |
-
- {{ element.title }}
- |
-
-
- Mitwirkende |
-
- {{ element.collaborators.length }}
- |
-
-
- |
-
-
- open_in_new
-
- |
-
-
-
-
-
-
-@if (dataSource.filteredData.length === 0) {
- Keine Publikationen gefunden.
-}
-
-
-
- |
-
- |
-
-
diff --git a/webapp/src/app/modules/person-network-publications/person-network-publications.component.scss b/webapp/src/app/modules/person-network-publications/person-network-publications.component.scss
deleted file mode 100644
index 7cb09d57..00000000
--- a/webapp/src/app/modules/person-network-publications/person-network-publications.component.scss
+++ /dev/null
@@ -1,38 +0,0 @@
-.table {
- overflow: auto;
- width: 100%;
- max-height: 100%;
-}
-
-.mat-mdc-table {
- background-color: var(--sg-background);
-}
-
-.element-row {
- position: relative;
-}
-
-.element-row:not(.expanded) {
- cursor: pointer;
-}
-
-.element-row:not(.expanded):hover {
- background: #f5f5f5;
-}
-
-.element-row.expanded {
- border-bottom-color: transparent;
-}
-
-.detail-row {
- width: 100%;
-}
-
-.person-link {
- color: var(--sg-primary);
- text-decoration: none;
-
- &:hover {
- text-decoration: underline;
- }
-}
diff --git a/webapp/src/app/modules/person-network-publications/person-network-publications.component.ts b/webapp/src/app/modules/person-network-publications/person-network-publications.component.ts
deleted file mode 100644
index c4c08016..00000000
--- a/webapp/src/app/modules/person-network-publications/person-network-publications.component.ts
+++ /dev/null
@@ -1,144 +0,0 @@
-import {
- AfterViewInit,
- Component,
- input,
- effect,
- ViewChild,
-} from '@angular/core';
-import { CollaborationNetwork } from '../../api';
-import { RouterModule } from '@angular/router';
-
-import { MatTableDataSource, MatTableModule } from '@angular/material/table';
-import { MatButtonModule } from '@angular/material/button';
-import { MatIconModule } from '@angular/material/icon';
-import { MatSort, MatSortModule } from '@angular/material/sort';
-import { CdkDetailRowDirective } from '../../directives/cdk-detail-row.directive';
-
-type Collaborator = {
- id: string;
- name: string;
- category: string;
-};
-
-type Work = {
- id: string;
- title: string;
- collaborators: Collaborator[];
-};
-
-@Component({
- selector: 'app-person-network-publications',
- imports: [
- MatTableModule,
- MatIconModule,
- MatSortModule,
- RouterModule,
- CdkDetailRowDirective,
- MatButtonModule,
- ],
- templateUrl: './person-network-publications.component.html',
- styleUrl: './person-network-publications.component.scss',
-})
-export class PersonNetworkPublicationsComponent implements AfterViewInit {
- collaborationNetwork = input.required();
- searchTerm = input.required();
-
- displayedColumns: string[] = ['title', 'contributors', 'actions'];
-
- dataSource = new MatTableDataSource();
-
- trackBy = (index: number, item: Work) => item.id;
-
- @ViewChild(MatSort) sort!: MatSort;
-
- constructor() {
- effect(() => {
- const collaborationNetwork = this.collaborationNetwork();
- if (!collaborationNetwork) {
- return;
- }
-
- this.dataSource = this.buildWorksDataSource(collaborationNetwork);
- this.dataSource.sortingDataAccessor = (item, property) => {
- if (property === 'contributors') {
- return item.collaborators.length;
- }
- return (item as Record)[property] as string | number;
- };
- if (this.sort) {
- this.dataSource.sort = this.sort;
- this.setDefaultSort();
- }
- });
-
- effect(() => {
- const searchTerm = this.searchTerm();
- this.dataSource.filter = searchTerm.trim().toLowerCase();
- });
- }
-
- ngAfterViewInit() {
- this.dataSource.sort = this.sort;
- }
-
- private setDefaultSort(): void {
- this.sort.active = 'title';
- this.sort.direction = 'asc';
- this.sort.sortChange.emit({ active: 'title', direction: 'asc' });
- }
-
- buildWorksDataSource(
- collaborationNetwork: CollaborationNetwork,
- ): MatTableDataSource {
- const allWorks: Record = collaborationNetwork.work_nodes
- .map((node) => ({
- id: node.raw_id,
- title: node.display_name,
- collaborators: [],
- }))
- .reduce(
- (acc, work) => {
- acc[work.id] = work;
- return acc;
- },
- {} as Record,
- );
-
- const allAuthors: Record =
- collaborationNetwork.author_nodes
- .map((node) => ({
- id: node.raw_id,
- name: node.display_name,
- category:
- node.raw_id === collaborationNetwork.raw_person_id
- ? 'author'
- : 'collaborator',
- }))
- .reduce(
- (acc, person) => {
- acc[person.id] = person;
- return acc;
- },
- {} as Record,
- );
-
- collaborationNetwork.collaboration_edges.forEach((edge) => {
- if (
- edge.raw_source_id.toUpperCase().startsWith('A') &&
- edge.raw_target_id.toUpperCase().startsWith('W')
- ) {
- allWorks[edge.raw_target_id]?.collaborators.push(
- allAuthors[edge.raw_source_id],
- );
- }
- });
-
- Object.values(allWorks).forEach((work) => {
- work.collaborators.sort((a, b) => a.name.localeCompare(b.name));
- });
-
- return new MatTableDataSource(
- Object.values(allWorks).filter((work) => work.collaborators.length > 0),
- );
- }
-}
diff --git a/webapp/src/app/modules/person-network/person-network.component.html b/webapp/src/app/modules/person-network/person-network.component.html
index 5da3bb31..f6a27bce 100644
--- a/webapp/src/app/modules/person-network/person-network.component.html
+++ b/webapp/src/app/modules/person-network/person-network.component.html
@@ -6,7 +6,7 @@
@@ -51,17 +51,26 @@
@if (this.displayedTable() === 'collaborators') {
-
+
} @else if (this.displayedTable() === 'publications') {
-
+
} @else if (this.displayedTable() === 'institutions') {
-
+
}
@@ -77,3 +86,81 @@
}
+
+
+
+ open_in_new
+
+
+
+
+ {{ element.works.length }}
+
+
+
+
+
+
+
+
+ open_in_new
+
+
+
+
+ {{ element.collaborators.length }}
+
+
+
+
+
+
+
+
+ open_in_new
+
+
+
+
+ {{ element.collaborators.length }}
+
+
+
+
diff --git a/webapp/src/app/modules/person-network/person-network.component.scss b/webapp/src/app/modules/person-network/person-network.component.scss
index 36506868..74a4778c 100644
--- a/webapp/src/app/modules/person-network/person-network.component.scss
+++ b/webapp/src/app/modules/person-network/person-network.component.scss
@@ -59,3 +59,13 @@ form > div > mat-button-toggle-group {
mat-card {
background-color: var(--sg-background);
}
+
+.person-link,
+.work-link {
+ color: var(--sg-primary);
+ text-decoration: none;
+}
+.person-link:hover,
+.work-link:hover {
+ text-decoration: underline;
+}
diff --git a/webapp/src/app/modules/person-network/person-network.component.ts b/webapp/src/app/modules/person-network/person-network.component.ts
index 647f2939..e824fdee 100644
--- a/webapp/src/app/modules/person-network/person-network.component.ts
+++ b/webapp/src/app/modules/person-network/person-network.component.ts
@@ -1,17 +1,23 @@
import { toSignal } from '@angular/core/rxjs-interop';
-import { Component, computed, OnInit, signal } from '@angular/core';
+import {
+ Component,
+ computed,
+ effect,
+ input,
+ OnInit,
+ signal,
+ TemplateRef,
+ viewChild,
+} from '@angular/core';
import { ActivatedRoute, Router, RouterModule } from '@angular/router';
import { MatCardModule } from '@angular/material/card';
import { MatButtonToggleModule } from '@angular/material/button-toggle';
-import { MatRippleModule } from '@angular/material/core';
import { provideEchartsCore } from 'ngx-echarts';
import * as echarts from 'echarts/core';
-import { MatTableModule } from '@angular/material/table';
import { MatButtonModule } from '@angular/material/button';
import { MatIconModule } from '@angular/material/icon';
-import { ScrollingModule } from '@angular/cdk/scrolling';
import { MatFormFieldModule } from '@angular/material/form-field';
import {
FormControl,
@@ -20,11 +26,7 @@ import {
ReactiveFormsModule,
} from '@angular/forms';
import { MatInputModule } from '@angular/material/input';
-import { MatSliderModule } from '@angular/material/slider';
-import { MatSortModule } from '@angular/material/sort';
import { CollaborationNetwork } from '../../api';
-import { PersonNetworkCollaboratorsComponent } from '../person-network-collaborators/person-network-collaborators.component';
-import { PersonNetworkPublicationsComponent } from '../person-network-publications/person-network-publications.component';
import { debounceTime } from 'rxjs';
import {
NodeCategory,
@@ -36,26 +38,57 @@ 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 { PersonNetworkInstitutionsComponent } from '../person-network-institutions/person-network-institutions.component';
+import {
+ GenericColumn,
+ DataTableComponent,
+} from '../../shared/ui/data-table/data-table.component';
+
+type CWork = {
+ id: string;
+ title: string;
+};
+
+type CCollaborator = {
+ id: string;
+ name: string;
+ category: string;
+ works: CWork[];
+};
+
+type PCollaborator = {
+ id: string;
+ name: string;
+ category: string;
+};
+
+type PWork = {
+ id: string;
+ title: string;
+ collaborators: PCollaborator[];
+};
+
+type ICollaborator = {
+ id: string;
+ name: string;
+};
+
+type IInstitution = {
+ id: string;
+ name: string;
+ collaborators: ICollaborator[];
+};
@Component({
selector: 'app-person-network',
imports: [
MatCardModule,
- MatTableModule,
MatButtonModule,
MatIconModule,
- ScrollingModule,
MatButtonToggleModule,
MatFormFieldModule,
FormsModule,
MatInputModule,
- MatSortModule,
- MatRippleModule,
RouterModule,
- PersonNetworkCollaboratorsComponent,
- PersonNetworkPublicationsComponent,
- MatSliderModule,
ReactiveFormsModule,
FormsModule,
PersonNetworkGraphComponent,
@@ -63,14 +96,50 @@ import { PersonNetworkInstitutionsComponent } from '../person-network-institutio
MatExpansionModule,
MatDialogModule,
PersonNetworkInfoCardComponent,
- PersonNetworkInstitutionsComponent,
+ DataTableComponent,
],
templateUrl: './person-network.component.html',
styleUrl: './person-network.component.scss',
providers: [provideEchartsCore({ echarts })],
})
export class PersonNetworkComponent implements OnInit {
- collaborationNetwork!: CollaborationNetwork;
+ collaborationNetwork = input.required();
+
+ collaboratorsColumns: GenericColumn[] = [];
+ collaboratorsData: CCollaborator[] = [];
+ collaboratorsActionTmp = viewChild.required>(
+ 'collaboratorsActionTmp',
+ );
+ collaboratorsFrequencyTmp = viewChild.required>(
+ 'collaboratorsFrequencyTmp',
+ );
+ collaboratorsDetailRow = viewChild.required>(
+ 'collaboratorsDetailRow',
+ );
+
+ publicationsColumns: GenericColumn[] = [];
+ publicationsData: PWork[] = [];
+ publicationsActionTmp = viewChild.required>(
+ 'publicationsActionTmp',
+ );
+ publicationsCollaborationFrequencyTmp = viewChild.required>(
+ 'publicationsCollaborationFrequencyTmp',
+ );
+ publicationsDetailRow = viewChild.required>(
+ 'publicationsDetailRow',
+ );
+
+ institutionsColumns: GenericColumn[] = [];
+ institutionsData: IInstitution[] = [];
+ institutionsActionTmp = viewChild.required>(
+ 'institutionsActionTmp',
+ );
+ institutionsFrequencyTmp = viewChild.required>(
+ 'institutionsFrequencyTmp',
+ );
+ institutionsDetailRow = viewChild.required>(
+ 'institutionsDetailRow',
+ );
filterForm = new FormGroup({
searchTerm: new FormControl(''),
@@ -181,7 +250,50 @@ export class PersonNetworkComponent implements OnInit {
private readonly activatedRoute: ActivatedRoute,
private readonly router: Router,
private readonly dialog: MatDialog,
- ) {}
+ ) {
+ effect(() => {
+ this.collaboratorsData = this.buildCollaboratorsDataSource(
+ this.collaborationNetwork(),
+ );
+
+ this.publicationsData = this.buildWorksDataSource(
+ this.collaborationNetwork(),
+ );
+
+ this.institutionsData = this.buildInstitutionsDataSource(
+ this.collaborationNetwork(),
+ );
+
+ this.calculateSummary(this.collaborationNetwork());
+
+ const currentParams = this.activatedRoute.snapshot.queryParams;
+
+ this.filterForm.setValue({
+ searchTerm: currentParams['search_term'] || '',
+ filterBy: currentParams['filter_by'] || 'works',
+ displayedTable: currentParams['table'] || 'collaborators',
+
+ startYear:
+ Number(currentParams['start_year']) ||
+ this.collaborationNetwork().filter_information.min_possible_year,
+ endYear:
+ Number(currentParams['end_year']) ||
+ this.collaborationNetwork().filter_information.max_possible_year,
+ topics: currentParams['topics']
+ ? currentParams['topics'].split(',')
+ : [],
+ minContributors: Number(currentParams['min_contributors']) || 2,
+ maxContributors: Number(currentParams['max_contributors']) || 10,
+
+ minCollaborations: Number(currentParams['min_collaborations']) || 1,
+ maxCollaborations: Number(currentParams['max_collaborations']) || 100,
+
+ institutions: currentParams['institutions']
+ ? currentParams['institutions'].split(',')
+ : [],
+ });
+ });
+ }
openFilterDialog() {
console.log('Form value when opening dialog:', this.filterForm.value);
@@ -233,39 +345,67 @@ export class PersonNetworkComponent implements OnInit {
}
ngOnInit(): void {
- this.activatedRoute.data.subscribe(({ collaborationNetwork }) => {
- this.collaborationNetwork = collaborationNetwork;
-
- this.calculateSummary(collaborationNetwork);
-
- const currentParams = this.activatedRoute.snapshot.queryParams;
-
- this.filterForm.setValue({
- searchTerm: currentParams['search_term'] || '',
- filterBy: currentParams['filter_by'] || 'works',
- displayedTable: currentParams['table'] || 'collaborators',
-
- startYear:
- Number(currentParams['start_year']) ||
- this.collaborationNetwork.filter_information.min_possible_year,
- endYear:
- Number(currentParams['end_year']) ||
- this.collaborationNetwork.filter_information.max_possible_year,
- topics: currentParams['topics']
- ? currentParams['topics'].split(',')
- : [],
- minContributors: Number(currentParams['min_contributors']) || 2,
- maxContributors: Number(currentParams['max_contributors']) || 10,
-
- minCollaborations: Number(currentParams['min_collaborations']) || 1,
- maxCollaborations: Number(currentParams['max_collaborations']) || 100,
-
- institutions: currentParams['institutions']
- ? currentParams['institutions'].split(',')
- : [],
- });
- });
-
+ this.collaboratorsColumns = [
+ {
+ id: 'name',
+ header: 'Name',
+ type: 'accessor',
+ accessorKey: 'name',
+ },
+ {
+ id: 'works',
+ header: 'Häufigkeit',
+ type: 'display',
+ cellTemplate: this.collaboratorsFrequencyTmp(),
+ },
+ {
+ id: 'actions',
+ header: '',
+ type: 'display',
+ cellTemplate: this.collaboratorsActionTmp(),
+ },
+ ];
+ this.publicationsColumns = [
+ {
+ id: 'title',
+ header: 'Titel',
+ type: 'accessor',
+ accessorKey: 'title',
+ },
+ {
+ id: 'collaborators',
+ header: 'Mitwirkende',
+ type: 'display',
+ cellTemplate: this.publicationsCollaborationFrequencyTmp(),
+ },
+ {
+ id: 'actions',
+ header: '',
+ type: 'display',
+ cellTemplate: this.publicationsActionTmp(),
+ },
+ ];
+ this.institutionsColumns = [
+ {
+ id: 'name',
+ header: 'Name',
+ type: 'accessor',
+ accessorKey: 'name',
+ },
+ {
+ id: 'collaborators',
+ header: 'Mitwirkende',
+ type: 'display',
+ cellTemplate: this.institutionsFrequencyTmp(),
+ },
+ {
+ id: 'actions',
+ header: '',
+ type: 'display',
+ cellTemplate: this.institutionsActionTmp(),
+ },
+ ];
+
this.filterForm.valueChanges.pipe(debounceTime(300)).subscribe((value) => {
console.log('Form value changed:', value);
this.router.navigate([], {
@@ -294,4 +434,151 @@ export class PersonNetworkComponent implements OnInit {
}
this.filterForm.get('displayedTable')?.setValue(value);
}
+
+ buildCollaboratorsDataSource(
+ collaborationNetwork: CollaborationNetwork,
+ ): CCollaborator[] {
+ // key: collaborator id, value: set of work ids
+ const worksByCollaborator: Record> = {};
+ // key: work id, value: work
+ const works: Record = {};
+
+ const allWorks: Record = collaborationNetwork.work_nodes
+ .map((node) => ({
+ id: node.raw_id,
+ title: node.display_name,
+ }))
+ .reduce(
+ (acc, work) => {
+ acc[work.id] = work;
+ return acc;
+ },
+ {} as Record,
+ );
+
+ const allAuthors: Record =
+ collaborationNetwork.author_nodes
+ .map((node) => ({
+ id: node.raw_id,
+ name: node.display_name,
+ category: node.category,
+ works: [],
+ }))
+ .reduce(
+ (acc, author) => {
+ acc[author.id] = author;
+ return acc;
+ },
+ {} as Record,
+ );
+
+ collaborationNetwork.collaboration_edges.forEach((edge) => {
+ if (
+ edge.raw_source_id.toUpperCase().startsWith('A') &&
+ edge.raw_target_id.toUpperCase().startsWith('W')
+ ) {
+ allAuthors[edge.raw_source_id]?.works.push(
+ allWorks[edge.raw_target_id],
+ );
+ }
+ });
+
+ Object.values(allAuthors).forEach((author) => {
+ author.works.sort((a, b) => a.title.localeCompare(b.title));
+ });
+
+ return Object.values(allAuthors).filter(
+ (author) =>
+ author.works.length > 0 &&
+ author.id !== collaborationNetwork.raw_person_id,
+ );
+ }
+
+ buildWorksDataSource(collaborationNetwork: CollaborationNetwork): PWork[] {
+ const allWorks: Record = collaborationNetwork.work_nodes
+ .map((node) => ({
+ id: node.raw_id,
+ title: node.display_name,
+ collaborators: [],
+ }))
+ .reduce(
+ (acc, work) => {
+ acc[work.id] = work;
+ return acc;
+ },
+ {} as Record,
+ );
+
+ const allAuthors: Record =
+ collaborationNetwork.author_nodes
+ .map((node) => ({
+ id: node.raw_id,
+ name: node.display_name,
+ category:
+ node.raw_id === collaborationNetwork.raw_person_id
+ ? 'author'
+ : 'collaborator',
+ }))
+ .reduce(
+ (acc, person) => {
+ acc[person.id] = person;
+ return acc;
+ },
+ {} as Record,
+ );
+
+ collaborationNetwork.collaboration_edges.forEach((edge) => {
+ if (
+ edge.raw_source_id.toUpperCase().startsWith('A') &&
+ edge.raw_target_id.toUpperCase().startsWith('W')
+ ) {
+ allWorks[edge.raw_target_id]?.collaborators.push(
+ allAuthors[edge.raw_source_id],
+ );
+ }
+ });
+
+ Object.values(allWorks).forEach((work) => {
+ work.collaborators.sort((a, b) => a.name.localeCompare(b.name));
+ });
+
+ return Object.values(allWorks).filter(
+ (work) => work.collaborators.length > 0,
+ );
+ }
+
+ buildInstitutionsDataSource(
+ collaborationNetwork: CollaborationNetwork,
+ ): IInstitution[] {
+ const institutionsMap: Record = {};
+
+ for (const node of collaborationNetwork.institution_nodes) {
+ institutionsMap[node.raw_id] = {
+ id: node.raw_id,
+ name: node.display_name,
+ collaborators: [],
+ };
+ }
+
+ for (const edge of collaborationNetwork.collaboration_edges) {
+ if (edge.raw_target_id in institutionsMap) {
+ const institution = institutionsMap[edge.raw_target_id];
+ institution.collaborators.push({
+ id: edge.raw_source_id,
+ name:
+ collaborationNetwork.author_nodes.find(
+ (node) => node.raw_id === edge.raw_source_id,
+ )?.display_name || 'Unbekannt',
+ });
+ }
+ }
+
+ for (const institution of Object.values(institutionsMap)) {
+ institution.collaborators.sort((a, b) =>
+ a.name.localeCompare(b.name, 'de', { sensitivity: 'base' }),
+ );
+ }
+
+ return Object.values(institutionsMap);
+ }
}
diff --git a/webapp/src/app/resolvers/person-list.resolver.ts b/webapp/src/app/resolvers/person-list.resolver.ts
index 97001abe..8e4b824c 100644
--- a/webapp/src/app/resolvers/person-list.resolver.ts
+++ b/webapp/src/app/resolvers/person-list.resolver.ts
@@ -26,8 +26,8 @@ export const personListResolver: ResolveFn = (
: 10;
const institutionName = params.get('institutionName') || undefined;
- const sortBy= params.get('sortBy') || undefined;
- const sortOrder= params.get('sortOrder') || undefined;
+ const sortBy = params.get('sortBy') || undefined;
+ const sortOrder = params.get('sortOrder') || undefined;
const topicsParam = params.getAll('topic');
diff --git a/webapp/src/app/shared/ui/data-table/data-table.component.html b/webapp/src/app/shared/ui/data-table/data-table.component.html
index 2cac8d57..41347477 100644
--- a/webapp/src/app/shared/ui/data-table/data-table.component.html
+++ b/webapp/src/app/shared/ui/data-table/data-table.component.html
@@ -1,9 +1,10 @@
-
+
+ (matSortChange)="onSortChange($event)"
+ multiTemplateDataRows>
@for (col of columns(); track col.id) {
@if (col.type === 'accessor') {
@@ -28,10 +29,40 @@
}
-
-
+
+
+ @if (row === expandedElement() && detailTemplate()) {
+ @if (detailTemplate(); as tpl) {
+
+ }
+ }
+ |
+
+
+
+
+
+
+
- @if (this.dataSource.data.length === 0) {
+ @if (this.dataSource.filteredData.length === 0) {
Keine Daten gefunden.
diff --git a/webapp/src/app/shared/ui/data-table/data-table.component.scss b/webapp/src/app/shared/ui/data-table/data-table.component.scss
index 3936b5af..87d6020d 100644
--- a/webapp/src/app/shared/ui/data-table/data-table.component.scss
+++ b/webapp/src/app/shared/ui/data-table/data-table.component.scss
@@ -1,3 +1,7 @@
+.mat-mdc-table {
+ background-color: var(--sg-background);
+}
+
.no-data {
display: flex;
justify-content: center;
@@ -5,3 +9,17 @@
height: 200px;
color: #888;
}
+
+tr.detail-row {
+ height: 0 !important;
+}
+
+.detail-row-wrapper {
+ overflow: hidden;
+ display: flex;
+}
+
+.element-row:hover {
+ background: #f5f5f5;
+ cursor: pointer;
+}
diff --git a/webapp/src/app/shared/ui/data-table/data-table.component.ts b/webapp/src/app/shared/ui/data-table/data-table.component.ts
index e1ddd0cf..4456b966 100644
--- a/webapp/src/app/shared/ui/data-table/data-table.component.ts
+++ b/webapp/src/app/shared/ui/data-table/data-table.component.ts
@@ -6,6 +6,7 @@ import {
effect,
input,
output,
+ signal,
TemplateRef,
viewChild,
} from '@angular/core';
@@ -45,6 +46,14 @@ export type GenericColumn
= AccessorColumn | DisplayColumn;
export class DataTableComponent implements AfterViewInit {
data = input.required();
columns = input.required[]>();
+ filterTerm = input('');
+
+ detailTemplate = input | null>(null);
+ expandedElement = signal(null);
+
+ maxHeight = input(null);
+ containerOverflow = computed(() => (this.maxHeight() ? 'auto' : 'visible'));
+ stickyHeader = input(true);
activeSortKey = input('');
sortDirection = input('');
@@ -72,6 +81,8 @@ export class DataTableComponent implements AfterViewInit {
return value ? String(value).toLowerCase().includes(filter) : false;
});
};
+
+ this.dataSource.filter = this.filterTerm().trim().toLowerCase();
});
effect(() => {
@@ -98,4 +109,9 @@ export class DataTableComponent implements AfterViewInit {
onSortChange(sort: Sort) {
this.sortChange.emit(sort);
}
+
+ toggleRow(row: T): void {
+ if (!this.detailTemplate()) return;
+ this.expandedElement.update((current) => (current === row ? null : row));
+ }
}