This commit is contained in:
+2
-2
@@ -131,8 +131,8 @@ $text-muted: #64718f;
|
||||
right: 12px;
|
||||
z-index: 2;
|
||||
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
width: 51px;
|
||||
height: 51px;
|
||||
padding: 0;
|
||||
|
||||
background: transparent;
|
||||
|
||||
@@ -299,7 +299,7 @@ export class PersonNetworkComponent implements OnInit {
|
||||
console.log('Form value when opening dialog:', this.filterForm.value);
|
||||
const dialogRef = this.dialog.open(PersonNetworkFilterDialogComponent, {
|
||||
data: {
|
||||
collaborationNetwork: this.collaborationNetwork,
|
||||
collaborationNetwork: this.collaborationNetwork(),
|
||||
filterBy: this.filterForm.get('filterBy')?.value || 'works',
|
||||
startYear: this.filterForm.get('startYear')?.value,
|
||||
|
||||
@@ -407,22 +407,34 @@ export class PersonNetworkComponent implements OnInit {
|
||||
];
|
||||
|
||||
this.filterForm.valueChanges.pipe(debounceTime(300)).subscribe((value) => {
|
||||
console.log('Form value changed:', value);
|
||||
const queryParams = {
|
||||
table: value.displayedTable ?? 'collaborators',
|
||||
search_term: value.searchTerm ?? '',
|
||||
filter_by: value.filterBy ?? 'works',
|
||||
start_year: value.startYear ?? '',
|
||||
end_year: value.endYear ?? '',
|
||||
min_contributors: value.minContributors ?? 2,
|
||||
max_contributors: value.maxContributors ?? 10,
|
||||
min_collaborations: value.minCollaborations ?? 1,
|
||||
max_collaborations: value.maxCollaborations ?? 100,
|
||||
institutions: value.institutions?.join(',') ?? '',
|
||||
topics: value.topics?.join(',') ?? '',
|
||||
};
|
||||
|
||||
const currentQueryParams = this.activatedRoute.snapshot.queryParams;
|
||||
|
||||
const hasChanged = Object.entries(queryParams).some(([key, value]) => {
|
||||
return String(currentQueryParams[key] ?? '') !== String(value ?? '');
|
||||
});
|
||||
|
||||
if (!hasChanged) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.router.navigate([], {
|
||||
relativeTo: this.activatedRoute,
|
||||
queryParams: {
|
||||
table: value.displayedTable,
|
||||
search_term: value.searchTerm,
|
||||
filter_by: value.filterBy,
|
||||
start_year: value.startYear,
|
||||
end_year: value.endYear,
|
||||
min_contributors: value.minContributors,
|
||||
max_contributors: value.maxContributors,
|
||||
min_collaborations: value.minCollaborations,
|
||||
max_collaborations: value.maxCollaborations,
|
||||
institutions: value.institutions?.join(','),
|
||||
topics: value.topics?.join(','),
|
||||
},
|
||||
queryParams,
|
||||
replaceUrl: true,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user