From 844db39ee56ff0dd59a96acfc68f10f9ac53000b Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Sat, 18 Apr 2020 10:00:19 +0200 Subject: Add search for video, reporter and channel name fields --- .../video-abuse-list.component.html | 36 +++++++++++---- .../video-abuse-list.component.scss | 8 ++++ .../video-abuse-list/video-abuse-list.component.ts | 52 +++++++++++++--------- .../app/shared/video-abuse/video-abuse.service.ts | 9 +++- 4 files changed, 75 insertions(+), 30 deletions(-) (limited to 'client/src') diff --git a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.html b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.html index 2204bb371..c1ce093d7 100644 --- a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.html +++ b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.html @@ -4,6 +4,17 @@ [showCurrentPageReport]="true" i18n-currentPageReportTemplate currentPageReportTemplate="Showing {{'{first}'}} to {{'{last}'}} of {{'{totalRecords}'}} reports" > + +
+
+ +
+
+
+ @@ -40,18 +51,14 @@ - +
-
- - Deleted -
+
{{ videoAbuse.video.name }} - - +
by {{ videoAbuse.video.channel?.displayName }} on {{ videoAbuse.video.channel?.host }}
@@ -60,7 +67,20 @@
- {{ videoAbuse.createdAt }} + +
+
Deleted
+
+
+ {{ videoAbuse.video.name }} + +
+
by {{ videoAbuse.video.channel?.displayName }} on {{ videoAbuse.video.channel?.host }}
+
+
+ + + {{ videoAbuse.createdAt }} diff --git a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.scss b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.scss index 09402fda7..9b60c39dc 100644 --- a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.scss +++ b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.scss @@ -1,6 +1,14 @@ @import 'mixins'; @import 'miniature'; +.caption { + justify-content: flex-end; + + input { + @include peertube-input-text(250px); + } +} + .video-abuse-video-link { @include disable-outline; position: relative; diff --git a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts index cc5014ae8..6dcf96ccf 100644 --- a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts +++ b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts @@ -16,6 +16,8 @@ import { getAbsoluteAPIUrl } from '@app/shared/misc/utils' import { DomSanitizer } from '@angular/platform-browser' import { BlocklistService } from '@app/shared/blocklist' import { VideoService } from '@app/shared/video/video.service' +import { ActivatedRoute } from '@angular/router' +import { first } from 'rxjs/operators' @Component({ selector: 'my-video-abuse-list', @@ -43,7 +45,8 @@ export class VideoAbuseListComponent extends RestTable implements OnInit { private confirmService: ConfirmService, private i18n: I18n, private markdownRenderer: MarkdownService, - private sanitizer: DomSanitizer + private sanitizer: DomSanitizer, + private route: ActivatedRoute, ) { super() @@ -185,6 +188,10 @@ export class VideoAbuseListComponent extends RestTable implements OnInit { ngOnInit () { this.initialize() + + this.route.queryParams + .pipe(first(params => params.search !== undefined && params.search !== null)) + .subscribe(params => this.search = params.search) } getIdentifier () { @@ -253,26 +260,29 @@ export class VideoAbuseListComponent extends RestTable implements OnInit { } protected loadData () { - return this.videoAbuseService.getVideoAbuses(this.pagination, this.sort) - .subscribe( - async resultList => { - this.totalRecords = resultList.total - - this.videoAbuses = resultList.data - - for (const abuse of this.videoAbuses) { - Object.assign(abuse, { - reasonHtml: await this.toHtml(abuse.reason), - moderationCommentHtml: await this.toHtml(abuse.moderationComment), - embedHtml: this.sanitizer.bypassSecurityTrustHtml(this.getVideoEmbed(abuse)), - reporterAccount: new Account(abuse.reporterAccount) - }) - } - - }, - - err => this.notifier.error(err.message) - ) + return this.videoAbuseService.getVideoAbuses({ + pagination: this.pagination, + sort: this.sort, + search: this.search + }).subscribe( + async resultList => { + this.totalRecords = resultList.total + + this.videoAbuses = resultList.data + + for (const abuse of this.videoAbuses) { + Object.assign(abuse, { + reasonHtml: await this.toHtml(abuse.reason), + moderationCommentHtml: await this.toHtml(abuse.moderationComment), + embedHtml: this.sanitizer.bypassSecurityTrustHtml(this.getVideoEmbed(abuse)), + reporterAccount: new Account(abuse.reporterAccount) + }) + } + + }, + + err => this.notifier.error(err.message) + ) } private toHtml (text: string) { diff --git a/client/src/app/shared/video-abuse/video-abuse.service.ts b/client/src/app/shared/video-abuse/video-abuse.service.ts index 61a328575..a39ad31d4 100644 --- a/client/src/app/shared/video-abuse/video-abuse.service.ts +++ b/client/src/app/shared/video-abuse/video-abuse.service.ts @@ -17,12 +17,19 @@ export class VideoAbuseService { private restExtractor: RestExtractor ) {} - getVideoAbuses (pagination: RestPagination, sort: SortMeta): Observable> { + getVideoAbuses (options: { + pagination: RestPagination, + sort: SortMeta, + search?: string + }): Observable> { + const { pagination, sort, search } = options const url = VideoAbuseService.BASE_VIDEO_ABUSE_URL + 'abuse' let params = new HttpParams() params = this.restService.addRestGetParams(params, pagination, sort) + if (search) params = params.append('search', search) + return this.authHttp.get>(url, { params }) .pipe( map(res => this.restExtractor.convertResultListDateToHuman(res)), -- cgit v1.2.3