aboutsummaryrefslogtreecommitdiffhomepage
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
parentc7b836303c48861cc1681006fd4630d286a3b200 (diff)
downloadPeerTube-0a4cb95c98d4b6f7c3e404535996f706c659e13e.tar.gz
PeerTube-0a4cb95c98d4b6f7c3e404535996f706c659e13e.tar.zst
PeerTube-0a4cb95c98d4b6f7c3e404535996f706c659e13e.zip
simplify navigation within most admin menus
-rw-r--r--client/src/app/+admin/admin.component.html8
-rw-r--r--client/src/app/+admin/admin.component.scss3
-rw-r--r--client/src/app/+admin/admin.component.ts71
-rw-r--r--client/src/app/+admin/follows/follows.component.html12
-rw-r--r--client/src/app/+admin/moderation/moderation.component.html14
-rw-r--r--client/src/app/+admin/moderation/moderation.component.ts21
-rw-r--r--client/src/app/+my-account/my-account.component.ts2
-rw-r--r--client/src/app/+my-account/my-account.module.ts3
-rw-r--r--client/src/app/shared/shared-icons/global-icon.component.ts1
-rw-r--r--client/src/app/shared/shared-main/misc/index.ts1
-rw-r--r--client/src/app/shared/shared-main/misc/top-menu-dropdown.component.html (renamed from client/src/app/+my-account/top-menu-dropdown.component.html)0
-rw-r--r--client/src/app/shared/shared-main/misc/top-menu-dropdown.component.scss (renamed from client/src/app/+my-account/top-menu-dropdown.component.scss)0
-rw-r--r--client/src/app/shared/shared-main/misc/top-menu-dropdown.component.ts (renamed from client/src/app/+my-account/top-menu-dropdown.component.ts)0
-rw-r--r--client/src/app/shared/shared-main/shared-main.module.ts10
-rw-r--r--client/src/assets/images/feather/log-in.svg1
15 files changed, 77 insertions, 70 deletions
diff --git a/client/src/app/+admin/admin.component.html b/client/src/app/+admin/admin.component.html
index 76d297c52..3999252be 100644
--- a/client/src/app/+admin/admin.component.html
+++ b/client/src/app/+admin/admin.component.html
@@ -1,11 +1,5 @@
1<div class="row"> 1<div class="row">
2 <div class="sub-menu"> 2 <my-top-menu-dropdown [menuEntries]="menuEntries"></my-top-menu-dropdown>
3 <ng-template #linkTemplate let-item="item">
4 <a [routerLink]="item.routerLink" routerLinkActive="active" class="title-page title-page-settings">{{ item.label }}</a>
5 </ng-template>
6
7 <list-overflow [items]="items" [itemTemplate]="linkTemplate"></list-overflow>
8 </div>
9 3
10 <div class="margin-content"> 4 <div class="margin-content">
11 <router-outlet></router-outlet> 5 <router-outlet></router-outlet>
diff --git a/client/src/app/+admin/admin.component.scss b/client/src/app/+admin/admin.component.scss
new file mode 100644
index 000000000..ef8965c3f
--- /dev/null
+++ b/client/src/app/+admin/admin.component.scss
@@ -0,0 +1,3 @@
1my-top-menu-dropdown {
2 flex-grow: 1;
3}
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 }
diff --git a/client/src/app/+admin/follows/follows.component.html b/client/src/app/+admin/follows/follows.component.html
index 8c3129394..0680b43f9 100644
--- a/client/src/app/+admin/follows/follows.component.html
+++ b/client/src/app/+admin/follows/follows.component.html
@@ -1,13 +1 @@
1<div class="admin-sub-header">
2 <h1 i18n class="form-sub-title">Follows & redundancies</h1>
3
4 <div class="admin-sub-nav">
5 <a i18n routerLink="following-list" routerLinkActive="active">Following</a>
6
7 <a i18n routerLink="followers-list" routerLinkActive="active">Followers</a>
8
9 <a i18n routerLink="video-redundancies-list" routerLinkActive="active">Video redundancies</a>
10 </div>
11</div>
12
13<router-outlet></router-outlet> <router-outlet></router-outlet>
diff --git a/client/src/app/+admin/moderation/moderation.component.html b/client/src/app/+admin/moderation/moderation.component.html
index 7bab63c33..90c6b6463 100644
--- a/client/src/app/+admin/moderation/moderation.component.html
+++ b/client/src/app/+admin/moderation/moderation.component.html
@@ -1,15 +1 @@
1<div class="admin-sub-header">
2 <h1 i18n class="form-sub-title">Moderation</h1>
3
4 <div class="admin-sub-nav">
5 <a *ngIf="hasVideoAbusesRight()" i18n routerLink="video-abuses/list" routerLinkActive="active">Video reports</a>
6
7 <a *ngIf="hasVideoBlocklistRight()" i18n routerLink="video-blocks/list" routerLinkActive="active">Video blocks</a>
8
9 <a *ngIf="hasAccountsBlocklistRight()" i18n routerLink="blocklist/accounts" routerLinkActive="active">Muted accounts</a>
10
11 <a *ngIf="hasServersBlocklistRight()" i18n routerLink="blocklist/servers" routerLinkActive="active">Muted servers</a>
12 </div>
13</div>
14
15<router-outlet></router-outlet> \ No newline at end of file <router-outlet></router-outlet> \ No newline at end of file
diff --git a/client/src/app/+admin/moderation/moderation.component.ts b/client/src/app/+admin/moderation/moderation.component.ts
index 806f9d100..b0f5eb224 100644
--- a/client/src/app/+admin/moderation/moderation.component.ts
+++ b/client/src/app/+admin/moderation/moderation.component.ts
@@ -1,6 +1,5 @@
1import { Component, OnInit } from '@angular/core' 1import { Component, OnInit } from '@angular/core'
2import { AuthService, ServerService } from '@app/core' 2import { ServerService } from '@app/core'
3import { UserRight } from '@shared/models'
4 3
5@Component({ 4@Component({
6 templateUrl: './moderation.component.html', 5 templateUrl: './moderation.component.html',
@@ -10,29 +9,11 @@ export class ModerationComponent implements OnInit {
10 autoBlockVideosEnabled = false 9 autoBlockVideosEnabled = false
11 10
12 constructor ( 11 constructor (
13 private auth: AuthService,
14 private serverService: ServerService 12 private serverService: ServerService
15 ) { } 13 ) { }
16 14
17 ngOnInit (): void { 15 ngOnInit (): void {
18 this.serverService.getConfig() 16 this.serverService.getConfig()
19 .subscribe(config => this.autoBlockVideosEnabled = config.autoBlacklist.videos.ofUsers.enabled) 17 .subscribe(config => this.autoBlockVideosEnabled = config.autoBlacklist.videos.ofUsers.enabled)
20
21 }
22
23 hasVideoAbusesRight () {
24 return this.auth.getUser().hasRight(UserRight.MANAGE_VIDEO_ABUSES)
25 }
26
27 hasVideoBlocklistRight () {
28 return this.auth.getUser().hasRight(UserRight.MANAGE_VIDEO_BLACKLIST)
29 }
30
31 hasAccountsBlocklistRight () {
32 return this.auth.getUser().hasRight(UserRight.MANAGE_ACCOUNTS_BLOCKLIST)
33 }
34
35 hasServersBlocklistRight () {
36 return this.auth.getUser().hasRight(UserRight.MANAGE_SERVERS_BLOCKLIST)
37 } 18 }
38} 19}
diff --git a/client/src/app/+my-account/my-account.component.ts b/client/src/app/+my-account/my-account.component.ts
index 85b2795c5..abc823c62 100644
--- a/client/src/app/+my-account/my-account.component.ts
+++ b/client/src/app/+my-account/my-account.component.ts
@@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core'
2import { ServerService } from '@app/core' 2import { ServerService } from '@app/core'
3import { I18n } from '@ngx-translate/i18n-polyfill' 3import { I18n } from '@ngx-translate/i18n-polyfill'
4import { ServerConfig } from '@shared/models' 4import { ServerConfig } from '@shared/models'
5import { TopMenuDropdownParam } from './top-menu-dropdown.component' 5import { TopMenuDropdownParam } from '../shared/shared-main/misc/top-menu-dropdown.component'
6 6
7@Component({ 7@Component({
8 selector: 'my-my-account', 8 selector: 'my-my-account',
diff --git a/client/src/app/+my-account/my-account.module.ts b/client/src/app/+my-account/my-account.module.ts
index 8604b8b60..0ce243844 100644
--- a/client/src/app/+my-account/my-account.module.ts
+++ b/client/src/app/+my-account/my-account.module.ts
@@ -33,7 +33,6 @@ import { MyAccountVideoPlaylistsComponent } from './my-account-video-playlists/m
33import { MyAccountVideosComponent } from './my-account-videos/my-account-videos.component' 33import { MyAccountVideosComponent } from './my-account-videos/my-account-videos.component'
34import { VideoChangeOwnershipComponent } from './my-account-videos/video-change-ownership/video-change-ownership.component' 34import { VideoChangeOwnershipComponent } from './my-account-videos/video-change-ownership/video-change-ownership.component'
35import { MyAccountComponent } from './my-account.component' 35import { MyAccountComponent } from './my-account.component'
36import { TopMenuDropdownComponent } from './top-menu-dropdown.component'
37 36
38@NgModule({ 37@NgModule({
39 imports: [ 38 imports: [
@@ -79,8 +78,6 @@ import { TopMenuDropdownComponent } from './top-menu-dropdown.component'
79 MyAccountVideoPlaylistUpdateComponent, 78 MyAccountVideoPlaylistUpdateComponent,
80 MyAccountVideoPlaylistsComponent, 79 MyAccountVideoPlaylistsComponent,
81 MyAccountVideoPlaylistElementsComponent, 80 MyAccountVideoPlaylistElementsComponent,
82
83 TopMenuDropdownComponent
84 ], 81 ],
85 82
86 exports: [ 83 exports: [
diff --git a/client/src/app/shared/shared-icons/global-icon.component.ts b/client/src/app/shared/shared-icons/global-icon.component.ts
index 75ab9e8f5..7f7315f06 100644
--- a/client/src/app/shared/shared-icons/global-icon.component.ts
+++ b/client/src/app/shared/shared-icons/global-icon.component.ts
@@ -34,6 +34,7 @@ const icons = {
34 'delete': require('!!raw-loader?!../../../assets/images/feather/delete.svg').default, 34 'delete': require('!!raw-loader?!../../../assets/images/feather/delete.svg').default,
35 'inbox-full': require('!!raw-loader?!../../../assets/images/feather/inbox-full.svg').default, 35 'inbox-full': require('!!raw-loader?!../../../assets/images/feather/inbox-full.svg').default,
36 'sign-out': require('!!raw-loader?!../../../assets/images/feather/log-out.svg').default, 36 'sign-out': require('!!raw-loader?!../../../assets/images/feather/log-out.svg').default,
37 'sign-in': require('!!raw-loader?!../../../assets/images/feather/log-in.svg').default,
37 'download': require('!!raw-loader?!../../../assets/images/feather/download.svg').default, 38 'download': require('!!raw-loader?!../../../assets/images/feather/download.svg').default,
38 'ownership-change': require('!!raw-loader?!../../../assets/images/feather/share.svg').default, 39 'ownership-change': require('!!raw-loader?!../../../assets/images/feather/share.svg').default,
39 'share': require('!!raw-loader?!../../../assets/images/feather/share-2.svg').default, 40 'share': require('!!raw-loader?!../../../assets/images/feather/share-2.svg').default,
diff --git a/client/src/app/shared/shared-main/misc/index.ts b/client/src/app/shared/shared-main/misc/index.ts
index d3e7e4be7..e806fd2f2 100644
--- a/client/src/app/shared/shared-main/misc/index.ts
+++ b/client/src/app/shared/shared-main/misc/index.ts
@@ -1,2 +1,3 @@
1export * from './help.component' 1export * from './help.component'
2export * from './list-overflow.component' 2export * from './list-overflow.component'
3export * from './top-menu-dropdown.component'
diff --git a/client/src/app/+my-account/top-menu-dropdown.component.html b/client/src/app/shared/shared-main/misc/top-menu-dropdown.component.html
index aeaceb662..aeaceb662 100644
--- a/client/src/app/+my-account/top-menu-dropdown.component.html
+++ b/client/src/app/shared/shared-main/misc/top-menu-dropdown.component.html
diff --git a/client/src/app/+my-account/top-menu-dropdown.component.scss b/client/src/app/shared/shared-main/misc/top-menu-dropdown.component.scss
index 84dd7dce3..84dd7dce3 100644
--- a/client/src/app/+my-account/top-menu-dropdown.component.scss
+++ b/client/src/app/shared/shared-main/misc/top-menu-dropdown.component.scss
diff --git a/client/src/app/+my-account/top-menu-dropdown.component.ts b/client/src/app/shared/shared-main/misc/top-menu-dropdown.component.ts
index 5909db0b5..5909db0b5 100644
--- a/client/src/app/+my-account/top-menu-dropdown.component.ts
+++ b/client/src/app/shared/shared-main/misc/top-menu-dropdown.component.ts
diff --git a/client/src/app/shared/shared-main/shared-main.module.ts b/client/src/app/shared/shared-main/shared-main.module.ts
index fd96a42a0..04e3eb0af 100644
--- a/client/src/app/shared/shared-main/shared-main.module.ts
+++ b/client/src/app/shared/shared-main/shared-main.module.ts
@@ -25,7 +25,7 @@ import { ActionDropdownComponent, ButtonComponent, DeleteButtonComponent, EditBu
25import { DateToggleComponent } from './date' 25import { DateToggleComponent } from './date'
26import { FeedComponent } from './feeds' 26import { FeedComponent } from './feeds'
27import { LoaderComponent, SmallLoaderComponent } from './loaders' 27import { LoaderComponent, SmallLoaderComponent } from './loaders'
28import { HelpComponent, ListOverflowComponent } from './misc' 28import { HelpComponent, ListOverflowComponent, TopMenuDropdownComponent } from './misc'
29import { UserHistoryService, UserNotificationsComponent, UserNotificationService } from './users' 29import { UserHistoryService, UserNotificationsComponent, UserNotificationService } from './users'
30import { RedundancyService, VideoImportService, VideoOwnershipService, VideoService } from './video' 30import { RedundancyService, VideoImportService, VideoOwnershipService, VideoService } from './video'
31import { VideoCaptionService } from './video-caption' 31import { VideoCaptionService } from './video-caption'
@@ -81,10 +81,9 @@ import { AUTH_INTERCEPTOR_PROVIDER } from './auth'
81 81
82 HelpComponent, 82 HelpComponent,
83 ListOverflowComponent, 83 ListOverflowComponent,
84 TopMenuDropdownComponent,
84 85
85 UserNotificationsComponent, 86 UserNotificationsComponent,
86
87 FeedComponent
88 ], 87 ],
89 88
90 exports: [ 89 exports: [
@@ -131,10 +130,9 @@ import { AUTH_INTERCEPTOR_PROVIDER } from './auth'
131 130
132 HelpComponent, 131 HelpComponent,
133 ListOverflowComponent, 132 ListOverflowComponent,
133 TopMenuDropdownComponent,
134 134
135 UserNotificationsComponent, 135 UserNotificationsComponent
136
137 FeedComponent
138 ], 136 ],
139 137
140 providers: [ 138 providers: [
diff --git a/client/src/assets/images/feather/log-in.svg b/client/src/assets/images/feather/log-in.svg
new file mode 100644
index 000000000..ba0da59a1
--- /dev/null
+++ b/client/src/assets/images/feather/log-in.svg
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-log-in"><path d="M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4"></path><polyline points="10 17 15 12 10 7"></polyline><line x1="15" y1="12" x2="3" y2="12"></line></svg> \ No newline at end of file