Moved network filter to dialog component
This commit is contained in:
@@ -1,16 +1,18 @@
|
||||
<mat-card appearance="outlined">
|
||||
<mat-card-header>
|
||||
<mat-card-title
|
||||
>Kollaborations Netzwerk von {{ authorDisplayName }}</mat-card-title
|
||||
>
|
||||
</mat-card-header>
|
||||
<mat-card-content>
|
||||
<div
|
||||
class="graph"
|
||||
echarts
|
||||
[options]="options"
|
||||
[autoResize]="true"
|
||||
(wheel)="onGraphWheel($event)"
|
||||
></div>
|
||||
@if (!isValidGraph()) {
|
||||
<div class="warning-container">
|
||||
<mat-icon>warning</mat-icon>
|
||||
<p>Das Netzwerk ist zu groß für eine detaillierte Darstellung.</p>
|
||||
</div>
|
||||
} @else {
|
||||
<div
|
||||
class="graph"
|
||||
echarts
|
||||
[options]="options"
|
||||
[autoResize]="true"
|
||||
(wheel)="onGraphWheel($event)"
|
||||
></div>
|
||||
}
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
|
||||
@@ -13,6 +13,7 @@ mat-card {
|
||||
mat-card-content {
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.graph {
|
||||
@@ -24,3 +25,12 @@ mat-card-content {
|
||||
user-select: none;
|
||||
cursor: grab;
|
||||
}
|
||||
|
||||
.warning-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 16px;
|
||||
padding: 24px;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Component, effect, input } from '@angular/core';
|
||||
import { Component, computed, effect, input } from '@angular/core';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { CollaborationNetwork } from '../../api';
|
||||
import { NgxEchartsDirective } from 'ngx-echarts';
|
||||
@@ -8,11 +8,12 @@ import * as echarts from 'echarts/core';
|
||||
import { GridComponent, TitleComponent } from 'echarts/components';
|
||||
import { CanvasRenderer } from 'echarts/renderers';
|
||||
import { GraphChart } from 'echarts/charts';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
echarts.use([GridComponent, CanvasRenderer, GraphChart, TitleComponent]);
|
||||
|
||||
@Component({
|
||||
selector: 'app-person-network-graph',
|
||||
imports: [MatCardModule, NgxEchartsDirective],
|
||||
imports: [MatCardModule, MatIconModule, NgxEchartsDirective],
|
||||
templateUrl: './person-network-graph.component.html',
|
||||
styleUrl: './person-network-graph.component.scss',
|
||||
})
|
||||
@@ -23,6 +24,16 @@ export class PersonNetworkGraphComponent {
|
||||
|
||||
options!: EChartsCoreOption;
|
||||
|
||||
readonly isValidGraph = computed(() => {
|
||||
const network = this.collaborationNetwork();
|
||||
return (
|
||||
network !== undefined &&
|
||||
network.nodes.length > 0 &&
|
||||
network.nodes.length < 1000 &&
|
||||
network.edges.length > 0
|
||||
);
|
||||
});
|
||||
|
||||
constructor() {
|
||||
effect(() => {
|
||||
const network = this.collaborationNetwork();
|
||||
@@ -42,6 +53,12 @@ export class PersonNetworkGraphComponent {
|
||||
return;
|
||||
}
|
||||
|
||||
const frequencies =
|
||||
this.calculateOccurenceFrequencies(collaborationNetwork);
|
||||
|
||||
const minFrequency = Math.min(...Object.values(frequencies));
|
||||
const maxFrequency = Math.max(...Object.values(frequencies));
|
||||
|
||||
const datas = [
|
||||
{
|
||||
nodes: collaborationNetwork.nodes.map((node) => {
|
||||
@@ -73,6 +90,11 @@ export class PersonNetworkGraphComponent {
|
||||
label: {
|
||||
show: true,
|
||||
},
|
||||
symbolSize:
|
||||
25 +
|
||||
(((frequencies[node.raw_id] || 0) - minFrequency) /
|
||||
(maxFrequency - minFrequency)) *
|
||||
30,
|
||||
};
|
||||
}),
|
||||
links: collaborationNetwork.edges.map((edge) => {
|
||||
@@ -134,4 +156,17 @@ export class PersonNetworkGraphComponent {
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
calculateOccurenceFrequencies(
|
||||
netork: CollaborationNetwork,
|
||||
): Record<string, number> {
|
||||
const frequencies: Record<string, number> = {};
|
||||
netork.edges.forEach((edge) => {
|
||||
frequencies[edge.raw_source_id] =
|
||||
(frequencies[edge.raw_source_id] || 0) + 1;
|
||||
frequencies[edge.raw_target_id] =
|
||||
(frequencies[edge.raw_target_id] || 0) + 1;
|
||||
});
|
||||
return frequencies;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,172 +1,72 @@
|
||||
<div class="content">
|
||||
@if (collaborationNetwork.nodes.length < 1000) {
|
||||
<app-person-network-graph [collaborationNetwork]="collaborationNetwork" />
|
||||
}
|
||||
<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>
|
||||
|
||||
<div class="right-card">
|
||||
<form class="network-filter-form" [formGroup]="filterForm">
|
||||
<mat-expansion-panel class="filter-panel" appearance="outline">
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>Filter</mat-panel-title>
|
||||
</mat-expansion-panel-header>
|
||||
<div class="pair-field">
|
||||
<mat-form-field>
|
||||
<mat-label>Startjahr (inklusive)</mat-label>
|
||||
<input
|
||||
matInput
|
||||
type="number"
|
||||
appearance="outline"
|
||||
formControlName="startYear"
|
||||
/>
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<mat-label>Endjahr (inklusive)</mat-label>
|
||||
<input
|
||||
matInput
|
||||
type="number"
|
||||
appearance="outline"
|
||||
formControlName="endYear"
|
||||
/>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="pair-field">
|
||||
<mat-form-field>
|
||||
<mat-label
|
||||
>Minimale Anzahl von Kollaborierenden (inklusiv)</mat-label
|
||||
>
|
||||
<input
|
||||
matInput
|
||||
type="number"
|
||||
appearance="outline"
|
||||
formControlName="minimumCollaborators"
|
||||
/>
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<mat-label
|
||||
>Maximale Anzahl von Kollaborierenden (exklusiv)</mat-label
|
||||
>
|
||||
<input
|
||||
matInput
|
||||
type="number"
|
||||
appearance="outline"
|
||||
formControlName="maximumCollaborators"
|
||||
/>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="pair-field">
|
||||
<mat-form-field>
|
||||
<mat-label
|
||||
>Minimale Anzahl von Kollaborationen (inklusiv)</mat-label
|
||||
>
|
||||
<input
|
||||
matInput
|
||||
type="number"
|
||||
appearance="outline"
|
||||
formControlName="minimumCollaborations"
|
||||
/>
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<mat-label
|
||||
>Maximale Anzahl von Kollaborationen (inklusiv)</mat-label
|
||||
>
|
||||
<input
|
||||
matInput
|
||||
type="number"
|
||||
appearance="outline"
|
||||
formControlName="maximumCollaborations"
|
||||
/>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="cards">
|
||||
<app-person-network-graph
|
||||
[collaborationNetwork]="collaborationNetwork"
|
||||
style="width: 50%"
|
||||
/>
|
||||
|
||||
<div class="pair-field">
|
||||
<mat-form-field>
|
||||
<mat-label>Institutionen</mat-label>
|
||||
<mat-select
|
||||
formControlName="institutions"
|
||||
multiple
|
||||
appearance="outline"
|
||||
placeholder="Alle Institutionen"
|
||||
>
|
||||
@for (
|
||||
institution of collaborationNetwork.filter_information
|
||||
.institutions;
|
||||
track institution.raw_id
|
||||
) {
|
||||
<mat-option [value]="institution.raw_id">
|
||||
{{ institution.display_name }}
|
||||
</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<mat-label>Themen</mat-label>
|
||||
<mat-select
|
||||
formControlName="topics"
|
||||
multiple
|
||||
appearance="outline"
|
||||
placeholder="Alle Themen"
|
||||
>
|
||||
@for (
|
||||
topic of collaborationNetwork.filter_information.topics;
|
||||
track topic.raw_topic_id
|
||||
) {
|
||||
<mat-option [value]="topic.raw_topic_id">
|
||||
{{ topic.display_name }}
|
||||
</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</mat-expansion-panel>
|
||||
|
||||
<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 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-group>
|
||||
<mat-form-field class="form-field-full">
|
||||
<mat-label>{{
|
||||
this.displayedTable() === "collaborators"
|
||||
? "Suche Kollaborierende nach Name oder ID"
|
||||
: "Suche Publikationen nach Titel oder ID"
|
||||
}}</mat-label>
|
||||
<input
|
||||
matInput
|
||||
#input
|
||||
appearance="outline"
|
||||
formControlName="searchTerm"
|
||||
/>
|
||||
<mat-icon matSuffix>search</mat-icon>
|
||||
</mat-form-field>
|
||||
</form>
|
||||
<mat-button-toggle value="collaborators">
|
||||
Kollaborierende
|
||||
</mat-button-toggle>
|
||||
<mat-button-toggle value="publications"
|
||||
>Publikationen</mat-button-toggle
|
||||
>
|
||||
</mat-button-toggle-group>
|
||||
<mat-form-field class="form-field-full">
|
||||
<mat-label>{{
|
||||
this.displayedTable() === "collaborators"
|
||||
? "Suche Kollaborierende nach Name oder ID"
|
||||
: "Suche Publikationen nach Titel oder ID"
|
||||
}}</mat-label>
|
||||
<input
|
||||
matInput
|
||||
#input
|
||||
appearance="outline"
|
||||
formControlName="searchTerm"
|
||||
/>
|
||||
<mat-icon matSuffix>search</mat-icon>
|
||||
</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 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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,47 +1,36 @@
|
||||
.content {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-direction: column;
|
||||
padding: 40px;
|
||||
gap: 20px;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.top-row {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-items: end;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.description-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.cards {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.content > app-person-network-graph,
|
||||
.right-card {
|
||||
flex: 1 1 0;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.table {
|
||||
overflow: auto;
|
||||
width: 100%;
|
||||
max-height: 70vh;
|
||||
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%;
|
||||
}
|
||||
@@ -67,3 +56,10 @@
|
||||
.pair-field > mat-form-field {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.top-row button {
|
||||
height: 42px;
|
||||
border-color: var(--sg-border);
|
||||
border-radius: var(--sg-radius-sm);
|
||||
color: var(--sg-text);
|
||||
}
|
||||
@@ -29,6 +29,8 @@ import { debounceTime } from 'rxjs';
|
||||
import { PersonNetworkGraphComponent } from '../person-network-graph/person-network-graph.component';
|
||||
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';
|
||||
|
||||
@Component({
|
||||
selector: 'app-person-network',
|
||||
@@ -53,6 +55,7 @@ import { MatExpansionModule } from '@angular/material/expansion';
|
||||
PersonNetworkGraphComponent,
|
||||
MatSelectModule,
|
||||
MatExpansionModule,
|
||||
MatDialogModule,
|
||||
],
|
||||
templateUrl: './person-network.component.html',
|
||||
styleUrl: './person-network.component.scss',
|
||||
@@ -89,13 +92,51 @@ export class PersonNetworkComponent implements OnInit {
|
||||
|
||||
readonly activatedRouteData = toSignal(this.activatedRoute.data);
|
||||
|
||||
formatYearLabel = (value: number) => `${value}`;
|
||||
|
||||
constructor(
|
||||
private readonly activatedRoute: ActivatedRoute,
|
||||
private readonly router: Router,
|
||||
private readonly dialog: MatDialog,
|
||||
) {}
|
||||
|
||||
openFilterDialog() {
|
||||
const dialogRef = this.dialog.open(PersonNetworkFilterDialogComponent, {
|
||||
data: {
|
||||
collaborationNetwork: this.collaborationNetwork,
|
||||
startYear: this.filterForm.get('startYear')?.value,
|
||||
endYear: this.filterForm.get('endYear')?.value,
|
||||
minimumCollaborators: this.filterForm.get('minimumCollaborators')
|
||||
?.value,
|
||||
maximumCollaborators: this.filterForm.get('maximumCollaborators')
|
||||
?.value,
|
||||
minimumCollaborations: this.filterForm.get('minimumCollaborations')
|
||||
?.value,
|
||||
maximumCollaborations: this.filterForm.get('maximumCollaborations')
|
||||
?.value,
|
||||
institutions: this.filterForm.get('institutions')?.value,
|
||||
topics: this.filterForm.get('topics')?.value,
|
||||
},
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe((result) => {
|
||||
console.log('Dialog result:', result);
|
||||
if (result) {
|
||||
this.filterForm.setValue({
|
||||
searchTerm: this.filterForm.get('searchTerm')?.value || '',
|
||||
startYear: result.startYear,
|
||||
endYear: result.endYear,
|
||||
minimumCollaborators: result.minimumCollaborators,
|
||||
maximumCollaborators: result.maximumCollaborators,
|
||||
minimumCollaborations: result.minimumCollaborations,
|
||||
maximumCollaborations: result.maximumCollaborations,
|
||||
institutions: result.institutions,
|
||||
topics: result.topics,
|
||||
displayedTable:
|
||||
this.filterForm.get('displayedTable')?.value || 'collaborators',
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.activatedRoute.data.subscribe(({ collaborationNetwork }) => {
|
||||
this.collaborationNetwork = collaborationNetwork;
|
||||
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
<h2 mat-dialog-title>Netzwerkfilter</h2>
|
||||
|
||||
<mat-dialog-content>
|
||||
<form [formGroup]="filterForm">
|
||||
<div class="pair-field">
|
||||
<mat-form-field>
|
||||
<mat-label>Startjahr (inklusive)</mat-label>
|
||||
<input
|
||||
matInput
|
||||
type="number"
|
||||
appearance="outline"
|
||||
formControlName="startYear"
|
||||
/>
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<mat-label>Endjahr (inklusive)</mat-label>
|
||||
<input
|
||||
matInput
|
||||
type="number"
|
||||
appearance="outline"
|
||||
formControlName="endYear"
|
||||
/>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Minimale Anzahl von Kollaborierenden (inklusiv)</mat-label>
|
||||
<input
|
||||
matInput
|
||||
type="number"
|
||||
appearance="outline"
|
||||
formControlName="minimumCollaborators"
|
||||
/>
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<mat-label>Maximale Anzahl von Kollaborierenden (exklusiv)</mat-label>
|
||||
<input
|
||||
matInput
|
||||
type="number"
|
||||
appearance="outline"
|
||||
formControlName="maximumCollaborators"
|
||||
/>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Minimale Anzahl von Kollaborationen (inklusiv)</mat-label>
|
||||
<input
|
||||
matInput
|
||||
type="number"
|
||||
appearance="outline"
|
||||
formControlName="minimumCollaborations"
|
||||
/>
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<mat-label>Maximale Anzahl von Kollaborationen (inklusiv)</mat-label>
|
||||
<input
|
||||
matInput
|
||||
type="number"
|
||||
appearance="outline"
|
||||
formControlName="maximumCollaborations"
|
||||
/>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Institutionen</mat-label>
|
||||
<mat-select
|
||||
formControlName="institutions"
|
||||
multiple
|
||||
appearance="outline"
|
||||
placeholder="Alle Institutionen"
|
||||
>
|
||||
@for (
|
||||
institution of collaborationNetwork.filter_information.institutions;
|
||||
track institution.raw_id
|
||||
) {
|
||||
<mat-option [value]="institution.raw_id">
|
||||
{{ institution.display_name }}
|
||||
</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<mat-label>Themen</mat-label>
|
||||
<mat-select
|
||||
formControlName="topics"
|
||||
multiple
|
||||
appearance="outline"
|
||||
placeholder="Alle Themen"
|
||||
>
|
||||
@for (
|
||||
topic of collaborationNetwork.filter_information.topics;
|
||||
track topic.raw_topic_id
|
||||
) {
|
||||
<mat-option [value]="topic.raw_topic_id">
|
||||
{{ topic.display_name }}
|
||||
</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</form>
|
||||
</mat-dialog-content>
|
||||
<mat-dialog-actions align="end">
|
||||
<button mat-button (click)="onCancel()">Abbrechen</button>
|
||||
<button mat-flat-button color="primary" (click)="onApply()" cdkFocusInitial>
|
||||
Anwenden
|
||||
</button>
|
||||
</mat-dialog-actions>
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
form {
|
||||
padding: 20px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.form-field-full {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
||||
.toggle-group {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.toggle-group .mat-button-toggle {
|
||||
text-transform: none;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.pair-field {
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.pair-field > mat-form-field {
|
||||
width: 100%;
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
import { Component, inject } from '@angular/core';
|
||||
import {
|
||||
FormControl,
|
||||
FormGroup,
|
||||
FormsModule,
|
||||
ReactiveFormsModule,
|
||||
} from '@angular/forms';
|
||||
import {
|
||||
MAT_DIALOG_DATA,
|
||||
MatDialogModule,
|
||||
MatDialogRef,
|
||||
} from '@angular/material/dialog';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { CollaborationNetwork } from '../api';
|
||||
import { MatSelectModule } from '@angular/material/select';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
|
||||
export interface PersonNetworkFilterDialogData {
|
||||
collaborationNetwork: CollaborationNetwork;
|
||||
startYear: number;
|
||||
endYear: number;
|
||||
minimumCollaborators: number;
|
||||
maximumCollaborators: number;
|
||||
minimumCollaborations: number;
|
||||
maximumCollaborations: number;
|
||||
institutions: string[];
|
||||
topics: string[];
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'app-person-network-filter-dialog',
|
||||
imports: [
|
||||
FormsModule,
|
||||
ReactiveFormsModule,
|
||||
MatFormFieldModule,
|
||||
MatSelectModule,
|
||||
MatDialogModule,
|
||||
MatInputModule,
|
||||
MatButtonModule
|
||||
],
|
||||
templateUrl: './person-network-filter-dialog.component.html',
|
||||
styleUrl: './person-network-filter-dialog.component.scss',
|
||||
})
|
||||
export class PersonNetworkFilterDialogComponent {
|
||||
readonly dialogRef = inject(MatDialogRef<PersonNetworkFilterDialogComponent>);
|
||||
readonly data = inject<PersonNetworkFilterDialogData>(MAT_DIALOG_DATA);
|
||||
|
||||
readonly collaborationNetwork = this.data.collaborationNetwork;
|
||||
|
||||
filterForm = new FormGroup({
|
||||
startYear: new FormControl(2000),
|
||||
endYear: new FormControl(2025),
|
||||
minimumCollaborators: new FormControl(2),
|
||||
maximumCollaborators: new FormControl(10),
|
||||
minimumCollaborations: new FormControl(1),
|
||||
maximumCollaborations: new FormControl(100),
|
||||
institutions: new FormControl([]),
|
||||
topics: new FormControl([]),
|
||||
});
|
||||
|
||||
onCancel() {
|
||||
this.dialogRef.close();
|
||||
}
|
||||
|
||||
onApply() {
|
||||
if (this.filterForm.valid) {
|
||||
this.dialogRef.close(this.filterForm.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user