Refactor row selection reset
This commit is contained in:
parent
345f579b8e
commit
e854d57bed
16 changed files with 55 additions and 52 deletions
|
@ -140,7 +140,7 @@ export class FollowersListComponent extends RestTable <ActorFollow> implements O
|
||||||
return follow.follower.name + '@' + follow.follower.host
|
return follow.follower.name + '@' + follow.follower.host
|
||||||
}
|
}
|
||||||
|
|
||||||
protected reloadData () {
|
protected reloadDataInternal () {
|
||||||
this.followService.getFollowers({ pagination: this.pagination, sort: this.sort, search: this.search })
|
this.followService.getFollowers({ pagination: this.pagination, sort: this.sort, search: this.search })
|
||||||
.subscribe({
|
.subscribe({
|
||||||
next: resultList => {
|
next: resultList => {
|
||||||
|
|
|
@ -62,8 +62,10 @@ export class FollowingListComponent extends RestTable <ActorFollow> implements O
|
||||||
}
|
}
|
||||||
|
|
||||||
async removeFollowing (follows: ActorFollow[]) {
|
async removeFollowing (follows: ActorFollow[]) {
|
||||||
|
const icuParams = { count: follows.length, entryName: this.buildFollowingName(follows[0]) }
|
||||||
|
|
||||||
const message = prepareIcu($localize`Do you really want to unfollow {count, plural, =1 {{entryName}?} other {{count} entries?}}`)(
|
const message = prepareIcu($localize`Do you really want to unfollow {count, plural, =1 {{entryName}?} other {{count} entries?}}`)(
|
||||||
{ count: follows.length, entryName: this.buildFollowingName(follows[0]) },
|
icuParams,
|
||||||
$localize`Do you really want to unfollow these entries?`
|
$localize`Do you really want to unfollow these entries?`
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -75,7 +77,7 @@ export class FollowingListComponent extends RestTable <ActorFollow> implements O
|
||||||
next: () => {
|
next: () => {
|
||||||
// eslint-disable-next-line max-len
|
// eslint-disable-next-line max-len
|
||||||
const message = prepareIcu($localize`You are not following {count, plural, =1 {{entryName} anymore.} other {these {count} entries anymore.}}`)(
|
const message = prepareIcu($localize`You are not following {count, plural, =1 {{entryName} anymore.} other {these {count} entries anymore.}}`)(
|
||||||
{ count: follows.length, entryName: this.buildFollowingName(follows[0]) },
|
icuParams,
|
||||||
$localize`You are not following them anymore.`
|
$localize`You are not following them anymore.`
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -87,7 +89,7 @@ export class FollowingListComponent extends RestTable <ActorFollow> implements O
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
protected reloadData () {
|
protected reloadDataInternal () {
|
||||||
this.followService.getFollowing({ pagination: this.pagination, sort: this.sort, search: this.search })
|
this.followService.getFollowing({ pagination: this.pagination, sort: this.sort, search: this.search })
|
||||||
.subscribe({
|
.subscribe({
|
||||||
next: resultList => {
|
next: resultList => {
|
||||||
|
|
|
@ -162,7 +162,7 @@ export class VideoRedundanciesListComponent extends RestTable implements OnInit
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected reloadData () {
|
protected reloadDataInternal () {
|
||||||
const options = {
|
const options = {
|
||||||
pagination: this.pagination,
|
pagination: this.pagination,
|
||||||
sort: this.sort,
|
sort: this.sort,
|
||||||
|
|
|
@ -92,7 +92,7 @@ export class RegistrationListComponent extends RestTable <UserRegistration> impl
|
||||||
this.reloadData()
|
this.reloadData()
|
||||||
}
|
}
|
||||||
|
|
||||||
protected reloadData () {
|
protected reloadDataInternal () {
|
||||||
this.adminRegistrationService.listRegistrations({
|
this.adminRegistrationService.listRegistrations({
|
||||||
pagination: this.pagination,
|
pagination: this.pagination,
|
||||||
sort: this.sort,
|
sort: this.sort,
|
||||||
|
|
|
@ -159,13 +159,12 @@ export class VideoBlockListComponent extends RestTable implements OnInit {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
protected reloadData () {
|
protected reloadDataInternal () {
|
||||||
this.videoBlocklistService.listBlocks({
|
this.videoBlocklistService.listBlocks({
|
||||||
pagination: this.pagination,
|
pagination: this.pagination,
|
||||||
sort: this.sort,
|
sort: this.sort,
|
||||||
search: this.search
|
search: this.search
|
||||||
})
|
}).subscribe({
|
||||||
.subscribe({
|
|
||||||
next: async resultList => {
|
next: async resultList => {
|
||||||
this.totalRecords = resultList.total
|
this.totalRecords = resultList.total
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,7 @@ export class VideoCommentListComponent extends RestTable <VideoCommentAdmin> imp
|
||||||
return this.markdownRenderer.textMarkdownToHTML({ markdown: text, withHtml: true, withEmoji: true })
|
return this.markdownRenderer.textMarkdownToHTML({ markdown: text, withHtml: true, withEmoji: true })
|
||||||
}
|
}
|
||||||
|
|
||||||
reloadData () {
|
protected reloadDataInternal () {
|
||||||
this.videoCommentService.getAdminVideoComments({
|
this.videoCommentService.getAdminVideoComments({
|
||||||
pagination: this.pagination,
|
pagination: this.pagination,
|
||||||
sort: this.sort,
|
sort: this.sort,
|
||||||
|
|
|
@ -283,9 +283,7 @@ export class UserListComponent extends RestTable <User> implements OnInit {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
protected reloadData () {
|
protected reloadDataInternal () {
|
||||||
this.selectedRows = []
|
|
||||||
|
|
||||||
this.userAdminService.getUsers({
|
this.userAdminService.getUsers({
|
||||||
pagination: this.pagination,
|
pagination: this.pagination,
|
||||||
sort: this.sort,
|
sort: this.sort,
|
||||||
|
|
|
@ -183,9 +183,23 @@ export class VideoListComponent extends RestTable <Video> implements OnInit {
|
||||||
return files.reduce((p, f) => p += f.size, 0)
|
return files.reduce((p, f) => p += f.size, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
reloadData () {
|
async removeVideoFile (video: Video, file: VideoFile, type: 'hls' | 'webtorrent') {
|
||||||
this.selectedRows = []
|
const message = $localize`Are you sure you want to delete this ${file.resolution.label} file?`
|
||||||
|
const res = await this.confirmService.confirm(message, $localize`Delete file`)
|
||||||
|
if (res === false) return
|
||||||
|
|
||||||
|
this.videoService.removeFile(video.uuid, file.id, type)
|
||||||
|
.subscribe({
|
||||||
|
next: () => {
|
||||||
|
this.notifier.success($localize`File removed.`)
|
||||||
|
this.reloadData()
|
||||||
|
},
|
||||||
|
|
||||||
|
error: err => this.notifier.error(err.message)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
protected reloadDataInternal () {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
|
|
||||||
this.videoAdminService.getAdminVideos({
|
this.videoAdminService.getAdminVideos({
|
||||||
|
@ -203,22 +217,6 @@ export class VideoListComponent extends RestTable <Video> implements OnInit {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async removeVideoFile (video: Video, file: VideoFile, type: 'hls' | 'webtorrent') {
|
|
||||||
const message = $localize`Are you sure you want to delete this ${file.resolution.label} file?`
|
|
||||||
const res = await this.confirmService.confirm(message, $localize`Delete file`)
|
|
||||||
if (res === false) return
|
|
||||||
|
|
||||||
this.videoService.removeFile(video.uuid, file.id, type)
|
|
||||||
.subscribe({
|
|
||||||
next: () => {
|
|
||||||
this.notifier.success($localize`File removed.`)
|
|
||||||
this.reloadData()
|
|
||||||
},
|
|
||||||
|
|
||||||
error: err => this.notifier.error(err.message)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
private async removeVideos (videos: Video[]) {
|
private async removeVideos (videos: Video[]) {
|
||||||
const message = prepareIcu($localize`Are you sure you want to delete {count, plural, =1 {this video} other {these {count} videos}}?`)(
|
const message = prepareIcu($localize`Are you sure you want to delete {count, plural, =1 {this video} other {these {count} videos}}?`)(
|
||||||
{ count: videos.length },
|
{ count: videos.length },
|
||||||
|
|
|
@ -120,7 +120,7 @@ export class JobsComponent extends RestTable implements OnInit {
|
||||||
this.reloadData()
|
this.reloadData()
|
||||||
}
|
}
|
||||||
|
|
||||||
protected reloadData () {
|
protected reloadDataInternal () {
|
||||||
let jobState = this.jobState as JobState
|
let jobState = this.jobState as JobState
|
||||||
if (this.jobState === 'all') jobState = null
|
if (this.jobState === 'all') jobState = null
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ export class MyOwnershipComponent extends RestTable implements OnInit {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
protected reloadData () {
|
protected reloadDataInternal () {
|
||||||
return this.videoOwnershipService.getOwnershipChanges(this.pagination, this.sort)
|
return this.videoOwnershipService.getOwnershipChanges(this.pagination, this.sort)
|
||||||
.subscribe({
|
.subscribe({
|
||||||
next: resultList => {
|
next: resultList => {
|
||||||
|
|
|
@ -68,7 +68,7 @@ export class MyVideoChannelSyncsComponent extends RestTable implements OnInit {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
protected reloadData () {
|
protected reloadDataInternal () {
|
||||||
this.error = undefined
|
this.error = undefined
|
||||||
|
|
||||||
this.authService.userInformationLoaded
|
this.authService.userInformationLoaded
|
||||||
|
|
|
@ -90,7 +90,7 @@ export class MyVideoImportsComponent extends RestTable implements OnInit {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
protected reloadData () {
|
protected reloadDataInternal () {
|
||||||
this.videoImportService.getMyVideoImports(this.pagination, this.sort, this.search)
|
this.videoImportService.getMyVideoImports(this.pagination, this.sort, this.search)
|
||||||
.subscribe({
|
.subscribe({
|
||||||
next: resultList => {
|
next: resultList => {
|
||||||
|
|
|
@ -81,7 +81,13 @@ export abstract class RestTable <T = unknown> {
|
||||||
return this.selectedRows.length !== 0
|
return this.selectedRows.length !== 0
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract reloadData (): void
|
protected abstract reloadDataInternal (): void
|
||||||
|
|
||||||
|
protected reloadData () {
|
||||||
|
this.selectedRows = []
|
||||||
|
|
||||||
|
this.reloadDataInternal()
|
||||||
|
}
|
||||||
|
|
||||||
private getSortLocalStorageKey () {
|
private getSortLocalStorageKey () {
|
||||||
return 'rest-table-sort-' + this.getIdentifier()
|
return 'rest-table-sort-' + this.getIdentifier()
|
||||||
|
|
|
@ -175,7 +175,7 @@ export class AbuseListTableComponent extends RestTable implements OnInit {
|
||||||
return Actor.IS_LOCAL(abuse.reporterAccount.host)
|
return Actor.IS_LOCAL(abuse.reporterAccount.host)
|
||||||
}
|
}
|
||||||
|
|
||||||
protected reloadData () {
|
protected reloadDataInternal () {
|
||||||
debugLogger('Loading data.')
|
debugLogger('Loading data.')
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
|
|
|
@ -48,7 +48,7 @@ export class GenericAccountBlocklistComponent extends RestTable implements OnIni
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
protected reloadData () {
|
protected reloadDataInternal () {
|
||||||
const operation = this.mode === BlocklistComponentType.Account
|
const operation = this.mode === BlocklistComponentType.Account
|
||||||
? this.blocklistService.getUserAccountBlocklist({
|
? this.blocklistService.getUserAccountBlocklist({
|
||||||
pagination: this.pagination,
|
pagination: this.pagination,
|
||||||
|
|
|
@ -75,7 +75,7 @@ export class GenericServerBlocklistComponent extends RestTable implements OnInit
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
protected reloadData () {
|
protected reloadDataInternal () {
|
||||||
const operation = this.mode === BlocklistComponentType.Account
|
const operation = this.mode === BlocklistComponentType.Account
|
||||||
? this.blocklistService.getUserServerBlocklist({
|
? this.blocklistService.getUserServerBlocklist({
|
||||||
pagination: this.pagination,
|
pagination: this.pagination,
|
||||||
|
|
Loading…
Reference in a new issue