]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/rest/rest-table.ts
Fix rowsPerPage change, add filter clear button, update video-abuse-list search query...
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / rest / rest-table.ts
index 4dd0f5ff30d4eb71816baf2678ce4e5c97d7db4e..d4e6cf5f2c877b78701895429f2f06098860f3d1 100644 (file)
@@ -74,10 +74,29 @@ export abstract class RestTable {
     this.searchStream.next(target.value)
   }
 
-  onPage () {
+  onPage (event: { first: number, rows: number }) {
+    if (this.rowsPerPage !== event.rows) {
+      this.rowsPerPage = event.rows
+      this.pagination = {
+        start: event.first,
+        count: this.rowsPerPage
+      }
+      this.loadData()
+    }
     this.expandedRows = {}
   }
 
+  setTableFilter (filter: string) {
+    // FIXME: cannot use ViewChild, so create a component for the filter input
+    const filterInput = document.getElementById('table-filter') as HTMLInputElement
+    if (filterInput) filterInput.value = filter
+  }
+
+  resetSearch () {
+    this.searchStream.next('')
+    this.setTableFilter('')
+  }
+
   protected abstract loadData (): void
 
   private getSortLocalStorageKey () {