Fix admin table filters

This commit is contained in:
Chocobozzz 2020-12-17 15:48:54 +01:00
parent ac2b052d54
commit 3f6441e09a
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
5 changed files with 10 additions and 6 deletions

View File

@ -108,7 +108,7 @@ export class VideoBlockListComponent extends RestTable implements OnInit, AfterV
} }
ngAfterViewInit () { ngAfterViewInit () {
if (this.search) this.setTableFilter(this.search) if (this.search) this.setTableFilter(this.search, false)
} }
/* Table filter functions */ /* Table filter functions */

View File

@ -123,7 +123,7 @@
<ng-template pTemplate="emptymessage"> <ng-template pTemplate="emptymessage">
<tr> <tr>
<td colspan="5"> <td colspan="7">
<div class="no-results"> <div class="no-results">
<ng-container *ngIf="search" i18n>No comments found matching current filters.</ng-container> <ng-container *ngIf="search" i18n>No comments found matching current filters.</ng-container>
<ng-container *ngIf="!search" i18n>No comments found.</ng-container> <ng-container *ngIf="!search" i18n>No comments found.</ng-container>

View File

@ -92,7 +92,7 @@ export class VideoCommentListComponent extends RestTable implements OnInit, Afte
} }
ngAfterViewInit () { ngAfterViewInit () {
if (this.search) this.setTableFilter(this.search) if (this.search) this.setTableFilter(this.search, false)
} }
getIdentifier () { getIdentifier () {

View File

@ -131,10 +131,14 @@ export abstract class RestTable {
this.expandedRows = {} this.expandedRows = {}
} }
setTableFilter (filter: string) { setTableFilter (filter: string, triggerEvent = true) {
// FIXME: cannot use ViewChild, so create a component for the filter input // FIXME: cannot use ViewChild, so create a component for the filter input
const filterInput = document.getElementById('table-filter') as HTMLInputElement const filterInput = document.getElementById('table-filter') as HTMLInputElement
if (filterInput) filterInput.value = filter if (!filterInput) return
filterInput.value = filter
if (triggerEvent) filterInput.dispatchEvent(new Event('keyup'))
} }
resetSearch () { resetSearch () {

View File

@ -70,7 +70,7 @@ export class AbuseListTableComponent extends RestTable implements OnInit, AfterV
} }
ngAfterViewInit () { ngAfterViewInit () {
if (this.search) this.setTableFilter(this.search) if (this.search) this.setTableFilter(this.search, false)
} }
isAdminView () { isAdminView () {