From 2e46eb97154da909b82d5efe1d336a3412594ff0 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 3 May 2021 14:33:34 +0200 Subject: Refactor search filters --- .../followers-list/followers-list.component.html | 14 +++++--------- .../followers-list/followers-list.component.scss | 8 -------- .../followers-list/followers-list.component.ts | 6 +++--- .../following-list/following-list.component.html | 12 ++++-------- .../following-list/following-list.component.scss | 8 -------- .../following-list/following-list.component.ts | 6 +++--- .../video-redundancies-list.component.ts | 6 +++--- .../instance-account-blocklist.component.html | 14 +++++--------- .../video-block-list/video-block-list.component.html | 7 ++++--- .../video-block-list/video-block-list.component.scss | 17 ----------------- .../video-block-list/video-block-list.component.ts | 17 ++++++----------- .../video-comment-list.component.html | 7 ++++--- .../video-comment-list.component.scss | 17 ----------------- .../video-comment-list.component.ts | 15 ++++----------- client/src/app/+admin/system/jobs/jobs.component.ts | 6 +++--- .../+admin/users/user-list/user-list.component.html | 8 ++++---- .../app/+admin/users/user-list/user-list.component.ts | 19 +++++++------------ 17 files changed, 55 insertions(+), 132 deletions(-) (limited to 'client/src/app/+admin') diff --git a/client/src/app/+admin/follows/followers-list/followers-list.component.html b/client/src/app/+admin/follows/followers-list/followers-list.component.html index 633de9677..c2e9a4df6 100644 --- a/client/src/app/+admin/follows/followers-list/followers-list.component.html +++ b/client/src/app/+admin/follows/followers-list/followers-list.component.html @@ -4,20 +4,16 @@
-
- - - Clear filters +
+
diff --git a/client/src/app/+admin/follows/followers-list/followers-list.component.scss b/client/src/app/+admin/follows/followers-list/followers-list.component.scss index 12c0cd033..35f38aae0 100644 --- a/client/src/app/+admin/follows/followers-list/followers-list.component.scss +++ b/client/src/app/+admin/follows/followers-list/followers-list.component.scss @@ -1,14 +1,6 @@ @import '_variables'; @import '_mixins'; -.caption { - justify-content: flex-end; - - input { - @include peertube-input-text(250px); - } -} - a { @include disable-default-a-behaviour; display: inline-block; 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 904e3c338..4a312f6aa 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 @@ -59,7 +59,7 @@ export class FollowersListComponent extends RestTable implements OnInit { const handle = follow.follower.name + '@' + follow.follower.host this.notifier.success($localize`${handle} rejected from instance followers`) - this.loadData() + this.reloadData() }, err => { @@ -80,14 +80,14 @@ export class FollowersListComponent extends RestTable implements OnInit { const handle = follow.follower.name + '@' + follow.follower.host this.notifier.success($localize`${handle} removed from instance followers`) - this.loadData() + this.reloadData() }, err => this.notifier.error(err.message) ) } - protected loadData () { + protected reloadData () { this.followService.getFollowers({ pagination: this.pagination, sort: this.sort, search: this.search }) .subscribe( resultList => { diff --git a/client/src/app/+admin/follows/following-list/following-list.component.html b/client/src/app/+admin/follows/following-list/following-list.component.html index f4e6a60fe..e7c0c9088 100644 --- a/client/src/app/+admin/follows/following-list/following-list.component.html +++ b/client/src/app/+admin/follows/following-list/following-list.component.html @@ -4,8 +4,9 @@ @@ -18,13 +19,8 @@
-
- - - Clear filters +
+
diff --git a/client/src/app/+admin/follows/following-list/following-list.component.scss b/client/src/app/+admin/follows/following-list/following-list.component.scss index 797882d9a..9474b0a23 100644 --- a/client/src/app/+admin/follows/following-list/following-list.component.scss +++ b/client/src/app/+admin/follows/following-list/following-list.component.scss @@ -16,14 +16,6 @@ a { } } -.caption { - justify-content: flex-end; - - input { - @include peertube-input-text(250px); - } -} - .follow-button { @include create-button; } 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 f34490cc8..b63fe08c0 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 @@ -45,7 +45,7 @@ export class FollowingListComponent extends RestTable implements OnInit { this.followService.follow(hosts).subscribe( () => { this.notifier.success($localize`Follow request(s) sent!`) - this.loadData() + this.reloadData() }, err => this.notifier.error(err.message) @@ -62,14 +62,14 @@ export class FollowingListComponent extends RestTable implements OnInit { this.followService.unfollow(follow).subscribe( () => { this.notifier.success($localize`You are not following ${follow.following.host} anymore.`) - this.loadData() + this.reloadData() }, err => this.notifier.error(err.message) ) } - protected loadData () { + protected reloadData () { this.followService.getFollowing({ pagination: this.pagination, sort: this.sort, search: this.search }) .subscribe( resultList => { 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 d6fd1a1ab..3cd65dd6e 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 @@ -78,7 +78,7 @@ export class VideoRedundanciesListComponent extends RestTable implements OnInit this.pagination.start = 0 this.saveSelectLocalStorage() - this.loadData() + this.reloadData() } getRedundancyStrategy (redundancy: VideoRedundancy) { @@ -145,7 +145,7 @@ export class VideoRedundanciesListComponent extends RestTable implements OnInit .subscribe( () => { this.notifier.success($localize`Video redundancies removed!`) - this.loadData() + this.reloadData() }, err => this.notifier.error(err.message) @@ -153,7 +153,7 @@ export class VideoRedundanciesListComponent extends RestTable implements OnInit } - protected loadData () { + protected reloadData () { const options = { pagination: this.pagination, sort: this.sort, diff --git a/client/src/app/+admin/moderation/instance-blocklist/instance-account-blocklist.component.html b/client/src/app/+admin/moderation/instance-blocklist/instance-account-blocklist.component.html index 84ce381cc..e3a3a8320 100644 --- a/client/src/app/+admin/moderation/instance-blocklist/instance-account-blocklist.component.html +++ b/client/src/app/+admin/moderation/instance-blocklist/instance-account-blocklist.component.html @@ -1,18 +1,14 @@
-
- - - Clear filters +
+
diff --git a/client/src/app/+admin/moderation/video-block-list/video-block-list.component.html b/client/src/app/+admin/moderation/video-block-list/video-block-list.component.html index cf2466bdb..d89c8f244 100644 --- a/client/src/app/+admin/moderation/video-block-list/video-block-list.component.html +++ b/client/src/app/+admin/moderation/video-block-list/video-block-list.component.html @@ -4,8 +4,9 @@
- +
diff --git a/client/src/app/+admin/moderation/video-block-list/video-block-list.component.scss b/client/src/app/+admin/moderation/video-block-list/video-block-list.component.scss index b67e33cc1..068aa2aee 100644 --- a/client/src/app/+admin/moderation/video-block-list/video-block-list.component.scss +++ b/client/src/app/+admin/moderation/video-block-list/video-block-list.component.scss @@ -5,23 +5,6 @@ my-global-icon { height: 24px; } -.input-group { - @include peertube-input-group(300px); - - .dropdown-toggle::after { - margin-left: 0; - } -} - -.caption { - justify-content: flex-end; - - input { - @include peertube-input-text(250px); - flex-grow: 1; - } -} - .badge { @include table-badge; } 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 dfd8dc745..498d8321a 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 @@ -2,9 +2,9 @@ import { SortMeta } from 'primeng/api' import { switchMap } from 'rxjs/operators' import { buildVideoLink, buildVideoOrPlaylistEmbed } from 'src/assets/player/utils' import { environment } from 'src/environments/environment' -import { AfterViewInit, Component, OnInit } from '@angular/core' +import { Component, OnInit } from '@angular/core' import { DomSanitizer } from '@angular/platform-browser' -import { ActivatedRoute, Params, Router } from '@angular/router' +import { ActivatedRoute, Router } from '@angular/router' import { ConfirmService, MarkdownService, Notifier, RestPagination, RestTable, ServerService } from '@app/core' import { AdvancedInputFilter } from '@app/shared/shared-forms' import { DropdownAction, Video, VideoService } from '@app/shared/shared-main' @@ -16,7 +16,7 @@ import { VideoBlacklist, VideoBlacklistType } from '@shared/models' templateUrl: './video-block-list.component.html', styleUrls: [ '../../../shared/shared-moderation/moderation.scss', './video-block-list.component.scss' ] }) -export class VideoBlockListComponent extends RestTable implements OnInit, AfterViewInit { +export class VideoBlockListComponent extends RestTable implements OnInit { blocklist: (VideoBlacklist & { reasonHtml?: string, embedHtml?: string })[] = [] totalRecords = 0 sort: SortMeta = { field: 'createdAt', order: -1 } @@ -64,7 +64,7 @@ export class VideoBlockListComponent extends RestTable implements OnInit, AfterV ).subscribe( () => { this.notifier.success($localize`Video ${videoBlock.video.name} switched to manual block.`) - this.loadData() + this.reloadData() }, err => this.notifier.error(err.message) @@ -116,11 +116,6 @@ export class VideoBlockListComponent extends RestTable implements OnInit, AfterV }) this.initialize() - this.listenToSearchChange() - } - - ngAfterViewInit () { - if (this.search) this.setTableFilter(this.search, false) } getIdentifier () { @@ -144,7 +139,7 @@ export class VideoBlockListComponent extends RestTable implements OnInit, AfterV this.videoBlocklistService.unblockVideo(entry.video.id).subscribe( () => { this.notifier.success($localize`Video ${entry.video.name} unblocked.`) - this.loadData() + this.reloadData() }, err => this.notifier.error(err.message) @@ -162,7 +157,7 @@ export class VideoBlockListComponent extends RestTable implements OnInit, AfterV ) } - protected loadData () { + protected reloadData () { this.videoBlocklistService.listBlocks({ pagination: this.pagination, sort: this.sort, 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 5cc0ff137..9d9283536 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 @@ -8,8 +8,9 @@ This view also shows comments from muted accounts.
- +
diff --git a/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.scss b/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.scss index 5d97d9bdb..a6f931e3b 100644 --- a/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.scss +++ b/client/src/app/+admin/moderation/video-comment-list/video-comment-list.component.scss @@ -11,23 +11,6 @@ my-global-icon { height: 24px; } -.input-group { - @include peertube-input-group(300px); - - .dropdown-toggle::after { - margin-left: 0; - } -} - -.caption { - justify-content: flex-end; - - input { - @include peertube-input-text(250px); - flex-grow: 1; - } -} - .video { display: flex; flex-direction: column; 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 ebbbddb43..e2ae993b0 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 @@ -13,9 +13,7 @@ import { FeedFormat, UserRight } from '@shared/models' templateUrl: './video-comment-list.component.html', styleUrls: [ '../../../shared/shared-moderation/moderation.scss', './video-comment-list.component.scss' ] }) -export class VideoCommentListComponent extends RestTable implements OnInit, AfterViewInit { - baseRoute = '/admin/moderation/video-comments/list' - +export class VideoCommentListComponent extends RestTable implements OnInit { comments: VideoCommentAdmin[] totalRecords = 0 sort: SortMeta = { field: 'createdAt', order: -1 } @@ -91,7 +89,6 @@ export class VideoCommentListComponent extends RestTable implements OnInit, Afte ngOnInit () { this.initialize() - this.listenToSearchChange() this.bulkCommentActions = [ { @@ -103,10 +100,6 @@ export class VideoCommentListComponent extends RestTable implements OnInit, Afte ] } - ngAfterViewInit () { - if (this.search) this.setTableFilter(this.search, false) - } - getIdentifier () { return 'VideoCommentListComponent' } @@ -119,7 +112,7 @@ export class VideoCommentListComponent extends RestTable implements OnInit, Afte return this.selectedComments.length !== 0 } - protected loadData () { + protected reloadData () { this.videoCommentService.getAdminVideoComments({ pagination: this.pagination, sort: this.sort, @@ -147,7 +140,7 @@ export class VideoCommentListComponent extends RestTable implements OnInit, Afte this.videoCommentService.deleteVideoComments(commentArgs).subscribe( () => { this.notifier.success($localize`${commentArgs.length} comments deleted.`) - this.loadData() + this.reloadData() }, err => this.notifier.error(err.message), @@ -159,7 +152,7 @@ export class VideoCommentListComponent extends RestTable implements OnInit, Afte private deleteComment (comment: VideoCommentAdmin) { this.videoCommentService.deleteVideoComment(comment.video.id, comment.id) .subscribe( - () => this.loadData(), + () => this.reloadData(), err => this.notifier.error(err.message) ) diff --git a/client/src/app/+admin/system/jobs/jobs.component.ts b/client/src/app/+admin/system/jobs/jobs.component.ts index 43578eedd..29ba95c5c 100644 --- a/client/src/app/+admin/system/jobs/jobs.component.ts +++ b/client/src/app/+admin/system/jobs/jobs.component.ts @@ -86,7 +86,7 @@ export class JobsComponent extends RestTable implements OnInit { onJobStateOrTypeChanged () { this.pagination.start = 0 - this.loadData() + this.reloadData() this.saveJobStateAndType() } @@ -104,10 +104,10 @@ export class JobsComponent extends RestTable implements OnInit { this.jobs = [] this.totalRecords = 0 - this.loadData() + this.reloadData() } - protected loadData () { + protected reloadData () { let jobState = this.jobState as JobState if (this.jobState === 'all') jobState = null diff --git a/client/src/app/+admin/users/user-list/user-list.component.html b/client/src/app/+admin/users/user-list/user-list.component.html index 7170d7019..44d8a7e87 100644 --- a/client/src/app/+admin/users/user-list/user-list.component.html +++ b/client/src/app/+admin/users/user-list/user-list.component.html @@ -1,7 +1,7 @@
- +
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 435bc17d7..1c60adf89 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 @@ -1,5 +1,5 @@ import { SortMeta } from 'primeng/api' -import { AfterViewInit, Component, OnInit, ViewChild } from '@angular/core' +import { Component, OnInit, ViewChild } from '@angular/core' import { ActivatedRoute, Router } from '@angular/router' import { AuthService, ConfirmService, Notifier, RestPagination, RestTable, ServerService, UserService } from '@app/core' import { AdvancedInputFilter } from '@app/shared/shared-forms' @@ -19,7 +19,7 @@ type UserForList = User & { templateUrl: './user-list.component.html', styleUrls: [ './user-list.component.scss' ] }) -export class UserListComponent extends RestTable implements OnInit, AfterViewInit { +export class UserListComponent extends RestTable implements OnInit { @ViewChild('userBanModal', { static: true }) userBanModal: UserBanModalComponent users: User[] = [] @@ -78,7 +78,6 @@ export class UserListComponent extends RestTable implements OnInit, AfterViewIni .subscribe(config => this.serverConfig = config) this.initialize() - this.listenToSearchChange() this.bulkUserActions = [ [ @@ -127,10 +126,6 @@ export class UserListComponent extends RestTable implements OnInit, AfterViewIni this.columns.push({ id: 'lastLoginDate', label: 'Last login' }) } - ngAfterViewInit () { - if (this.search) this.setTableFilter(this.search, false) - } - getIdentifier () { return 'UserListComponent' } @@ -174,7 +169,7 @@ export class UserListComponent extends RestTable implements OnInit, AfterViewIni } onUserChanged () { - this.loadData() + this.reloadData() } async unbanUsers (users: User[]) { @@ -185,7 +180,7 @@ export class UserListComponent extends RestTable implements OnInit, AfterViewIni .subscribe( () => { this.notifier.success($localize`${users.length} users unbanned.`) - this.loadData() + this.reloadData() }, err => this.notifier.error(err.message) @@ -207,7 +202,7 @@ export class UserListComponent extends RestTable implements OnInit, AfterViewIni this.userService.removeUser(users).subscribe( () => { this.notifier.success($localize`${users.length} users deleted.`) - this.loadData() + this.reloadData() }, err => this.notifier.error(err.message) @@ -218,7 +213,7 @@ export class UserListComponent extends RestTable implements OnInit, AfterViewIni this.userService.updateUsers(users, { emailVerified: true }).subscribe( () => { this.notifier.success($localize`${users.length} users email set as verified.`) - this.loadData() + this.reloadData() }, err => this.notifier.error(err.message) @@ -229,7 +224,7 @@ export class UserListComponent extends RestTable implements OnInit, AfterViewIni return this.selectedUsers.length !== 0 } - protected loadData () { + protected reloadData () { this.selectedUsers = [] this.userService.getUsers({ -- cgit v1.2.3