]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Client: reset pagination when we search something
authorChocobozzz <florian.bigard@gmail.com>
Mon, 15 Aug 2016 17:05:52 +0000 (19:05 +0200)
committerChocobozzz <florian.bigard@gmail.com>
Mon, 15 Aug 2016 17:05:52 +0000 (19:05 +0200)
client/src/app/videos/video-list/video-list.component.ts
client/tsconfig.json

index 062340ec523fce4e00de666c4984a4e11c48fca5..7c6d4b992d387463136502c05b85a81e51fe73c9 100644 (file)
@@ -66,6 +66,8 @@ export class VideoListComponent implements OnInit, OnDestroy {
     // Subscribe to search changes
     this.subSearch = this.searchService.searchUpdated.subscribe(search => {
       this.search = search;
+      // Reset pagination
+      this.pagination.currentPage = 1;
 
       this.navigateToNewParams();
     });
@@ -76,7 +78,7 @@ export class VideoListComponent implements OnInit, OnDestroy {
     this.subSearch.unsubscribe();
   }
 
-  getVideos(detectChanges = true) {
+  getVideos() {
     this.loading.next(true);
     this.videos = [];
 
@@ -153,7 +155,11 @@ export class VideoListComponent implements OnInit, OnDestroy {
 
     this.sort = <SortField>routeParams['sort'] || '-createdDate';
 
-    this.pagination.currentPage = parseInt(routeParams['page']) || 1;
+    if (routeParams['page'] !== undefined) {
+      this.pagination.currentPage = parseInt(routeParams['page']);
+    } else {
+      this.pagination.currentPage = 1;
+    }
 
     this.changeDetector.detectChanges();
   }
index 7de2a1a752fe9d8d365a60c753f77cf4e055bf21..20938ce557ad0b8adfc4350ed59f3a9fa8819400 100644 (file)
     "src/app/admin/admin.routes.ts",
     "src/app/admin/friends/friend-list/friend-list.component.ts",
     "src/app/admin/friends/friend-list/index.ts",
+    "src/app/admin/friends/friends.component.ts",
     "src/app/admin/friends/friends.routes.ts",
     "src/app/admin/friends/index.ts",
     "src/app/admin/friends/shared/friend.model.ts",
     "src/app/admin/friends/shared/friend.service.ts",
     "src/app/admin/friends/shared/index.ts",
-    "src/app/admin/friends/users.component.ts",
     "src/app/admin/index.ts",
     "src/app/admin/menu-admin.component.ts",
     "src/app/admin/users/index.ts",