aboutsummaryrefslogtreecommitdiffhomepage
path: root/client
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-08-15 19:05:52 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-08-15 19:05:52 +0200
commit7eef95353f9202e1f3285606282fc8fd904c90ef (patch)
tree550a4972d55fa9d5d2673765fd1e0174198dc350 /client
parent28f7d2020fe3ffbe5ba8a0083386f616b0186a91 (diff)
downloadPeerTube-7eef95353f9202e1f3285606282fc8fd904c90ef.tar.gz
PeerTube-7eef95353f9202e1f3285606282fc8fd904c90ef.tar.zst
PeerTube-7eef95353f9202e1f3285606282fc8fd904c90ef.zip
Client: reset pagination when we search something
Diffstat (limited to 'client')
-rw-r--r--client/src/app/videos/video-list/video-list.component.ts10
-rw-r--r--client/tsconfig.json2
2 files changed, 9 insertions, 3 deletions
diff --git a/client/src/app/videos/video-list/video-list.component.ts b/client/src/app/videos/video-list/video-list.component.ts
index 062340ec5..7c6d4b992 100644
--- a/client/src/app/videos/video-list/video-list.component.ts
+++ b/client/src/app/videos/video-list/video-list.component.ts
@@ -66,6 +66,8 @@ export class VideoListComponent implements OnInit, OnDestroy {
66 // Subscribe to search changes 66 // Subscribe to search changes
67 this.subSearch = this.searchService.searchUpdated.subscribe(search => { 67 this.subSearch = this.searchService.searchUpdated.subscribe(search => {
68 this.search = search; 68 this.search = search;
69 // Reset pagination
70 this.pagination.currentPage = 1;
69 71
70 this.navigateToNewParams(); 72 this.navigateToNewParams();
71 }); 73 });
@@ -76,7 +78,7 @@ export class VideoListComponent implements OnInit, OnDestroy {
76 this.subSearch.unsubscribe(); 78 this.subSearch.unsubscribe();
77 } 79 }
78 80
79 getVideos(detectChanges = true) { 81 getVideos() {
80 this.loading.next(true); 82 this.loading.next(true);
81 this.videos = []; 83 this.videos = [];
82 84
@@ -153,7 +155,11 @@ export class VideoListComponent implements OnInit, OnDestroy {
153 155
154 this.sort = <SortField>routeParams['sort'] || '-createdDate'; 156 this.sort = <SortField>routeParams['sort'] || '-createdDate';
155 157
156 this.pagination.currentPage = parseInt(routeParams['page']) || 1; 158 if (routeParams['page'] !== undefined) {
159 this.pagination.currentPage = parseInt(routeParams['page']);
160 } else {
161 this.pagination.currentPage = 1;
162 }
157 163
158 this.changeDetector.detectChanges(); 164 this.changeDetector.detectChanges();
159 } 165 }
diff --git a/client/tsconfig.json b/client/tsconfig.json
index 7de2a1a75..20938ce55 100644
--- a/client/tsconfig.json
+++ b/client/tsconfig.json
@@ -35,12 +35,12 @@
35 "src/app/admin/admin.routes.ts", 35 "src/app/admin/admin.routes.ts",
36 "src/app/admin/friends/friend-list/friend-list.component.ts", 36 "src/app/admin/friends/friend-list/friend-list.component.ts",
37 "src/app/admin/friends/friend-list/index.ts", 37 "src/app/admin/friends/friend-list/index.ts",
38 "src/app/admin/friends/friends.component.ts",
38 "src/app/admin/friends/friends.routes.ts", 39 "src/app/admin/friends/friends.routes.ts",
39 "src/app/admin/friends/index.ts", 40 "src/app/admin/friends/index.ts",
40 "src/app/admin/friends/shared/friend.model.ts", 41 "src/app/admin/friends/shared/friend.model.ts",
41 "src/app/admin/friends/shared/friend.service.ts", 42 "src/app/admin/friends/shared/friend.service.ts",
42 "src/app/admin/friends/shared/index.ts", 43 "src/app/admin/friends/shared/index.ts",
43 "src/app/admin/friends/users.component.ts",
44 "src/app/admin/index.ts", 44 "src/app/admin/index.ts",
45 "src/app/admin/menu-admin.component.ts", 45 "src/app/admin/menu-admin.component.ts",
46 "src/app/admin/users/index.ts", 46 "src/app/admin/users/index.ts",