diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2020-04-18 10:00:19 +0200 |
---|---|---|
committer | Rigel Kent <par@rigelk.eu> | 2020-05-01 16:41:02 +0200 |
commit | 844db39ee56ff0dd59a96acfc68f10f9ac53000b (patch) | |
tree | e9b33b09c08465e73819cf189a112ec17b044349 /client/src/app/+admin | |
parent | 36d0677ec95605eca0543712686c591fb8e6f3c1 (diff) | |
download | PeerTube-844db39ee56ff0dd59a96acfc68f10f9ac53000b.tar.gz PeerTube-844db39ee56ff0dd59a96acfc68f10f9ac53000b.tar.zst PeerTube-844db39ee56ff0dd59a96acfc68f10f9ac53000b.zip |
Add search for video, reporter and channel name fields
Diffstat (limited to 'client/src/app/+admin')
3 files changed, 67 insertions, 29 deletions
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 @@ | |||
4 | [showCurrentPageReport]="true" i18n-currentPageReportTemplate | 4 | [showCurrentPageReport]="true" i18n-currentPageReportTemplate |
5 | currentPageReportTemplate="Showing {{'{first}'}} to {{'{last}'}} of {{'{totalRecords}'}} reports" | 5 | currentPageReportTemplate="Showing {{'{first}'}} to {{'{last}'}} of {{'{totalRecords}'}} reports" |
6 | > | 6 | > |
7 | <ng-template pTemplate="caption"> | ||
8 | <div class="caption"> | ||
9 | <div class="ml-auto"> | ||
10 | <input | ||
11 | type="text" name="table-filter" id="table-filter" i18n-placeholder placeholder="Filter..." | ||
12 | (keyup)="onSearch($event)" | ||
13 | > | ||
14 | </div> | ||
15 | </div> | ||
16 | </ng-template> | ||
17 | |||
7 | <ng-template pTemplate="header"> | 18 | <ng-template pTemplate="header"> |
8 | <tr> <!-- header --> | 19 | <tr> <!-- header --> |
9 | <th style="width: 40px;"></th> | 20 | <th style="width: 40px;"></th> |
@@ -40,18 +51,14 @@ | |||
40 | </a> | 51 | </a> |
41 | </td> | 52 | </td> |
42 | 53 | ||
43 | <td> | 54 | <td *ngIf="!videoAbuse.video.deleted"> |
44 | <a [href]="getVideoUrl(videoAbuse)" class="video-abuse-video-link" i18n-title title="Open video in a new tab" target="_blank" rel="noopener noreferrer"> | 55 | <a [href]="getVideoUrl(videoAbuse)" class="video-abuse-video-link" i18n-title title="Open video in a new tab" target="_blank" rel="noopener noreferrer"> |
45 | <div class="video-abuse-video"> | 56 | <div class="video-abuse-video"> |
46 | <div class="video-abuse-video-image"> | 57 | <div class="video-abuse-video-image"><img [src]="videoAbuse.video.thumbnailPath"></div> |
47 | <img *ngIf="!videoAbuse.video.deleted" [src]="videoAbuse.video.thumbnailPath"> | ||
48 | <span *ngIf="videoAbuse.video.deleted" i18n>Deleted</span> | ||
49 | </div> | ||
50 | <div class="video-abuse-video-text"> | 58 | <div class="video-abuse-video-text"> |
51 | <div> | 59 | <div> |
52 | {{ videoAbuse.video.name }} | 60 | {{ videoAbuse.video.name }} |
53 | <span *ngIf="!videoAbuse.video.deleted && !videoAbuse.video.blacklisted" class="glyphicon glyphicon-new-window"></span> | 61 | <span *ngIf="!videoAbuse.video.blacklisted" class="glyphicon glyphicon-new-window"></span> |
54 | <span *ngIf="videoAbuse.video.deleted" i18n-title title="Video was deleted" class="glyphicon glyphicon-trash"></span> | ||
55 | <span *ngIf="videoAbuse.video.blacklisted" i18n-title title="Video was blacklisted" class="glyphicon glyphicon-ban-circle"></span> | 62 | <span *ngIf="videoAbuse.video.blacklisted" i18n-title title="Video was blacklisted" class="glyphicon glyphicon-ban-circle"></span> |
56 | </div> | 63 | </div> |
57 | <div class="text-muted">by {{ videoAbuse.video.channel?.displayName }} on {{ videoAbuse.video.channel?.host }} </div> | 64 | <div class="text-muted">by {{ videoAbuse.video.channel?.displayName }} on {{ videoAbuse.video.channel?.host }} </div> |
@@ -60,7 +67,20 @@ | |||
60 | </a> | 67 | </a> |
61 | </td> | 68 | </td> |
62 | 69 | ||
63 | <td>{{ videoAbuse.createdAt }}</td> | 70 | <td *ngIf="videoAbuse.video.deleted" class="c-hand" [pRowToggler]="videoAbuse"> |
71 | <div class="video-abuse-video" i18n-title title="Video was deleted"> | ||
72 | <div class="video-abuse-video-image"><span i18n>Deleted</span></div> | ||
73 | <div class="video-abuse-video-text"> | ||
74 | <div> | ||
75 | {{ videoAbuse.video.name }} | ||
76 | <span class="glyphicon glyphicon-trash"></span> | ||
77 | </div> | ||
78 | <div class="text-muted">by {{ videoAbuse.video.channel?.displayName }} on {{ videoAbuse.video.channel?.host }} </div> | ||
79 | </div> | ||
80 | </div> | ||
81 | </td> | ||
82 | |||
83 | <td class="c-hand" [pRowToggler]="videoAbuse">{{ videoAbuse.createdAt }}</td> | ||
64 | 84 | ||
65 | <td class="c-hand video-abuse-states" [pRowToggler]="videoAbuse"> | 85 | <td class="c-hand video-abuse-states" [pRowToggler]="videoAbuse"> |
66 | <span *ngIf="isVideoAbuseAccepted(videoAbuse)" [title]="videoAbuse.state.label" class="glyphicon glyphicon-ok"></span> | 86 | <span *ngIf="isVideoAbuseAccepted(videoAbuse)" [title]="videoAbuse.state.label" class="glyphicon glyphicon-ok"></span> |
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 @@ | |||
1 | @import 'mixins'; | 1 | @import 'mixins'; |
2 | @import 'miniature'; | 2 | @import 'miniature'; |
3 | 3 | ||
4 | .caption { | ||
5 | justify-content: flex-end; | ||
6 | |||
7 | input { | ||
8 | @include peertube-input-text(250px); | ||
9 | } | ||
10 | } | ||
11 | |||
4 | .video-abuse-video-link { | 12 | .video-abuse-video-link { |
5 | @include disable-outline; | 13 | @include disable-outline; |
6 | position: relative; | 14 | 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' | |||
16 | import { DomSanitizer } from '@angular/platform-browser' | 16 | import { DomSanitizer } from '@angular/platform-browser' |
17 | import { BlocklistService } from '@app/shared/blocklist' | 17 | import { BlocklistService } from '@app/shared/blocklist' |
18 | import { VideoService } from '@app/shared/video/video.service' | 18 | import { VideoService } from '@app/shared/video/video.service' |
19 | import { ActivatedRoute } from '@angular/router' | ||
20 | import { first } from 'rxjs/operators' | ||
19 | 21 | ||
20 | @Component({ | 22 | @Component({ |
21 | selector: 'my-video-abuse-list', | 23 | selector: 'my-video-abuse-list', |
@@ -43,7 +45,8 @@ export class VideoAbuseListComponent extends RestTable implements OnInit { | |||
43 | private confirmService: ConfirmService, | 45 | private confirmService: ConfirmService, |
44 | private i18n: I18n, | 46 | private i18n: I18n, |
45 | private markdownRenderer: MarkdownService, | 47 | private markdownRenderer: MarkdownService, |
46 | private sanitizer: DomSanitizer | 48 | private sanitizer: DomSanitizer, |
49 | private route: ActivatedRoute, | ||
47 | ) { | 50 | ) { |
48 | super() | 51 | super() |
49 | 52 | ||
@@ -185,6 +188,10 @@ export class VideoAbuseListComponent extends RestTable implements OnInit { | |||
185 | 188 | ||
186 | ngOnInit () { | 189 | ngOnInit () { |
187 | this.initialize() | 190 | this.initialize() |
191 | |||
192 | this.route.queryParams | ||
193 | .pipe(first(params => params.search !== undefined && params.search !== null)) | ||
194 | .subscribe(params => this.search = params.search) | ||
188 | } | 195 | } |
189 | 196 | ||
190 | getIdentifier () { | 197 | getIdentifier () { |
@@ -253,26 +260,29 @@ export class VideoAbuseListComponent extends RestTable implements OnInit { | |||
253 | } | 260 | } |
254 | 261 | ||
255 | protected loadData () { | 262 | protected loadData () { |
256 | return this.videoAbuseService.getVideoAbuses(this.pagination, this.sort) | 263 | return this.videoAbuseService.getVideoAbuses({ |
257 | .subscribe( | 264 | pagination: this.pagination, |
258 | async resultList => { | 265 | sort: this.sort, |
259 | this.totalRecords = resultList.total | 266 | search: this.search |
260 | 267 | }).subscribe( | |
261 | this.videoAbuses = resultList.data | 268 | async resultList => { |
262 | 269 | this.totalRecords = resultList.total | |
263 | for (const abuse of this.videoAbuses) { | 270 | |
264 | Object.assign(abuse, { | 271 | this.videoAbuses = resultList.data |
265 | reasonHtml: await this.toHtml(abuse.reason), | 272 | |
266 | moderationCommentHtml: await this.toHtml(abuse.moderationComment), | 273 | for (const abuse of this.videoAbuses) { |
267 | embedHtml: this.sanitizer.bypassSecurityTrustHtml(this.getVideoEmbed(abuse)), | 274 | Object.assign(abuse, { |
268 | reporterAccount: new Account(abuse.reporterAccount) | 275 | reasonHtml: await this.toHtml(abuse.reason), |
269 | }) | 276 | moderationCommentHtml: await this.toHtml(abuse.moderationComment), |
270 | } | 277 | embedHtml: this.sanitizer.bypassSecurityTrustHtml(this.getVideoEmbed(abuse)), |
271 | 278 | reporterAccount: new Account(abuse.reporterAccount) | |
272 | }, | 279 | }) |
273 | 280 | } | |
274 | err => this.notifier.error(err.message) | 281 | |
275 | ) | 282 | }, |
283 | |||
284 | err => this.notifier.error(err.message) | ||
285 | ) | ||
276 | } | 286 | } |
277 | 287 | ||
278 | private toHtml (text: string) { | 288 | private toHtml (text: string) { |