diff options
author | Chocobozzz <me@florianbigard.com> | 2020-04-08 10:49:26 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-04-08 10:49:26 +0200 |
commit | 8e11a1b37cb1d226acfe494f8821e5eb6e874dd0 (patch) | |
tree | c7444cdf17dddd9debacf66dbaa54e8ee04e4b5b /client/src | |
parent | 14f83c68f11da3435940504fa4000193fb4943be (diff) | |
download | PeerTube-8e11a1b37cb1d226acfe494f8821e5eb6e874dd0.tar.gz PeerTube-8e11a1b37cb1d226acfe494f8821e5eb6e874dd0.tar.zst PeerTube-8e11a1b37cb1d226acfe494f8821e5eb6e874dd0.zip |
Fix sort in admin tables
Diffstat (limited to 'client/src')
14 files changed, 62 insertions, 6 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 707daef84..aff59a691 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 | |||
@@ -31,6 +31,10 @@ export class FollowersListComponent extends RestTable implements OnInit { | |||
31 | this.initialize() | 31 | this.initialize() |
32 | } | 32 | } |
33 | 33 | ||
34 | getIdentifier () { | ||
35 | return 'FollowersListComponent' | ||
36 | } | ||
37 | |||
34 | acceptFollower (follow: ActorFollow) { | 38 | acceptFollower (follow: ActorFollow) { |
35 | follow.state = 'accepted' | 39 | follow.state = 'accepted' |
36 | 40 | ||
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 3d78c254f..dd7629ead 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 | |||
@@ -32,6 +32,10 @@ export class FollowingListComponent extends RestTable implements OnInit { | |||
32 | this.initialize() | 32 | this.initialize() |
33 | } | 33 | } |
34 | 34 | ||
35 | getIdentifier () { | ||
36 | return 'FollowingListComponent' | ||
37 | } | ||
38 | |||
35 | async removeFollowing (follow: ActorFollow) { | 39 | async removeFollowing (follow: ActorFollow) { |
36 | const res = await this.confirmService.confirm( | 40 | const res = await this.confirmService.confirm( |
37 | this.i18n('Do you really want to unfollow {{host}}?', { host: follow.following.host }), | 41 | this.i18n('Do you really want to unfollow {{host}}?', { host: follow.following.host }), |
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 4b41d1d86..2edee99a3 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 | |||
@@ -44,6 +44,10 @@ export class VideoRedundanciesListComponent extends RestTable implements OnInit | |||
44 | this.bytesPipe = new BytesPipe() | 44 | this.bytesPipe = new BytesPipe() |
45 | } | 45 | } |
46 | 46 | ||
47 | getIdentifier () { | ||
48 | return 'VideoRedundanciesListComponent' | ||
49 | } | ||
50 | |||
47 | ngOnInit () { | 51 | ngOnInit () { |
48 | this.loadSelectLocalStorage() | 52 | this.loadSelectLocalStorage() |
49 | 53 | ||
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 03e3379e6..a3910177f 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 | |||
@@ -29,6 +29,10 @@ export class InstanceAccountBlocklistComponent extends RestTable implements OnIn | |||
29 | this.initialize() | 29 | this.initialize() |
30 | } | 30 | } |
31 | 31 | ||
32 | getIdentifier () { | ||
33 | return 'InstanceAccountBlocklistComponent' | ||
34 | } | ||
35 | |||
32 | unblockAccount (accountBlock: AccountBlock) { | 36 | unblockAccount (accountBlock: AccountBlock) { |
33 | const blockedAccount = accountBlock.blockedAccount | 37 | const blockedAccount = accountBlock.blockedAccount |
34 | 38 | ||
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 d92a4f195..5af6d8f76 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 | |||
@@ -30,6 +30,10 @@ export class InstanceServerBlocklistComponent extends RestTable implements OnIni | |||
30 | this.initialize() | 30 | this.initialize() |
31 | } | 31 | } |
32 | 32 | ||
33 | getIdentifier () { | ||
34 | return 'InstanceServerBlocklistComponent' | ||
35 | } | ||
36 | |||
33 | unblockServer (serverBlock: ServerBlock) { | 37 | unblockServer (serverBlock: ServerBlock) { |
34 | const host = serverBlock.blockedServer.host | 38 | const host = serverBlock.blockedServer.host |
35 | 39 | ||
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 51114e087..2d991aae9 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 | |||
@@ -62,6 +62,10 @@ export class VideoAbuseListComponent extends RestTable implements OnInit { | |||
62 | this.initialize() | 62 | this.initialize() |
63 | } | 63 | } |
64 | 64 | ||
65 | getIdentifier () { | ||
66 | return 'VideoAbuseListComponent' | ||
67 | } | ||
68 | |||
65 | openModerationCommentModal (videoAbuse: VideoAbuse) { | 69 | openModerationCommentModal (videoAbuse: VideoAbuse) { |
66 | this.moderationCommentModal.openModal(videoAbuse) | 70 | this.moderationCommentModal.openModal(videoAbuse) |
67 | } | 71 | } |
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 a215714b8..43b6863af 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 | |||
@@ -54,6 +54,10 @@ export class VideoBlacklistListComponent extends RestTable implements OnInit { | |||
54 | ] | 54 | ] |
55 | } | 55 | } |
56 | 56 | ||
57 | getIdentifier () { | ||
58 | return 'VideoBlacklistListComponent' | ||
59 | } | ||
60 | |||
57 | getVideoUrl (videoBlacklist: VideoBlacklist) { | 61 | getVideoUrl (videoBlacklist: VideoBlacklist) { |
58 | return Video.buildClientUrl(videoBlacklist.video.uuid) | 62 | return Video.buildClientUrl(videoBlacklist.video.uuid) |
59 | } | 63 | } |
diff --git a/client/src/app/+admin/system/jobs/jobs.component.ts b/client/src/app/+admin/system/jobs/jobs.component.ts index bc40452cf..dc8343b52 100644 --- a/client/src/app/+admin/system/jobs/jobs.component.ts +++ b/client/src/app/+admin/system/jobs/jobs.component.ts | |||
@@ -57,6 +57,10 @@ export class JobsComponent extends RestTable implements OnInit { | |||
57 | this.initialize() | 57 | this.initialize() |
58 | } | 58 | } |
59 | 59 | ||
60 | getIdentifier () { | ||
61 | return 'JobsComponent' | ||
62 | } | ||
63 | |||
60 | onJobStateOrTypeChanged () { | 64 | onJobStateOrTypeChanged () { |
61 | this.pagination.start = 0 | 65 | this.pagination.start = 0 |
62 | 66 | ||
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 6e9a1feda..0de123e93 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 | |||
@@ -86,6 +86,10 @@ export class UserListComponent extends RestTable implements OnInit { | |||
86 | ] | 86 | ] |
87 | } | 87 | } |
88 | 88 | ||
89 | getIdentifier () { | ||
90 | return 'UserListComponent' | ||
91 | } | ||
92 | |||
89 | openBanUserModal (users: User[]) { | 93 | openBanUserModal (users: User[]) { |
90 | for (const user of users) { | 94 | for (const user of users) { |
91 | if (user.username === 'root') { | 95 | if (user.username === 'root') { |
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 15b58e45c..d8e9fc514 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 | |||
@@ -29,6 +29,10 @@ export class MyAccountBlocklistComponent extends RestTable implements OnInit { | |||
29 | this.initialize() | 29 | this.initialize() |
30 | } | 30 | } |
31 | 31 | ||
32 | getIdentifier () { | ||
33 | return 'MyAccountBlocklistComponent' | ||
34 | } | ||
35 | |||
32 | unblockAccount (accountBlock: AccountBlock) { | 36 | unblockAccount (accountBlock: AccountBlock) { |
33 | const blockedAccount = accountBlock.blockedAccount | 37 | const blockedAccount = accountBlock.blockedAccount |
34 | 38 | ||
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 e735d4ab7..9049dc69c 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 | |||
@@ -30,6 +30,10 @@ export class MyAccountServerBlocklistComponent extends RestTable implements OnIn | |||
30 | this.initialize() | 30 | this.initialize() |
31 | } | 31 | } |
32 | 32 | ||
33 | getIdentifier () { | ||
34 | return 'MyAccountServerBlocklistComponent' | ||
35 | } | ||
36 | |||
33 | unblockServer (serverBlock: ServerBlock) { | 37 | unblockServer (serverBlock: ServerBlock) { |
34 | const host = serverBlock.blockedServer.host | 38 | const host = serverBlock.blockedServer.host |
35 | 39 | ||
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 cd8065800..324641be1 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 | |||
@@ -31,6 +31,10 @@ export class MyAccountOwnershipComponent extends RestTable implements OnInit { | |||
31 | this.initialize() | 31 | this.initialize() |
32 | } | 32 | } |
33 | 33 | ||
34 | getIdentifier () { | ||
35 | return 'MyAccountOwnershipComponent' | ||
36 | } | ||
37 | |||
34 | createByString (account: Account) { | 38 | createByString (account: Account) { |
35 | return Account.CREATE_BY_STRING(account.name, account.host) | 39 | return Account.CREATE_BY_STRING(account.name, account.host) |
36 | } | 40 | } |
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 74c42bb4f..9281f9789 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 | |||
@@ -20,8 +20,7 @@ export class MyAccountVideoImportsComponent extends RestTable implements OnInit | |||
20 | 20 | ||
21 | constructor ( | 21 | constructor ( |
22 | private notifier: Notifier, | 22 | private notifier: Notifier, |
23 | private videoImportService: VideoImportService, | 23 | private videoImportService: VideoImportService |
24 | private i18n: I18n | ||
25 | ) { | 24 | ) { |
26 | super() | 25 | super() |
27 | } | 26 | } |
@@ -30,6 +29,10 @@ export class MyAccountVideoImportsComponent extends RestTable implements OnInit | |||
30 | this.initialize() | 29 | this.initialize() |
31 | } | 30 | } |
32 | 31 | ||
32 | getIdentifier () { | ||
33 | return 'MyAccountVideoImportsComponent' | ||
34 | } | ||
35 | |||
33 | isVideoImportSuccess (videoImport: VideoImport) { | 36 | isVideoImportSuccess (videoImport: VideoImport) { |
34 | return videoImport.state.id === VideoImportState.SUCCESS | 37 | return videoImport.state.id === VideoImportState.SUCCESS |
35 | } | 38 | } |
diff --git a/client/src/app/shared/rest/rest-table.ts b/client/src/app/shared/rest/rest-table.ts index a33e99e25..63e0e1b97 100644 --- a/client/src/app/shared/rest/rest-table.ts +++ b/client/src/app/shared/rest/rest-table.ts | |||
@@ -13,7 +13,8 @@ export abstract class RestTable { | |||
13 | 13 | ||
14 | protected search: string | 14 | protected search: string |
15 | private searchStream: Subject<string> | 15 | private searchStream: Subject<string> |
16 | private sortLocalStorageKey = 'rest-table-sort-' + this.constructor.name | 16 | |
17 | abstract getIdentifier (): string | ||
17 | 18 | ||
18 | initialize () { | 19 | initialize () { |
19 | this.loadSort() | 20 | this.loadSort() |
@@ -21,13 +22,13 @@ export abstract class RestTable { | |||
21 | } | 22 | } |
22 | 23 | ||
23 | loadSort () { | 24 | loadSort () { |
24 | const result = peertubeLocalStorage.getItem(this.sortLocalStorageKey) | 25 | const result = peertubeLocalStorage.getItem(this.getSortLocalStorageKey()) |
25 | 26 | ||
26 | if (result) { | 27 | if (result) { |
27 | try { | 28 | try { |
28 | this.sort = JSON.parse(result) | 29 | this.sort = JSON.parse(result) |
29 | } catch (err) { | 30 | } catch (err) { |
30 | console.error('Cannot load sort of local storage key ' + this.sortLocalStorageKey, err) | 31 | console.error('Cannot load sort of local storage key ' + this.getSortLocalStorageKey(), err) |
31 | } | 32 | } |
32 | } | 33 | } |
33 | } | 34 | } |
@@ -48,7 +49,7 @@ export abstract class RestTable { | |||
48 | } | 49 | } |
49 | 50 | ||
50 | saveSort () { | 51 | saveSort () { |
51 | peertubeLocalStorage.setItem(this.sortLocalStorageKey, JSON.stringify(this.sort)) | 52 | peertubeLocalStorage.setItem(this.getSortLocalStorageKey(), JSON.stringify(this.sort)) |
52 | } | 53 | } |
53 | 54 | ||
54 | initSearch () { | 55 | initSearch () { |
@@ -71,4 +72,8 @@ export abstract class RestTable { | |||
71 | } | 72 | } |
72 | 73 | ||
73 | protected abstract loadData (): void | 74 | protected abstract loadData (): void |
75 | |||
76 | private getSortLocalStorageKey () { | ||
77 | return 'rest-table-sort-' + this.getIdentifier() | ||
78 | } | ||
74 | } | 79 | } |