From c8ad000f7e5502ea736490ccc59ca9205083eb04 Mon Sep 17 00:00:00 2001 From: Kazgatari <56477241+Kazgatari@users.noreply.github.com> Date: Thu, 4 Jun 2026 20:20:54 +0200 Subject: [PATCH] Default University filter value --- .../person-list/person-list.component.ts | 40 +++++++++---------- .../ui/app-menu/app-menu.component.html | 1 + .../shared/ui/app-menu/app-menu.component.ts | 8 +++- 3 files changed, 28 insertions(+), 21 deletions(-) diff --git a/webapp/src/app/modules/person-list/person-list.component.ts b/webapp/src/app/modules/person-list/person-list.component.ts index 32e0b7af..74e4b8d5 100644 --- a/webapp/src/app/modules/person-list/person-list.component.ts +++ b/webapp/src/app/modules/person-list/person-list.component.ts @@ -83,13 +83,13 @@ export class PersonListComponent { const page = params['page'] ? Number.parseInt(params['page'], 10) : 1; const pageSize = params['pageSize'] ? Number.parseInt(params['pageSize'], 10) : 10; const institutionName = params['institutionName'] || ''; - + const topics = this.parseQueryParamArray(params['topic']); - + this.selectedTopics = new Set(topics); this.currentPage = page; this.paginationService.selection = pageSize; - + // Sync search box & institution input if (this.state.searchValue() !== query) { this.state.searchValue.set(query || null); @@ -97,7 +97,7 @@ export class PersonListComponent { if (this.institutionControl.value !== institutionName) { this.institutionControl.setValue(institutionName); } - + this.load(query, page, pageSize, topics, institutionName); }); } @@ -110,7 +110,7 @@ export class PersonListComponent { institutionName?: string ): void { this.loadingState.set(true); - + this.personsSearchService.searchPersonsList( query || undefined, institutionName || undefined, @@ -119,19 +119,19 @@ export class PersonListComponent { pageSize, this.defaultIncludes ) - .pipe( - finalize(() => this.loadingState.set(false)), - takeUntilDestroyed(this.destroyRef) - ) - .subscribe({ - next: (response) => { - this.persons = (response.results ?? []) as CustomAuthor[]; - this.total = response.meta?.count ?? 0; - }, - error: (err) => { - console.error('Error loading persons:', err); - } - }); + .pipe( + finalize(() => this.loadingState.set(false)), + takeUntilDestroyed(this.destroyRef) + ) + .subscribe({ + next: (response) => { + this.persons = (response.results ?? []) as CustomAuthor[]; + this.total = response.meta?.count ?? 0; + }, + error: (err) => { + console.error('Error loading persons:', err); + } + }); } // Getters for filtered results @@ -240,11 +240,11 @@ export class PersonListComponent { const maxPagesToShow = 5; let start = Math.max(1, this.currentPage - 2); let end = Math.min(this.totalPages, start + maxPagesToShow - 1); - + if (end - start + 1 < maxPagesToShow) { start = Math.max(1, end - maxPagesToShow + 1); } - + for (let i = start; i <= end; i++) { list.push(i); } diff --git a/webapp/src/app/shared/ui/app-menu/app-menu.component.html b/webapp/src/app/shared/ui/app-menu/app-menu.component.html index fc6632aa..caea0f1d 100644 --- a/webapp/src/app/shared/ui/app-menu/app-menu.component.html +++ b/webapp/src/app/shared/ui/app-menu/app-menu.component.html @@ -19,6 +19,7 @@ diff --git a/webapp/src/app/shared/ui/app-menu/app-menu.component.ts b/webapp/src/app/shared/ui/app-menu/app-menu.component.ts index 70c0ba5e..85d9fc63 100644 --- a/webapp/src/app/shared/ui/app-menu/app-menu.component.ts +++ b/webapp/src/app/shared/ui/app-menu/app-menu.component.ts @@ -21,7 +21,13 @@ import { CredentialService } from '../../services/credential.service'; export class AppMenuComponent { navItems = [ { label: 'Dashboard', icon: 'dashboard', route: '/items', disabled: false }, - { label: 'Personen', icon: 'groups', route: '/persons', disabled: false }, + { + label: 'Personen', + icon: 'groups', + route: '/persons', + queryParams: { institutionName: 'University of Duisburg-Essen' }, + disabled: false, + }, ]; constructor(public credentialService: CredentialService) {}