aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-01-20 15:06:08 +0100
committerChocobozzz <me@florianbigard.com>2023-01-20 15:06:08 +0100
commite854d57bed56bcbba4d191af54125ae6dd569a88 (patch)
treec0f772a395301dbbc40e4a014fce9fb5fec921d0
parent345f579b8e36ed743be66a1541c7444098eb0a02 (diff)
downloadPeerTube-e854d57bed56bcbba4d191af54125ae6dd569a88.tar.gz
PeerTube-e854d57bed56bcbba4d191af54125ae6dd569a88.tar.zst
PeerTube-e854d57bed56bcbba4d191af54125ae6dd569a88.zip
Refactor row selection reset
-rw-r--r--client/src/app/+admin/follows/followers-list/followers-list.component.ts2
-rw-r--r--client/src/app/+admin/follows/following-list/following-list.component.ts8
-rw-r--r--client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.ts2
-rw-r--r--client/src/app/+admin/moderation/registration-list/registration-list.component.ts2
-rw-r--r--client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts27
-rw-r--r--client/src/app/+admin/overview/comments/video-comment-list.component.ts2
-rw-r--r--client/src/app/+admin/overview/users/user-list/user-list.component.ts4
-rw-r--r--client/src/app/+admin/overview/videos/video-list.component.ts34
-rw-r--r--client/src/app/+admin/system/jobs/jobs.component.ts2
-rw-r--r--client/src/app/+my-library/my-ownership/my-ownership.component.ts2
-rw-r--r--client/src/app/+my-library/my-video-channel-syncs/my-video-channel-syncs.component.ts2
-rw-r--r--client/src/app/+my-library/my-video-imports/my-video-imports.component.ts2
-rw-r--r--client/src/app/core/rest/rest-table.ts8
-rw-r--r--client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts2
-rw-r--r--client/src/app/shared/shared-moderation/account-blocklist.component.ts2
-rw-r--r--client/src/app/shared/shared-moderation/server-blocklist.component.ts2
16 files changed, 53 insertions, 50 deletions
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 6dd64fc57..cebb2e1a2 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
@@ -140,7 +140,7 @@ export class FollowersListComponent extends RestTable <ActorFollow> implements O
140 return follow.follower.name + '@' + follow.follower.host 140 return follow.follower.name + '@' + follow.follower.host
141 } 141 }
142 142
143 protected reloadData () { 143 protected reloadDataInternal () {
144 this.followService.getFollowers({ pagination: this.pagination, sort: this.sort, search: this.search }) 144 this.followService.getFollowers({ pagination: this.pagination, sort: this.sort, search: this.search })
145 .subscribe({ 145 .subscribe({
146 next: resultList => { 146 next: resultList => {
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 e986a610a..71f2fbe66 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
@@ -62,8 +62,10 @@ export class FollowingListComponent extends RestTable <ActorFollow> implements O
62 } 62 }
63 63
64 async removeFollowing (follows: ActorFollow[]) { 64 async removeFollowing (follows: ActorFollow[]) {
65 const icuParams = { count: follows.length, entryName: this.buildFollowingName(follows[0]) }
66
65 const message = prepareIcu($localize`Do you really want to unfollow {count, plural, =1 {{entryName}?} other {{count} entries?}}`)( 67 const message = prepareIcu($localize`Do you really want to unfollow {count, plural, =1 {{entryName}?} other {{count} entries?}}`)(
66 { count: follows.length, entryName: this.buildFollowingName(follows[0]) }, 68 icuParams,
67 $localize`Do you really want to unfollow these entries?` 69 $localize`Do you really want to unfollow these entries?`
68 ) 70 )
69 71
@@ -75,7 +77,7 @@ export class FollowingListComponent extends RestTable <ActorFollow> implements O
75 next: () => { 77 next: () => {
76 // eslint-disable-next-line max-len 78 // eslint-disable-next-line max-len
77 const message = prepareIcu($localize`You are not following {count, plural, =1 {{entryName} anymore.} other {these {count} entries anymore.}}`)( 79 const message = prepareIcu($localize`You are not following {count, plural, =1 {{entryName} anymore.} other {these {count} entries anymore.}}`)(
78 { count: follows.length, entryName: this.buildFollowingName(follows[0]) }, 80 icuParams,
79 $localize`You are not following them anymore.` 81 $localize`You are not following them anymore.`
80 ) 82 )
81 83
@@ -87,7 +89,7 @@ export class FollowingListComponent extends RestTable <ActorFollow> implements O
87 }) 89 })
88 } 90 }
89 91
90 protected reloadData () { 92 protected reloadDataInternal () {
91 this.followService.getFollowing({ pagination: this.pagination, sort: this.sort, search: this.search }) 93 this.followService.getFollowing({ pagination: this.pagination, sort: this.sort, search: this.search })
92 .subscribe({ 94 .subscribe({
93 next: resultList => { 95 next: 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 a89603048..b31c5b35e 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
@@ -162,7 +162,7 @@ export class VideoRedundanciesListComponent extends RestTable implements OnInit
162 162
163 } 163 }
164 164
165 protected reloadData () { 165 protected reloadDataInternal () {
166 const options = { 166 const options = {
167 pagination: this.pagination, 167 pagination: this.pagination,
168 sort: this.sort, 168 sort: this.sort,
diff --git a/client/src/app/+admin/moderation/registration-list/registration-list.component.ts b/client/src/app/+admin/moderation/registration-list/registration-list.component.ts
index 569eccaa2..ed8fbec51 100644
--- a/client/src/app/+admin/moderation/registration-list/registration-list.component.ts
+++ b/client/src/app/+admin/moderation/registration-list/registration-list.component.ts
@@ -92,7 +92,7 @@ export class RegistrationListComponent extends RestTable <UserRegistration> impl
92 this.reloadData() 92 this.reloadData()
93 } 93 }
94 94
95 protected reloadData () { 95 protected reloadDataInternal () {
96 this.adminRegistrationService.listRegistrations({ 96 this.adminRegistrationService.listRegistrations({
97 pagination: this.pagination, 97 pagination: this.pagination,
98 sort: this.sort, 98 sort: this.sort,
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 efd99e52b..f365a2500 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
@@ -159,26 +159,25 @@ export class VideoBlockListComponent extends RestTable implements OnInit {
159 }) 159 })
160 } 160 }
161 161
162 protected reloadData () { 162 protected reloadDataInternal () {
163 this.videoBlocklistService.listBlocks({ 163 this.videoBlocklistService.listBlocks({
164 pagination: this.pagination, 164 pagination: this.pagination,
165 sort: this.sort, 165 sort: this.sort,
166 search: this.search 166 search: this.search
167 }) 167 }).subscribe({
168 .subscribe({ 168 next: async resultList => {
169 next: async resultList => { 169 this.totalRecords = resultList.total
170 this.totalRecords = resultList.total
171 170
172 this.blocklist = resultList.data 171 this.blocklist = resultList.data
173 172
174 for (const element of this.blocklist) { 173 for (const element of this.blocklist) {
175 Object.assign(element, { 174 Object.assign(element, {
176 reasonHtml: await this.toHtml(element.reason) 175 reasonHtml: await this.toHtml(element.reason)
177 }) 176 })
178 } 177 }
179 }, 178 },
180 179
181 error: err => this.notifier.error(err.message) 180 error: err => this.notifier.error(err.message)
182 }) 181 })
183 } 182 }
184} 183}
diff --git a/client/src/app/+admin/overview/comments/video-comment-list.component.ts b/client/src/app/+admin/overview/comments/video-comment-list.component.ts
index cfa68ed9d..28efdc076 100644
--- a/client/src/app/+admin/overview/comments/video-comment-list.component.ts
+++ b/client/src/app/+admin/overview/comments/video-comment-list.component.ts
@@ -117,7 +117,7 @@ export class VideoCommentListComponent extends RestTable <VideoCommentAdmin> imp
117 return this.markdownRenderer.textMarkdownToHTML({ markdown: text, withHtml: true, withEmoji: true }) 117 return this.markdownRenderer.textMarkdownToHTML({ markdown: text, withHtml: true, withEmoji: true })
118 } 118 }
119 119
120 reloadData () { 120 protected reloadDataInternal () {
121 this.videoCommentService.getAdminVideoComments({ 121 this.videoCommentService.getAdminVideoComments({
122 pagination: this.pagination, 122 pagination: this.pagination,
123 sort: this.sort, 123 sort: this.sort,
diff --git a/client/src/app/+admin/overview/users/user-list/user-list.component.ts b/client/src/app/+admin/overview/users/user-list/user-list.component.ts
index 7d62302f8..19420b748 100644
--- a/client/src/app/+admin/overview/users/user-list/user-list.component.ts
+++ b/client/src/app/+admin/overview/users/user-list/user-list.component.ts
@@ -283,9 +283,7 @@ export class UserListComponent extends RestTable <User> implements OnInit {
283 }) 283 })
284 } 284 }
285 285
286 protected reloadData () { 286 protected reloadDataInternal () {
287 this.selectedRows = []
288
289 this.userAdminService.getUsers({ 287 this.userAdminService.getUsers({
290 pagination: this.pagination, 288 pagination: this.pagination,
291 sort: this.sort, 289 sort: this.sort,
diff --git a/client/src/app/+admin/overview/videos/video-list.component.ts b/client/src/app/+admin/overview/videos/video-list.component.ts
index cd5d2eb34..1ea295499 100644
--- a/client/src/app/+admin/overview/videos/video-list.component.ts
+++ b/client/src/app/+admin/overview/videos/video-list.component.ts
@@ -183,9 +183,23 @@ export class VideoListComponent extends RestTable <Video> implements OnInit {
183 return files.reduce((p, f) => p += f.size, 0) 183 return files.reduce((p, f) => p += f.size, 0)
184 } 184 }
185 185
186 reloadData () { 186 async removeVideoFile (video: Video, file: VideoFile, type: 'hls' | 'webtorrent') {
187 this.selectedRows = [] 187 const message = $localize`Are you sure you want to delete this ${file.resolution.label} file?`
188 const res = await this.confirmService.confirm(message, $localize`Delete file`)
189 if (res === false) return
190
191 this.videoService.removeFile(video.uuid, file.id, type)
192 .subscribe({
193 next: () => {
194 this.notifier.success($localize`File removed.`)
195 this.reloadData()
196 },
197
198 error: err => this.notifier.error(err.message)
199 })
200 }
188 201
202 protected reloadDataInternal () {
189 this.loading = true 203 this.loading = true
190 204
191 this.videoAdminService.getAdminVideos({ 205 this.videoAdminService.getAdminVideos({
@@ -203,22 +217,6 @@ export class VideoListComponent extends RestTable <Video> implements OnInit {
203 }) 217 })
204 } 218 }
205 219
206 async removeVideoFile (video: Video, file: VideoFile, type: 'hls' | 'webtorrent') {
207 const message = $localize`Are you sure you want to delete this ${file.resolution.label} file?`
208 const res = await this.confirmService.confirm(message, $localize`Delete file`)
209 if (res === false) return
210
211 this.videoService.removeFile(video.uuid, file.id, type)
212 .subscribe({
213 next: () => {
214 this.notifier.success($localize`File removed.`)
215 this.reloadData()
216 },
217
218 error: err => this.notifier.error(err.message)
219 })
220 }
221
222 private async removeVideos (videos: Video[]) { 220 private async removeVideos (videos: Video[]) {
223 const message = prepareIcu($localize`Are you sure you want to delete {count, plural, =1 {this video} other {these {count} videos}}?`)( 221 const message = prepareIcu($localize`Are you sure you want to delete {count, plural, =1 {this video} other {these {count} videos}}?`)(
224 { count: videos.length }, 222 { count: videos.length },
diff --git a/client/src/app/+admin/system/jobs/jobs.component.ts b/client/src/app/+admin/system/jobs/jobs.component.ts
index 12dc88a70..6e10c81ff 100644
--- a/client/src/app/+admin/system/jobs/jobs.component.ts
+++ b/client/src/app/+admin/system/jobs/jobs.component.ts
@@ -120,7 +120,7 @@ export class JobsComponent extends RestTable implements OnInit {
120 this.reloadData() 120 this.reloadData()
121 } 121 }
122 122
123 protected reloadData () { 123 protected reloadDataInternal () {
124 let jobState = this.jobState as JobState 124 let jobState = this.jobState as JobState
125 if (this.jobState === 'all') jobState = null 125 if (this.jobState === 'all') jobState = null
126 126
diff --git a/client/src/app/+my-library/my-ownership/my-ownership.component.ts b/client/src/app/+my-library/my-ownership/my-ownership.component.ts
index 7ea940ceb..8d6a42dfb 100644
--- a/client/src/app/+my-library/my-ownership/my-ownership.component.ts
+++ b/client/src/app/+my-library/my-ownership/my-ownership.component.ts
@@ -59,7 +59,7 @@ export class MyOwnershipComponent extends RestTable implements OnInit {
59 }) 59 })
60 } 60 }
61 61
62 protected reloadData () { 62 protected reloadDataInternal () {
63 return this.videoOwnershipService.getOwnershipChanges(this.pagination, this.sort) 63 return this.videoOwnershipService.getOwnershipChanges(this.pagination, this.sort)
64 .subscribe({ 64 .subscribe({
65 next: resultList => { 65 next: resultList => {
diff --git a/client/src/app/+my-library/my-video-channel-syncs/my-video-channel-syncs.component.ts b/client/src/app/+my-library/my-video-channel-syncs/my-video-channel-syncs.component.ts
index d18e78201..74dbe222d 100644
--- a/client/src/app/+my-library/my-video-channel-syncs/my-video-channel-syncs.component.ts
+++ b/client/src/app/+my-library/my-video-channel-syncs/my-video-channel-syncs.component.ts
@@ -68,7 +68,7 @@ export class MyVideoChannelSyncsComponent extends RestTable implements OnInit {
68 ] 68 ]
69 } 69 }
70 70
71 protected reloadData () { 71 protected reloadDataInternal () {
72 this.error = undefined 72 this.error = undefined
73 73
74 this.authService.userInformationLoaded 74 this.authService.userInformationLoaded
diff --git a/client/src/app/+my-library/my-video-imports/my-video-imports.component.ts b/client/src/app/+my-library/my-video-imports/my-video-imports.component.ts
index 46d689bd1..7d82f62b9 100644
--- a/client/src/app/+my-library/my-video-imports/my-video-imports.component.ts
+++ b/client/src/app/+my-library/my-video-imports/my-video-imports.component.ts
@@ -90,7 +90,7 @@ export class MyVideoImportsComponent extends RestTable implements OnInit {
90 }) 90 })
91 } 91 }
92 92
93 protected reloadData () { 93 protected reloadDataInternal () {
94 this.videoImportService.getMyVideoImports(this.pagination, this.sort, this.search) 94 this.videoImportService.getMyVideoImports(this.pagination, this.sort, this.search)
95 .subscribe({ 95 .subscribe({
96 next: resultList => { 96 next: resultList => {
diff --git a/client/src/app/core/rest/rest-table.ts b/client/src/app/core/rest/rest-table.ts
index cfaa16af9..707110d7f 100644
--- a/client/src/app/core/rest/rest-table.ts
+++ b/client/src/app/core/rest/rest-table.ts
@@ -81,7 +81,13 @@ export abstract class RestTable <T = unknown> {
81 return this.selectedRows.length !== 0 81 return this.selectedRows.length !== 0
82 } 82 }
83 83
84 protected abstract reloadData (): void 84 protected abstract reloadDataInternal (): void
85
86 protected reloadData () {
87 this.selectedRows = []
88
89 this.reloadDataInternal()
90 }
85 91
86 private getSortLocalStorageKey () { 92 private getSortLocalStorageKey () {
87 return 'rest-table-sort-' + this.getIdentifier() 93 return 'rest-table-sort-' + this.getIdentifier()
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 569a37b17..d8470e927 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
@@ -175,7 +175,7 @@ export class AbuseListTableComponent extends RestTable implements OnInit {
175 return Actor.IS_LOCAL(abuse.reporterAccount.host) 175 return Actor.IS_LOCAL(abuse.reporterAccount.host)
176 } 176 }
177 177
178 protected reloadData () { 178 protected reloadDataInternal () {
179 debugLogger('Loading data.') 179 debugLogger('Loading data.')
180 180
181 const options = { 181 const options = {
diff --git a/client/src/app/shared/shared-moderation/account-blocklist.component.ts b/client/src/app/shared/shared-moderation/account-blocklist.component.ts
index 9ed00bc12..38dbbff78 100644
--- a/client/src/app/shared/shared-moderation/account-blocklist.component.ts
+++ b/client/src/app/shared/shared-moderation/account-blocklist.component.ts
@@ -48,7 +48,7 @@ export class GenericAccountBlocklistComponent extends RestTable implements OnIni
48 ) 48 )
49 } 49 }
50 50
51 protected reloadData () { 51 protected reloadDataInternal () {
52 const operation = this.mode === BlocklistComponentType.Account 52 const operation = this.mode === BlocklistComponentType.Account
53 ? this.blocklistService.getUserAccountBlocklist({ 53 ? this.blocklistService.getUserAccountBlocklist({
54 pagination: this.pagination, 54 pagination: this.pagination,
diff --git a/client/src/app/shared/shared-moderation/server-blocklist.component.ts b/client/src/app/shared/shared-moderation/server-blocklist.component.ts
index 1ba7a1b4d..f1bcbd561 100644
--- a/client/src/app/shared/shared-moderation/server-blocklist.component.ts
+++ b/client/src/app/shared/shared-moderation/server-blocklist.component.ts
@@ -75,7 +75,7 @@ export class GenericServerBlocklistComponent extends RestTable implements OnInit
75 }) 75 })
76 } 76 }
77 77
78 protected reloadData () { 78 protected reloadDataInternal () {
79 const operation = this.mode === BlocklistComponentType.Account 79 const operation = this.mode === BlocklistComponentType.Account
80 ? this.blocklistService.getUserServerBlocklist({ 80 ? this.blocklistService.getUserServerBlocklist({
81 pagination: this.pagination, 81 pagination: this.pagination,