diff options
author | Chocobozzz <me@florianbigard.com> | 2023-04-21 15:04:52 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2023-05-09 08:57:34 +0200 |
commit | 118626c8752bee7b05c4e0b668852e1aba2416f1 (patch) | |
tree | 6407bdcde3496c6a2480313f0958653aa15bab87 /client/src/app/+admin/admin.component.ts | |
parent | e592df48c73aa9262b04d23b3319de49b6caf95d (diff) | |
download | PeerTube-118626c8752bee7b05c4e0b668852e1aba2416f1.tar.gz PeerTube-118626c8752bee7b05c4e0b668852e1aba2416f1.tar.zst PeerTube-118626c8752bee7b05c4e0b668852e1aba2416f1.zip |
Implement runner in client side
Diffstat (limited to 'client/src/app/+admin/admin.component.ts')
-rw-r--r-- | client/src/app/+admin/admin.component.ts | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/client/src/app/+admin/admin.component.ts b/client/src/app/+admin/admin.component.ts index 630bfe253..d4d912c40 100644 --- a/client/src/app/+admin/admin.component.ts +++ b/client/src/app/+admin/admin.component.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component, OnInit } from '@angular/core' |
2 | import { AuthService, ScreenService } from '@app/core' | 2 | import { AuthService, ScreenService, ServerService } from '@app/core' |
3 | import { ListOverflowItem } from '@app/shared/shared-main' | 3 | import { ListOverflowItem } from '@app/shared/shared-main' |
4 | import { TopMenuDropdownParam } from '@app/shared/shared-main/misc/top-menu-dropdown.component' | 4 | import { TopMenuDropdownParam } from '@app/shared/shared-main/misc/top-menu-dropdown.component' |
5 | import { UserRight } from '@shared/models' | 5 | import { UserRight } from '@shared/models' |
@@ -14,7 +14,8 @@ export class AdminComponent implements OnInit { | |||
14 | 14 | ||
15 | constructor ( | 15 | constructor ( |
16 | private auth: AuthService, | 16 | private auth: AuthService, |
17 | private screen: ScreenService | 17 | private screen: ScreenService, |
18 | private server: ServerService | ||
18 | ) { } | 19 | ) { } |
19 | 20 | ||
20 | get isBroadcastMessageDisplayed () { | 21 | get isBroadcastMessageDisplayed () { |
@@ -22,6 +23,14 @@ export class AdminComponent implements OnInit { | |||
22 | } | 23 | } |
23 | 24 | ||
24 | ngOnInit () { | 25 | ngOnInit () { |
26 | this.server.configReloaded.subscribe(() => this.buildMenu()) | ||
27 | |||
28 | this.buildMenu() | ||
29 | } | ||
30 | |||
31 | private buildMenu () { | ||
32 | this.menuEntries = [] | ||
33 | |||
25 | this.buildOverviewItems() | 34 | this.buildOverviewItems() |
26 | this.buildFederationItems() | 35 | this.buildFederationItems() |
27 | this.buildModerationItems() | 36 | this.buildModerationItems() |
@@ -157,9 +166,23 @@ export class AdminComponent implements OnInit { | |||
157 | children: [] | 166 | children: [] |
158 | } | 167 | } |
159 | 168 | ||
169 | if (this.isRemoteRunnersEnabled() && this.hasRunnersRight()) { | ||
170 | systemItems.children.push({ | ||
171 | label: $localize`Remote runners`, | ||
172 | iconName: 'codesandbox', | ||
173 | routerLink: '/admin/system/runners/runners-list' | ||
174 | }) | ||
175 | |||
176 | systemItems.children.push({ | ||
177 | label: $localize`Runner jobs`, | ||
178 | iconName: 'globe', | ||
179 | routerLink: '/admin/system/runners/jobs-list' | ||
180 | }) | ||
181 | } | ||
182 | |||
160 | if (this.hasJobsRight()) { | 183 | if (this.hasJobsRight()) { |
161 | systemItems.children.push({ | 184 | systemItems.children.push({ |
162 | label: $localize`Jobs`, | 185 | label: $localize`Local jobs`, |
163 | iconName: 'circle-tick', | 186 | iconName: 'circle-tick', |
164 | routerLink: '/admin/system/jobs' | 187 | routerLink: '/admin/system/jobs' |
165 | }) | 188 | }) |
@@ -226,6 +249,10 @@ export class AdminComponent implements OnInit { | |||
226 | return this.auth.getUser().hasRight(UserRight.MANAGE_JOBS) | 249 | return this.auth.getUser().hasRight(UserRight.MANAGE_JOBS) |
227 | } | 250 | } |
228 | 251 | ||
252 | private hasRunnersRight () { | ||
253 | return this.auth.getUser().hasRight(UserRight.MANAGE_RUNNERS) | ||
254 | } | ||
255 | |||
229 | private hasDebugRight () { | 256 | private hasDebugRight () { |
230 | return this.auth.getUser().hasRight(UserRight.MANAGE_DEBUG) | 257 | return this.auth.getUser().hasRight(UserRight.MANAGE_DEBUG) |
231 | } | 258 | } |
@@ -241,4 +268,10 @@ export class AdminComponent implements OnInit { | |||
241 | private hasRegistrationsRight () { | 268 | private hasRegistrationsRight () { |
242 | return this.auth.getUser().hasRight(UserRight.MANAGE_REGISTRATIONS) | 269 | return this.auth.getUser().hasRight(UserRight.MANAGE_REGISTRATIONS) |
243 | } | 270 | } |
271 | |||
272 | private isRemoteRunnersEnabled () { | ||
273 | const config = this.server.getHTMLConfig() | ||
274 | |||
275 | return config.transcoding.remoteRunners.enabled || config.live.transcoding.remoteRunners.enabled | ||
276 | } | ||
244 | } | 277 | } |