From 0251197e249cc03b65805ed6805da72bf4573529 Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Mon, 20 Apr 2020 11:20:12 +0200 Subject: Factorize rest-table and fix/simplify SQL --- .../followers-list/followers-list.component.ts | 2 -- .../following-list/following-list.component.ts | 2 -- .../video-redundancies-list.component.ts | 1 - .../instance-account-blocklist.component.ts | 2 -- .../instance-server-blocklist.component.ts | 2 -- .../video-abuse-list.component.html | 26 ++++++++++++++++------ .../video-abuse-list/video-abuse-list.component.ts | 4 +--- .../video-blacklist-list.component.ts | 2 -- .../src/app/+admin/system/jobs/jobs.component.ts | 1 - .../+admin/users/user-list/user-list.component.ts | 1 - .../my-account-blocklist.component.ts | 1 - .../my-account-server-blocklist.component.ts | 1 - .../my-account-ownership.component.ts | 1 - .../my-account-video-imports.component.ts | 2 -- client/src/app/shared/rest/rest-table.ts | 4 +++- 15 files changed, 23 insertions(+), 29 deletions(-) (limited to 'client/src') diff --git a/client/src/app/+admin/follows/followers-list/followers-list.component.ts b/client/src/app/+admin/follows/followers-list/followers-list.component.ts index 00f447bb2..17352a601 100644 --- a/client/src/app/+admin/follows/followers-list/followers-list.component.ts +++ b/client/src/app/+admin/follows/followers-list/followers-list.component.ts @@ -14,8 +14,6 @@ import { I18n } from '@ngx-translate/i18n-polyfill' export class FollowersListComponent extends RestTable implements OnInit { followers: ActorFollow[] = [] totalRecords = 0 - rowsPerPageOptions = [ 20, 50, 100 ] - rowsPerPage = this.rowsPerPageOptions[0] sort: SortMeta = { field: 'createdAt', order: -1 } pagination: RestPagination = { count: this.rowsPerPage, start: 0 } diff --git a/client/src/app/+admin/follows/following-list/following-list.component.ts b/client/src/app/+admin/follows/following-list/following-list.component.ts index e1b1f8aeb..6ddbf02d6 100644 --- a/client/src/app/+admin/follows/following-list/following-list.component.ts +++ b/client/src/app/+admin/follows/following-list/following-list.component.ts @@ -18,8 +18,6 @@ export class FollowingListComponent extends RestTable implements OnInit { following: ActorFollow[] = [] totalRecords = 0 - rowsPerPageOptions = [ 20, 50, 100 ] - rowsPerPage = this.rowsPerPageOptions[0] sort: SortMeta = { field: 'createdAt', order: -1 } pagination: RestPagination = { count: this.rowsPerPage, start: 0 } diff --git a/client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.ts b/client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.ts index f91800175..267a1f58e 100644 --- a/client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.ts +++ b/client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.ts @@ -20,7 +20,6 @@ export class VideoRedundanciesListComponent extends RestTable implements OnInit videoRedundancies: VideoRedundancy[] = [] totalRecords = 0 - rowsPerPage = 10 sort: SortMeta = { field: 'name', order: 1 } pagination: RestPagination = { count: this.rowsPerPage, start: 0 } diff --git a/client/src/app/+admin/moderation/instance-blocklist/instance-account-blocklist.component.ts b/client/src/app/+admin/moderation/instance-blocklist/instance-account-blocklist.component.ts index 6bd015234..73a9ae75d 100644 --- a/client/src/app/+admin/moderation/instance-blocklist/instance-account-blocklist.component.ts +++ b/client/src/app/+admin/moderation/instance-blocklist/instance-account-blocklist.component.ts @@ -14,8 +14,6 @@ import { Actor } from '@app/shared/actor/actor.model' export class InstanceAccountBlocklistComponent extends RestTable implements OnInit { blockedAccounts: AccountBlock[] = [] totalRecords = 0 - rowsPerPageOptions = [ 20, 50, 100 ] - rowsPerPage = this.rowsPerPageOptions[0] sort: SortMeta = { field: 'createdAt', order: -1 } pagination: RestPagination = { count: this.rowsPerPage, start: 0 } diff --git a/client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.ts b/client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.ts index 344e2d135..559c9c0b0 100644 --- a/client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.ts +++ b/client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.ts @@ -17,8 +17,6 @@ export class InstanceServerBlocklistComponent extends RestTable implements OnIni blockedServers: ServerBlock[] = [] totalRecords = 0 - rowsPerPageOptions = [ 20, 50, 100 ] - rowsPerPage = this.rowsPerPageOptions[0] sort: SortMeta = { field: 'createdAt', order: -1 } pagination: RestPagination = { count: this.rowsPerPage, start: 0 } 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 6dacfe243..4afa2850b 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 @@ -20,7 +20,7 @@ Reporter Video - Created + Created State @@ -59,7 +59,9 @@ {{ videoAbuse.nth }}/{{ videoAbuse.count }} + > + {{ videoAbuse.nth }}/{{ videoAbuse.count }} +
@@ -67,7 +69,7 @@
-
by {{ videoAbuse.video.channel?.displayName }} on {{ videoAbuse.video.channel?.host }}
+
by {{ videoAbuse.video.channel?.displayName }} on {{ videoAbuse.video.channel?.host }}
@@ -75,13 +77,15 @@
-
Deleted
+
+ Deleted +
{{ videoAbuse.video.name }}
-
by {{ videoAbuse.video.channel?.displayName }} on {{ videoAbuse.video.channel?.host }}
+
by {{ videoAbuse.video.channel?.displayName }} on {{ videoAbuse.video.channel?.host }}
@@ -107,8 +111,10 @@
- +
+ +
Reporter @@ -128,6 +134,7 @@
+
Reportee @@ -147,6 +154,7 @@
+
Updated @@ -157,16 +165,20 @@ Report #{{ videoAbuse.id }}
+
Note
+
+
- The video was {{ videoAbuse.video.deleted ? 'deleted' : 'blacklisted' }} + The video was deleted + The video was blacklisted
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 2ece5dcc1..f04efa9fc 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 @@ -29,8 +29,6 @@ export class VideoAbuseListComponent extends RestTable implements OnInit, AfterV videoAbuses: (VideoAbuse & { moderationCommentHtml?: string, reasonHtml?: string })[] = [] totalRecords = 0 - rowsPerPageOptions = [ 20, 50, 100 ] - rowsPerPage = this.rowsPerPageOptions[0] sort: SortMeta = { field: 'createdAt', order: 1 } pagination: RestPagination = { count: this.rowsPerPage, start: 0 } @@ -199,7 +197,7 @@ export class VideoAbuseListComponent extends RestTable implements OnInit, AfterV } ngAfterViewInit () { - this.setTableFilter(this.search) + if (this.search) this.setTableFilter(this.search) } getIdentifier () { diff --git a/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.ts b/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.ts index e9925f9bf..63ecdeb9f 100644 --- a/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.ts +++ b/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.ts @@ -17,8 +17,6 @@ import { MarkdownService } from '@app/shared/renderer' export class VideoBlacklistListComponent extends RestTable implements OnInit { blacklist: (VideoBlacklist & { reasonHtml?: string })[] = [] totalRecords = 0 - rowsPerPageOptions = [ 20, 50, 100 ] - rowsPerPage = this.rowsPerPageOptions[0] sort: SortMeta = { field: 'createdAt', order: -1 } pagination: RestPagination = { count: this.rowsPerPage, start: 0 } listBlacklistTypeFilter: VideoBlacklistType = undefined diff --git a/client/src/app/+admin/system/jobs/jobs.component.ts b/client/src/app/+admin/system/jobs/jobs.component.ts index dc8343b52..4f7f7c368 100644 --- a/client/src/app/+admin/system/jobs/jobs.component.ts +++ b/client/src/app/+admin/system/jobs/jobs.component.ts @@ -40,7 +40,6 @@ export class JobsComponent extends RestTable implements OnInit { jobs: Job[] = [] totalRecords: number - rowsPerPage = 10 sort: SortMeta = { field: 'createdAt', order: -1 } pagination: RestPagination = { count: this.rowsPerPage, start: 0 } diff --git a/client/src/app/+admin/users/user-list/user-list.component.ts b/client/src/app/+admin/users/user-list/user-list.component.ts index 667a0e1fd..da50b7ed0 100644 --- a/client/src/app/+admin/users/user-list/user-list.component.ts +++ b/client/src/app/+admin/users/user-list/user-list.component.ts @@ -19,7 +19,6 @@ export class UserListComponent extends RestTable implements OnInit { users: User[] = [] totalRecords = 0 - rowsPerPage = 10 sort: SortMeta = { field: 'createdAt', order: 1 } pagination: RestPagination = { count: this.rowsPerPage, start: 0 } diff --git a/client/src/app/+my-account/my-account-blocklist/my-account-blocklist.component.ts b/client/src/app/+my-account/my-account-blocklist/my-account-blocklist.component.ts index d8e9fc514..fd1fabcdb 100644 --- a/client/src/app/+my-account/my-account-blocklist/my-account-blocklist.component.ts +++ b/client/src/app/+my-account/my-account-blocklist/my-account-blocklist.component.ts @@ -13,7 +13,6 @@ import { AccountBlock, BlocklistService } from '@app/shared/blocklist' export class MyAccountBlocklistComponent extends RestTable implements OnInit { blockedAccounts: AccountBlock[] = [] totalRecords = 0 - rowsPerPage = 10 sort: SortMeta = { field: 'createdAt', order: -1 } pagination: RestPagination = { count: this.rowsPerPage, start: 0 } diff --git a/client/src/app/+my-account/my-account-blocklist/my-account-server-blocklist.component.ts b/client/src/app/+my-account/my-account-blocklist/my-account-server-blocklist.component.ts index 9049dc69c..483c11804 100644 --- a/client/src/app/+my-account/my-account-blocklist/my-account-server-blocklist.component.ts +++ b/client/src/app/+my-account/my-account-blocklist/my-account-server-blocklist.component.ts @@ -14,7 +14,6 @@ import { BlocklistService } from '@app/shared/blocklist' export class MyAccountServerBlocklistComponent extends RestTable implements OnInit { blockedServers: ServerBlock[] = [] totalRecords = 0 - rowsPerPage = 10 sort: SortMeta = { field: 'createdAt', order: -1 } pagination: RestPagination = { count: this.rowsPerPage, start: 0 } diff --git a/client/src/app/+my-account/my-account-ownership/my-account-ownership.component.ts b/client/src/app/+my-account/my-account-ownership/my-account-ownership.component.ts index 324641be1..f0a6303d1 100644 --- a/client/src/app/+my-account/my-account-ownership/my-account-ownership.component.ts +++ b/client/src/app/+my-account/my-account-ownership/my-account-ownership.component.ts @@ -14,7 +14,6 @@ import { MyAccountAcceptOwnershipComponent } from './my-account-accept-ownership export class MyAccountOwnershipComponent extends RestTable implements OnInit { videoChangeOwnerships: VideoChangeOwnership[] = [] totalRecords = 0 - rowsPerPage = 10 sort: SortMeta = { field: 'createdAt', order: -1 } pagination: RestPagination = { count: this.rowsPerPage, start: 0 } diff --git a/client/src/app/+my-account/my-account-video-imports/my-account-video-imports.component.ts b/client/src/app/+my-account/my-account-video-imports/my-account-video-imports.component.ts index 9281f9789..4452154eb 100644 --- a/client/src/app/+my-account/my-account-video-imports/my-account-video-imports.component.ts +++ b/client/src/app/+my-account/my-account-video-imports/my-account-video-imports.component.ts @@ -2,7 +2,6 @@ import { Component, OnInit } from '@angular/core' import { RestPagination, RestTable } from '@app/shared' import { SortMeta } from 'primeng/api' import { Notifier } from '@app/core' -import { I18n } from '@ngx-translate/i18n-polyfill' import { VideoImport, VideoImportState } from '../../../../../shared/models/videos' import { VideoImportService } from '@app/shared/video-import' @@ -14,7 +13,6 @@ import { VideoImportService } from '@app/shared/video-import' export class MyAccountVideoImportsComponent extends RestTable implements OnInit { videoImports: VideoImport[] = [] totalRecords = 0 - rowsPerPage = 10 sort: SortMeta = { field: 'createdAt', order: 1 } pagination: RestPagination = { count: this.rowsPerPage, start: 0 } diff --git a/client/src/app/shared/rest/rest-table.ts b/client/src/app/shared/rest/rest-table.ts index 5954a7ba1..891fb7b2b 100644 --- a/client/src/app/shared/rest/rest-table.ts +++ b/client/src/app/shared/rest/rest-table.ts @@ -7,11 +7,13 @@ import { debounceTime, distinctUntilChanged } from 'rxjs/operators' export abstract class RestTable { abstract totalRecords: number - abstract rowsPerPage: number abstract sort: SortMeta abstract pagination: RestPagination search: string + rowsPerPageOptions = [ 10, 20, 50, 100 ] + rowsPerPage = this.rowsPerPageOptions[0] + private searchStream: Subject abstract getIdentifier (): string -- cgit v1.2.3