mirror of https://github.com/Chocobozzz/PeerTube
Fix sort in admin tables
parent
14f83c68f1
commit
8e11a1b37c
|
@ -31,6 +31,10 @@ export class FollowersListComponent extends RestTable implements OnInit {
|
||||||
this.initialize()
|
this.initialize()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getIdentifier () {
|
||||||
|
return 'FollowersListComponent'
|
||||||
|
}
|
||||||
|
|
||||||
acceptFollower (follow: ActorFollow) {
|
acceptFollower (follow: ActorFollow) {
|
||||||
follow.state = 'accepted'
|
follow.state = 'accepted'
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,10 @@ export class FollowingListComponent extends RestTable implements OnInit {
|
||||||
this.initialize()
|
this.initialize()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getIdentifier () {
|
||||||
|
return 'FollowingListComponent'
|
||||||
|
}
|
||||||
|
|
||||||
async removeFollowing (follow: ActorFollow) {
|
async removeFollowing (follow: ActorFollow) {
|
||||||
const res = await this.confirmService.confirm(
|
const res = await this.confirmService.confirm(
|
||||||
this.i18n('Do you really want to unfollow {{host}}?', { host: follow.following.host }),
|
this.i18n('Do you really want to unfollow {{host}}?', { host: follow.following.host }),
|
||||||
|
|
|
@ -44,6 +44,10 @@ export class VideoRedundanciesListComponent extends RestTable implements OnInit
|
||||||
this.bytesPipe = new BytesPipe()
|
this.bytesPipe = new BytesPipe()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getIdentifier () {
|
||||||
|
return 'VideoRedundanciesListComponent'
|
||||||
|
}
|
||||||
|
|
||||||
ngOnInit () {
|
ngOnInit () {
|
||||||
this.loadSelectLocalStorage()
|
this.loadSelectLocalStorage()
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,10 @@ export class InstanceAccountBlocklistComponent extends RestTable implements OnIn
|
||||||
this.initialize()
|
this.initialize()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getIdentifier () {
|
||||||
|
return 'InstanceAccountBlocklistComponent'
|
||||||
|
}
|
||||||
|
|
||||||
unblockAccount (accountBlock: AccountBlock) {
|
unblockAccount (accountBlock: AccountBlock) {
|
||||||
const blockedAccount = accountBlock.blockedAccount
|
const blockedAccount = accountBlock.blockedAccount
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,10 @@ export class InstanceServerBlocklistComponent extends RestTable implements OnIni
|
||||||
this.initialize()
|
this.initialize()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getIdentifier () {
|
||||||
|
return 'InstanceServerBlocklistComponent'
|
||||||
|
}
|
||||||
|
|
||||||
unblockServer (serverBlock: ServerBlock) {
|
unblockServer (serverBlock: ServerBlock) {
|
||||||
const host = serverBlock.blockedServer.host
|
const host = serverBlock.blockedServer.host
|
||||||
|
|
||||||
|
|
|
@ -62,6 +62,10 @@ export class VideoAbuseListComponent extends RestTable implements OnInit {
|
||||||
this.initialize()
|
this.initialize()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getIdentifier () {
|
||||||
|
return 'VideoAbuseListComponent'
|
||||||
|
}
|
||||||
|
|
||||||
openModerationCommentModal (videoAbuse: VideoAbuse) {
|
openModerationCommentModal (videoAbuse: VideoAbuse) {
|
||||||
this.moderationCommentModal.openModal(videoAbuse)
|
this.moderationCommentModal.openModal(videoAbuse)
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,6 +54,10 @@ export class VideoBlacklistListComponent extends RestTable implements OnInit {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getIdentifier () {
|
||||||
|
return 'VideoBlacklistListComponent'
|
||||||
|
}
|
||||||
|
|
||||||
getVideoUrl (videoBlacklist: VideoBlacklist) {
|
getVideoUrl (videoBlacklist: VideoBlacklist) {
|
||||||
return Video.buildClientUrl(videoBlacklist.video.uuid)
|
return Video.buildClientUrl(videoBlacklist.video.uuid)
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,6 +57,10 @@ export class JobsComponent extends RestTable implements OnInit {
|
||||||
this.initialize()
|
this.initialize()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getIdentifier () {
|
||||||
|
return 'JobsComponent'
|
||||||
|
}
|
||||||
|
|
||||||
onJobStateOrTypeChanged () {
|
onJobStateOrTypeChanged () {
|
||||||
this.pagination.start = 0
|
this.pagination.start = 0
|
||||||
|
|
||||||
|
|
|
@ -86,6 +86,10 @@ export class UserListComponent extends RestTable implements OnInit {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getIdentifier () {
|
||||||
|
return 'UserListComponent'
|
||||||
|
}
|
||||||
|
|
||||||
openBanUserModal (users: User[]) {
|
openBanUserModal (users: User[]) {
|
||||||
for (const user of users) {
|
for (const user of users) {
|
||||||
if (user.username === 'root') {
|
if (user.username === 'root') {
|
||||||
|
|
|
@ -29,6 +29,10 @@ export class MyAccountBlocklistComponent extends RestTable implements OnInit {
|
||||||
this.initialize()
|
this.initialize()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getIdentifier () {
|
||||||
|
return 'MyAccountBlocklistComponent'
|
||||||
|
}
|
||||||
|
|
||||||
unblockAccount (accountBlock: AccountBlock) {
|
unblockAccount (accountBlock: AccountBlock) {
|
||||||
const blockedAccount = accountBlock.blockedAccount
|
const blockedAccount = accountBlock.blockedAccount
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,10 @@ export class MyAccountServerBlocklistComponent extends RestTable implements OnIn
|
||||||
this.initialize()
|
this.initialize()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getIdentifier () {
|
||||||
|
return 'MyAccountServerBlocklistComponent'
|
||||||
|
}
|
||||||
|
|
||||||
unblockServer (serverBlock: ServerBlock) {
|
unblockServer (serverBlock: ServerBlock) {
|
||||||
const host = serverBlock.blockedServer.host
|
const host = serverBlock.blockedServer.host
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,10 @@ export class MyAccountOwnershipComponent extends RestTable implements OnInit {
|
||||||
this.initialize()
|
this.initialize()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getIdentifier () {
|
||||||
|
return 'MyAccountOwnershipComponent'
|
||||||
|
}
|
||||||
|
|
||||||
createByString (account: Account) {
|
createByString (account: Account) {
|
||||||
return Account.CREATE_BY_STRING(account.name, account.host)
|
return Account.CREATE_BY_STRING(account.name, account.host)
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,8 +20,7 @@ export class MyAccountVideoImportsComponent extends RestTable implements OnInit
|
||||||
|
|
||||||
constructor (
|
constructor (
|
||||||
private notifier: Notifier,
|
private notifier: Notifier,
|
||||||
private videoImportService: VideoImportService,
|
private videoImportService: VideoImportService
|
||||||
private i18n: I18n
|
|
||||||
) {
|
) {
|
||||||
super()
|
super()
|
||||||
}
|
}
|
||||||
|
@ -30,6 +29,10 @@ export class MyAccountVideoImportsComponent extends RestTable implements OnInit
|
||||||
this.initialize()
|
this.initialize()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getIdentifier () {
|
||||||
|
return 'MyAccountVideoImportsComponent'
|
||||||
|
}
|
||||||
|
|
||||||
isVideoImportSuccess (videoImport: VideoImport) {
|
isVideoImportSuccess (videoImport: VideoImport) {
|
||||||
return videoImport.state.id === VideoImportState.SUCCESS
|
return videoImport.state.id === VideoImportState.SUCCESS
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,8 @@ export abstract class RestTable {
|
||||||
|
|
||||||
protected search: string
|
protected search: string
|
||||||
private searchStream: Subject<string>
|
private searchStream: Subject<string>
|
||||||
private sortLocalStorageKey = 'rest-table-sort-' + this.constructor.name
|
|
||||||
|
abstract getIdentifier (): string
|
||||||
|
|
||||||
initialize () {
|
initialize () {
|
||||||
this.loadSort()
|
this.loadSort()
|
||||||
|
@ -21,13 +22,13 @@ export abstract class RestTable {
|
||||||
}
|
}
|
||||||
|
|
||||||
loadSort () {
|
loadSort () {
|
||||||
const result = peertubeLocalStorage.getItem(this.sortLocalStorageKey)
|
const result = peertubeLocalStorage.getItem(this.getSortLocalStorageKey())
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
try {
|
try {
|
||||||
this.sort = JSON.parse(result)
|
this.sort = JSON.parse(result)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Cannot load sort of local storage key ' + this.sortLocalStorageKey, err)
|
console.error('Cannot load sort of local storage key ' + this.getSortLocalStorageKey(), err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,7 +49,7 @@ export abstract class RestTable {
|
||||||
}
|
}
|
||||||
|
|
||||||
saveSort () {
|
saveSort () {
|
||||||
peertubeLocalStorage.setItem(this.sortLocalStorageKey, JSON.stringify(this.sort))
|
peertubeLocalStorage.setItem(this.getSortLocalStorageKey(), JSON.stringify(this.sort))
|
||||||
}
|
}
|
||||||
|
|
||||||
initSearch () {
|
initSearch () {
|
||||||
|
@ -71,4 +72,8 @@ export abstract class RestTable {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract loadData (): void
|
protected abstract loadData (): void
|
||||||
|
|
||||||
|
private getSortLocalStorageKey () {
|
||||||
|
return 'rest-table-sort-' + this.getIdentifier()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue