Skip to content

Commit 03f4460

Browse files
committed
🐛 quick and dirty fix for pagination after search Result
Still has a double request issue
1 parent 87fc55b commit 03f4460

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"inactive": "Crawler ist inaktiv",
1515
"cache": "Caches werden kompiliert"
1616
},
17-
"maxProjects": 10
17+
"maxProjects": 20
1818
},
1919
"mostImportantChecks": [
2020
3,

frontend/src/app/projects-tab/projects-tab.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989

9090
<!-- Paginator and Repositories -->
9191
<mat-card-content>
92-
<mat-paginator
92+
<mat-paginator #paginator
9393
[length]="projects.totalElements"
9494
[pageSize]="pageSize"
9595
[pageSizeOptions]="pageSizeOptions"

frontend/src/app/projects-tab/projects-tab.component.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { Component } from '@angular/core';
1+
import { Component, ViewChild } from '@angular/core';
22
import { FormControl } from '@angular/forms';
33
import { OnInit } from '@angular/core';
44
import { MatDialog } from '@angular/material/dialog';
5-
import { PageEvent } from '@angular/material/paginator';
5+
import { MatPaginator, PageEvent } from '@angular/material/paginator';
66
import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
77

88
import { Config, PagedProjects } from '../schemas';
@@ -36,6 +36,7 @@ export class ProjectsTabComponent implements OnInit {
3636
config: Config;
3737
projects: PagedProjects = <PagedProjects>{ content: [], totalElements: 0 };
3838
// paging
39+
@ViewChild('paginator') paginator: MatPaginator;
3940
pageSizeOptions: number[] = [10, 25, 100];
4041
currentPage: number = 0;
4142
pageSize: number = this.pageSizeOptions[0];
@@ -111,6 +112,9 @@ export class ProjectsTabComponent implements OnInit {
111112
.subscribe(
112113
(data) => {
113114
this.projects = data;
115+
if (this.searchQuery != '') {
116+
this.paginator.firstPage();
117+
}
114118
},
115119
(error) => {
116120
this.openSnackBar('Fehler beim Laden der Projekte', 'OK');

0 commit comments

Comments
 (0)