Added summary cards for network
LocationBasedServices/smartguide/pipeline/head This commit looks good

This commit is contained in:
Mats Paul Tončik
2026-06-04 23:42:39 +02:00
parent 736277d6ff
commit fe6f64cc8c
15 changed files with 232 additions and 191 deletions
@@ -1,60 +1,11 @@
.content {
display: flex;
flex-direction: row;
padding: 40px;
gap: 20px;
max-height: 1000px;
}
.graph {
width: 75vh;
height: 75vh;
}
.table {
overflow: auto;
width: 100%;
max-height: 1000px;
height: 1200px;
max-height: 100%;
}
.table table {
width: 100%;
}
.table-area {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
}
.scroll-viewport-container {
width: 100%;
height: 100%;
}
.form-controls {
display: flex;
flex-direction: row;
align-items: flex-start;
gap: 10px;
}
.form-field-full {
width: 100%;
}
.right-card {
width: 100%;
}
.toggle-group {
margin-bottom: 20px;
}
.toggle-group .mat-button-toggle {
text-transform: none;
.mat-mdc-table {
background-color: var(--sg-background);
}
.element-row {
@@ -75,5 +26,4 @@
.detail-row {
width: 100%;
}
}
@@ -1,4 +1,4 @@
import { Component, inject } from '@angular/core';
import { Component, inject, OnInit } from '@angular/core';
import {
FormControl,
FormGroup,
@@ -11,7 +11,7 @@ import {
MatDialogRef,
} from '@angular/material/dialog';
import { MatFormFieldModule } from '@angular/material/form-field';
import { CollaborationNetwork } from '../api';
import { CollaborationNetwork } from '../../api';
import { MatSelectModule } from '@angular/material/select';
import { MatInputModule } from '@angular/material/input';
import { MatButtonModule } from '@angular/material/button';
@@ -37,12 +37,12 @@ export interface PersonNetworkFilterDialogData {
MatSelectModule,
MatDialogModule,
MatInputModule,
MatButtonModule
MatButtonModule,
],
templateUrl: './person-network-filter-dialog.component.html',
styleUrl: './person-network-filter-dialog.component.scss',
})
export class PersonNetworkFilterDialogComponent {
export class PersonNetworkFilterDialogComponent implements OnInit {
readonly dialogRef = inject(MatDialogRef<PersonNetworkFilterDialogComponent>);
readonly data = inject<PersonNetworkFilterDialogData>(MAT_DIALOG_DATA);
@@ -55,10 +55,23 @@ export class PersonNetworkFilterDialogComponent {
maximumCollaborators: new FormControl(10),
minimumCollaborations: new FormControl(1),
maximumCollaborations: new FormControl(100),
institutions: new FormControl([]),
topics: new FormControl([]),
institutions: new FormControl<string[]>([]),
topics: new FormControl<string[]>([]),
});
ngOnInit() {
this.filterForm.patchValue({
startYear: this.data.startYear,
endYear: this.data.endYear,
minimumCollaborators: this.data.minimumCollaborators,
maximumCollaborators: this.data.maximumCollaborators,
minimumCollaborations: this.data.minimumCollaborations,
maximumCollaborations: this.data.maximumCollaborations,
institutions: this.data.institutions,
topics: this.data.topics,
});
}
onCancel() {
this.dialogRef.close();
}
@@ -1,6 +1,11 @@
<mat-card appearance="outlined">
<mat-card-content>
@if (!isValidGraph()) {
@if (isEmptyGraph()) {
<div class="warning-container">
<mat-icon>warning</mat-icon>
<p>Das Netzwerk ist leer.</p>
</div>
} @else if (!isValidGraph()) {
<div class="warning-container">
<mat-icon>warning</mat-icon>
<p>Das Netzwerk ist zu groß für eine detaillierte Darstellung.</p>
@@ -7,13 +7,14 @@ mat-card {
display: flex;
flex-direction: column;
width: 100%;
background: transparent;
background-color: var(--sg-background);
}
mat-card-content {
mat-card > mat-card-content {
flex: 1 1 auto;
min-height: 0;
align-items: center;
padding: 0px;
}
.graph {
@@ -24,6 +24,15 @@ export class PersonNetworkGraphComponent {
options!: EChartsCoreOption;
readonly isEmptyGraph = computed(() => {
const network = this.collaborationNetwork();
return (
network === undefined ||
network.nodes.length === 0 ||
network.edges.length === 0
);
});
readonly isValidGraph = computed(() => {
const network = this.collaborationNetwork();
return (
@@ -0,0 +1,9 @@
<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>
@@ -0,0 +1,34 @@
.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;
}
@@ -0,0 +1,15 @@
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>();
}
@@ -1,60 +1,11 @@
.content {
display: flex;
flex-direction: row;
padding: 40px;
gap: 20px;
max-height: 1000px;
}
.graph {
width: 75vh;
height: 75vh;
}
.table {
overflow: auto;
width: 100%;
max-height: 1000px;
height: 1200px;
max-height: 100%;
}
.table table {
width: 100%;
}
.table-area {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
}
.scroll-viewport-container {
width: 100%;
height: 100%;
}
.form-controls {
display: flex;
flex-direction: row;
align-items: flex-start;
gap: 10px;
}
.form-field-full {
width: 100%;
}
.right-card {
width: 100%;
}
.toggle-group {
margin-bottom: 20px;
}
.toggle-group .mat-button-toggle {
text-transform: none;
.mat-mdc-table {
background-color: var(--sg-background);
}
.element-row {
@@ -1,13 +1,7 @@
<div class="content">
<div class="top-row">
<div class="description-container">
<h5 style="font-weight: bold">Netzwerk</h5>
<p>Zusammenarbeit und Verbindungen im wissenschaftlichen Netzwerk.</p>
</div>
<button mat-stroked-button type="button" (click)="openFilterDialog()">
<mat-icon>filter_alt</mat-icon>
Filter
</button>
<div class="description-container">
<h5 style="font-weight: bold">Netzwerk</h5>
<p>Zusammenarbeit und Verbindungen im wissenschaftlichen Netzwerk.</p>
</div>
<div class="cards">
@@ -18,21 +12,27 @@
<div class="right-card">
<form [formGroup]="filterForm">
<mat-button-toggle-group
class="toggle-group"
aria-label="Select view"
(change)="onToggleChange($event)"
formControlName="displayedTable"
style="margin-top: 20px; width: 100%"
>
<mat-button-toggle value="collaborators">
Kollaborierende
</mat-button-toggle>
<mat-button-toggle value="publications"
>Publikationen</mat-button-toggle
<div>
<mat-button-toggle-group
class="toggle-group"
aria-label="Select view"
(change)="onToggleChange($event)"
formControlName="displayedTable"
style="margin-top: 20px; width: 100%"
>
</mat-button-toggle-group>
<mat-form-field class="form-field-full">
<mat-button-toggle value="collaborators">
Kollaborierende
</mat-button-toggle>
<mat-button-toggle value="publications"
>Publikationen</mat-button-toggle
>
</mat-button-toggle-group>
<button mat-stroked-button type="button" (click)="openFilterDialog()">
<mat-icon>filter_alt</mat-icon>
Filter
</button>
</div>
<mat-form-field style="width: 100%">
<mat-label>{{
this.displayedTable() === "collaborators"
? "Suche Kollaborierende nach Name oder ID"
@@ -48,25 +48,31 @@
</mat-form-field>
</form>
<div class="table-area">
<mat-card appearance="outlined">
<mat-card-content>
<div class="scroll-viewport-container">
@if (this.displayedTable() === "collaborators") {
<app-person-network-collaborators
[collaborationNetwork]="collaborationNetwork"
[searchTerm]="searchTerm()"
/>
} @else if (this.displayedTable() === "publications") {
<app-person-network-publications
[collaborationNetwork]="collaborationNetwork"
[searchTerm]="searchTerm()"
/>
}
</div>
</mat-card-content>
</mat-card>
</div>
<mat-card appearance="outlined">
<mat-card-content class="scroll-viewport-container">
@if (this.displayedTable() === "collaborators") {
<app-person-network-collaborators
[collaborationNetwork]="collaborationNetwork"
[searchTerm]="searchTerm()"
/>
} @else if (this.displayedTable() === "publications") {
<app-person-network-publications
[collaborationNetwork]="collaborationNetwork"
[searchTerm]="searchTerm()"
/>
}
</mat-card-content>
</mat-card>
</div>
</div>
<div class="summary-container">
@for (summary of this.summaryCards(); track $index) {
<app-person-network-info-card
[icon]="summary.icon"
[value]="summary.value.toString()"
[description]="summary.description"
/>
}
</div>
</div>
@@ -1,16 +1,7 @@
.content {
display: flex;
flex-direction: column;
padding: 40px;
gap: 20px;
align-items: stretch;
}
.top-row {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: end;
padding: 30px;
gap: 20px;
}
@@ -23,24 +14,26 @@
display: flex;
flex-direction: row;
gap: 20px;
max-height: 80vh;
}
form > div {
display: flex;
flex-direction: row;
gap: 20px;
}
form > div > button,
form > div > mat-button-toggle-group {
margin-top: 20px;
margin-bottom: 20px;
border-radius: var(--sg-radius-sm);
color: var(--sg-text);
}
.content > app-person-network-graph,
.right-card {
flex: 1 1 0;
min-width: 0;
}
.form-field-full {
width: 100%;
}
.right-card {
width: 100%;
}
.toggle-group {
margin-bottom: 20px;
}
.toggle-group .mat-button-toggle {
@@ -48,18 +41,21 @@
width: 100%;
}
.pair-field {
.summary-container {
display: flex;
flex-direction: row;
gap: 20px;
}
.pair-field > mat-form-field {
width: 100%;
.summary-container app-person-network-info-card {
flex: 1 1 0;
}
.top-row button {
height: 42px;
border-color: var(--sg-border);
border-radius: var(--sg-radius-sm);
color: var(--sg-text);
}
.scroll-viewport-container {
height: 50vh;
max-height: 50vh;
}
mat-card {
background-color: var(--sg-background);
}
@@ -1,6 +1,6 @@
import { toSignal } from '@angular/core/rxjs-interop';
import { Component, computed, OnInit } from '@angular/core';
import { Component, computed, OnInit, signal } from '@angular/core';
import { ActivatedRoute, Router, RouterModule } from '@angular/router';
import { MatCardModule } from '@angular/material/card';
import { MatButtonToggleModule } from '@angular/material/button-toggle';
@@ -30,7 +30,8 @@ import { PersonNetworkGraphComponent } from '../person-network-graph/person-netw
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 { PersonNetworkFilterDialogComponent } from '../person-network-filter-dialog/person-network-filter-dialog.component';
import { PersonNetworkInfoCardComponent } from '../person-network-info-card/person-network-info-card.component';
@Component({
selector: 'app-person-network',
@@ -56,6 +57,7 @@ import { PersonNetworkFilterDialogComponent } from '../../person-network-filter-
MatSelectModule,
MatExpansionModule,
MatDialogModule,
PersonNetworkInfoCardComponent,
],
templateUrl: './person-network.component.html',
styleUrl: './person-network.component.scss',
@@ -77,6 +79,34 @@ export class PersonNetworkComponent implements OnInit {
displayedTable: new FormControl('collaborators'),
});
persons = signal(0);
institutions = signal(0);
publications = signal(0);
connections = signal(0);
readonly summaryCards = computed(() => [
{
icon: 'person',
value: this.persons(),
description: 'Personen',
},
{
icon: 'apartment',
value: this.institutions(),
description: 'Institutionen',
},
{
icon: 'menu_book',
value: this.publications(),
description: 'Gemeinsame Publikationen',
},
{
icon: 'share',
value: this.connections(),
description: 'Verbindungen im Netzwerk',
},
]);
readonly formValue = toSignal(this.filterForm.valueChanges);
readonly debouncedFormValue = toSignal(
this.filterForm.valueChanges.pipe(debounceTime(300)),
@@ -137,10 +167,29 @@ export class PersonNetworkComponent implements OnInit {
});
}
calculateSummary(collaborationNetwork: CollaborationNetwork) {
this.persons.set(
collaborationNetwork.nodes.filter((node) => node.category === 'author')
.length,
);
this.institutions.set(
collaborationNetwork.nodes.filter(
(node) => node.category === 'institution',
).length,
);
this.publications.set(
collaborationNetwork.nodes.filter((node) => node.category === 'work')
.length,
);
this.connections.set(collaborationNetwork.edges.length);
}
ngOnInit(): void {
this.activatedRoute.data.subscribe(({ collaborationNetwork }) => {
this.collaborationNetwork = collaborationNetwork;
this.calculateSummary(collaborationNetwork);
const currentParams = this.activatedRoute.snapshot.queryParams;
const initialStartYear =
Number(currentParams['start_year']) ||
+3
View File
@@ -118,6 +118,9 @@ body {
--sg-radius-sm: 8px;
--sg-radius-md: 12px;
--sg-radius-lg: 18px;
--sg-blue-highlight: #3d7cff;
--sg-default-bold-weight: 900;
}
* {