From 3f6441e09af842b4a49639cc7562865eace024bc Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 17 Dec 2020 15:48:54 +0100 Subject: Fix admin table filters --- .../moderation/video-block-list/video-block-list.component.ts | 2 +- .../video-comment-list/video-comment-list.component.html | 2 +- .../moderation/video-comment-list/video-comment-list.component.ts | 2 +- client/src/app/core/rest/rest-table.ts | 8 ++++++-- .../app/shared/shared-abuse-list/abuse-list-table.component.ts | 2 +- 5 files changed, 10 insertions(+), 6 deletions(-) (limited to 'client/src') diff --git a/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts b/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts index aa6b5d0a9..82c371f4d 100644 --- a/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts +++ b/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts @@ -108,7 +108,7 @@ export class VideoBlockListComponent extends RestTable implements OnInit, AfterV } ngAfterViewInit () { - if (this.search) this.setTableFilter(this.search) + if (this.search) this.setTableFilter(this.search, false) } /* Table filter functions */ diff --git a/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.html b/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.html index 8ec4ebbb2..8c68b0abf 100644 --- a/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.html +++ b/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.html @@ -123,7 +123,7 @@ - +
No comments found matching current filters. No comments found. diff --git a/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.ts b/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.ts index 529e28f11..63493d00d 100644 --- a/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.ts +++ b/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.ts @@ -92,7 +92,7 @@ export class VideoCommentListComponent extends RestTable implements OnInit, Afte } ngAfterViewInit () { - if (this.search) this.setTableFilter(this.search) + if (this.search) this.setTableFilter(this.search, false) } getIdentifier () { diff --git a/client/src/app/core/rest/rest-table.ts b/client/src/app/core/rest/rest-table.ts index d53cac4c8..32c1db446 100644 --- a/client/src/app/core/rest/rest-table.ts +++ b/client/src/app/core/rest/rest-table.ts @@ -131,10 +131,14 @@ export abstract class RestTable { this.expandedRows = {} } - setTableFilter (filter: string) { + setTableFilter (filter: string, triggerEvent = true) { // 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 + if (!filterInput) return + + filterInput.value = filter + + if (triggerEvent) filterInput.dispatchEvent(new Event('keyup')) } resetSearch () { diff --git a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts index 904f62b57..e34836a18 100644 --- a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts +++ b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts @@ -70,7 +70,7 @@ export class AbuseListTableComponent extends RestTable implements OnInit, AfterV } ngAfterViewInit () { - if (this.search) this.setTableFilter(this.search) + if (this.search) this.setTableFilter(this.search, false) } isAdminView () { -- cgit v1.2.3