aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/admin.component.ts
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2020-07-02 09:00:17 +0200
committerChocobozzz <chocobozzz@cpy.re>2020-07-02 09:22:59 +0200
commit0a4cb95c98d4b6f7c3e404535996f706c659e13e (patch)
tree4a5ac666cfcda7e4bd15a5fa07785d96e8f31738 /client/src/app/+admin/admin.component.ts
parentc7b836303c48861cc1681006fd4630d286a3b200 (diff)
downloadPeerTube-0a4cb95c98d4b6f7c3e404535996f706c659e13e.tar.gz
PeerTube-0a4cb95c98d4b6f7c3e404535996f706c659e13e.tar.zst
PeerTube-0a4cb95c98d4b6f7c3e404535996f706c659e13e.zip
simplify navigation within most admin menus
Diffstat (limited to 'client/src/app/+admin/admin.component.ts')
-rw-r--r--client/src/app/+admin/admin.component.ts71
1 files changed, 64 insertions, 7 deletions
diff --git a/client/src/app/+admin/admin.component.ts b/client/src/app/+admin/admin.component.ts
index e47c7a8f4..c1c160ad1 100644
--- a/client/src/app/+admin/admin.component.ts
+++ b/client/src/app/+admin/admin.component.ts
@@ -3,12 +3,15 @@ import { AuthService } from '@app/core'
3import { ListOverflowItem } from '@app/shared/shared-main' 3import { ListOverflowItem } from '@app/shared/shared-main'
4import { I18n } from '@ngx-translate/i18n-polyfill' 4import { I18n } from '@ngx-translate/i18n-polyfill'
5import { UserRight } from '@shared/models' 5import { UserRight } from '@shared/models'
6import { TopMenuDropdownParam } from '@app/shared/shared-main/misc/top-menu-dropdown.component'
6 7
7@Component({ 8@Component({
8 templateUrl: './admin.component.html' 9 templateUrl: './admin.component.html',
10 styleUrls: [ './admin.component.scss' ]
9}) 11})
10export class AdminComponent implements OnInit { 12export class AdminComponent implements OnInit {
11 items: ListOverflowItem[] = [] 13 items: ListOverflowItem[] = []
14 menuEntries: TopMenuDropdownParam[] = []
12 15
13 constructor ( 16 constructor (
14 private auth: AuthService, 17 private auth: AuthService,
@@ -16,12 +19,58 @@ export class AdminComponent implements OnInit {
16 ) {} 19 ) {}
17 20
18 ngOnInit () { 21 ngOnInit () {
19 if (this.hasUsersRight()) this.items.push({ label: this.i18n('Users'), routerLink: '/admin/users' }) 22 const federationItems: TopMenuDropdownParam = {
20 if (this.hasServerFollowRight()) this.items.push({ label: this.i18n('Follows & redundancies'), routerLink: '/admin/follows' }) 23 label: this.i18n('Federation'),
21 if (this.hasVideoAbusesRight() || this.hasVideoBlocklistRight()) this.items.push({ label: this.i18n('Moderation'), routerLink: '/admin/moderation' }) 24 children: [
22 if (this.hasConfigRight()) this.items.push({ label: this.i18n('Configuration'), routerLink: '/admin/config' }) 25 {
23 if (this.hasPluginsRight()) this.items.push({ label: this.i18n('Plugins/Themes'), routerLink: '/admin/plugins' }) 26 label: this.i18n('Instances you follow'),
24 if (this.hasJobsRight() || this.hasLogsRight() || this.hasDebugRight()) this.items.push({ label: this.i18n('System'), routerLink: '/admin/system' }) 27 routerLink: '/admin/follows/following-list',
28 iconName: 'sign-out'
29 },
30 {
31 label: this.i18n('Instances following you'),
32 routerLink: '/admin/follows/followers-list',
33 iconName: 'sign-in'
34 },
35 {
36 label: this.i18n('Video redundancies'),
37 routerLink: '/admin/follows/video-redundancies-list',
38 iconName: 'videos'
39 }
40 ]
41 }
42
43 const moderationItems: TopMenuDropdownParam = {
44 label: this.i18n('Moderation'),
45 children: []
46 }
47 if (this.hasVideoAbusesRight()) moderationItems.children.push({
48 label: this.i18n('Video reports'),
49 routerLink: '/admin/moderation/video-abuses/list',
50 iconName: 'flag'
51 })
52 if (this.hasVideoBlocklistRight()) moderationItems.children.push({
53 label: this.i18n('Video blocks'),
54 routerLink: '/admin/moderation/video-blocks/list',
55 iconName: 'cross'
56 })
57 if (this.hasAccountsBlocklistRight()) moderationItems.children.push({
58 label: this.i18n('Muted accounts'),
59 routerLink: '/admin/moderation/blocklist/accounts',
60 iconName: 'user'
61 })
62 if (this.hasServersBlocklistRight()) moderationItems.children.push({
63 label: this.i18n('Muted servers'),
64 routerLink: '/admin/moderation/blocklist/servers',
65 iconName: 'server'
66 })
67
68 if (this.hasUsersRight()) this.menuEntries.push({ label: this.i18n('Users'), routerLink: '/admin/users' })
69 if (this.hasServerFollowRight()) this.menuEntries.push(federationItems)
70 if (this.hasVideoAbusesRight() || this.hasVideoBlocklistRight()) this.menuEntries.push(moderationItems)
71 if (this.hasConfigRight()) this.menuEntries.push({ label: this.i18n('Configuration'), routerLink: '/admin/config' })
72 if (this.hasPluginsRight()) this.menuEntries.push({ label: this.i18n('Plugins/Themes'), routerLink: '/admin/plugins' })
73 if (this.hasJobsRight() || this.hasLogsRight() || this.hasDebugRight()) this.menuEntries.push({ label: this.i18n('System'), routerLink: '/admin/system' })
25 } 74 }
26 75
27 hasUsersRight () { 76 hasUsersRight () {
@@ -40,6 +89,14 @@ export class AdminComponent implements OnInit {
40 return this.auth.getUser().hasRight(UserRight.MANAGE_VIDEO_BLACKLIST) 89 return this.auth.getUser().hasRight(UserRight.MANAGE_VIDEO_BLACKLIST)
41 } 90 }
42 91
92 hasAccountsBlocklistRight () {
93 return this.auth.getUser().hasRight(UserRight.MANAGE_ACCOUNTS_BLOCKLIST)
94 }
95
96 hasServersBlocklistRight () {
97 return this.auth.getUser().hasRight(UserRight.MANAGE_SERVERS_BLOCKLIST)
98 }
99
43 hasConfigRight () { 100 hasConfigRight () {
44 return this.auth.getUser().hasRight(UserRight.MANAGE_CONFIGURATION) 101 return this.auth.getUser().hasRight(UserRight.MANAGE_CONFIGURATION)
45 } 102 }