diff options
author | Chocobozzz <me@florianbigard.com> | 2022-04-05 14:03:52 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2022-04-15 09:49:35 +0200 |
commit | 384ba8b77a8e4805c099f5ea12b41c2ca5776e26 (patch) | |
tree | 6b517033d9265d283677b85e0f57486e0e7fd8cf /client/src/app/shared/shared-video-miniature | |
parent | b211106695bb82f6c32e53306081b5262c3d109d (diff) | |
download | PeerTube-384ba8b77a8e4805c099f5ea12b41c2ca5776e26.tar.gz PeerTube-384ba8b77a8e4805c099f5ea12b41c2ca5776e26.tar.zst PeerTube-384ba8b77a8e4805c099f5ea12b41c2ca5776e26.zip |
Support videos stats in client
Diffstat (limited to 'client/src/app/shared/shared-video-miniature')
-rw-r--r-- | client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts | 17 | ||||
-rw-r--r-- | client/src/app/shared/shared-video-miniature/video-miniature.component.ts | 23 |
2 files changed, 29 insertions, 11 deletions
diff --git a/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts index 5eef96145..ed6a4afc0 100644 --- a/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts +++ b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts | |||
@@ -30,6 +30,7 @@ export type VideoActionsDisplayType = { | |||
30 | removeFiles?: boolean | 30 | removeFiles?: boolean |
31 | transcoding?: boolean | 31 | transcoding?: boolean |
32 | studio?: boolean | 32 | studio?: boolean |
33 | stats?: boolean | ||
33 | } | 34 | } |
34 | 35 | ||
35 | @Component({ | 36 | @Component({ |
@@ -61,9 +62,11 @@ export class VideoActionsDropdownComponent implements OnChanges { | |||
61 | liveInfo: false, | 62 | liveInfo: false, |
62 | removeFiles: false, | 63 | removeFiles: false, |
63 | transcoding: false, | 64 | transcoding: false, |
64 | studio: true | 65 | studio: true, |
66 | stats: true | ||
65 | } | 67 | } |
66 | @Input() placement = 'left' | 68 | @Input() placement = 'left' |
69 | @Input() moreActions: DropdownAction<{ video: Video }>[][] = [] | ||
67 | 70 | ||
68 | @Input() label: string | 71 | @Input() label: string |
69 | 72 | ||
@@ -156,6 +159,10 @@ export class VideoActionsDropdownComponent implements OnChanges { | |||
156 | return this.video.isEditableBy(this.user, this.serverService.getHTMLConfig().videoStudio.enabled) | 159 | return this.video.isEditableBy(this.user, this.serverService.getHTMLConfig().videoStudio.enabled) |
157 | } | 160 | } |
158 | 161 | ||
162 | isVideoStatsAvailable () { | ||
163 | return this.video.canSeeStats(this.user) | ||
164 | } | ||
165 | |||
159 | isVideoRemovable () { | 166 | isVideoRemovable () { |
160 | return this.video.isRemovableBy(this.user) | 167 | return this.video.isRemovableBy(this.user) |
161 | } | 168 | } |
@@ -343,6 +350,12 @@ export class VideoActionsDropdownComponent implements OnChanges { | |||
343 | isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.studio && this.isVideoEditable() | 350 | isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.studio && this.isVideoEditable() |
344 | }, | 351 | }, |
345 | { | 352 | { |
353 | label: $localize`Stats`, | ||
354 | linkBuilder: ({ video }) => [ '/stats/videos', video.uuid ], | ||
355 | iconName: 'stats', | ||
356 | isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.stats && this.isVideoStatsAvailable() | ||
357 | }, | ||
358 | { | ||
346 | label: $localize`Block`, | 359 | label: $localize`Block`, |
347 | handler: () => this.showBlockModal(), | 360 | handler: () => this.showBlockModal(), |
348 | iconName: 'no', | 361 | iconName: 'no', |
@@ -408,5 +421,7 @@ export class VideoActionsDropdownComponent implements OnChanges { | |||
408 | } | 421 | } |
409 | ] | 422 | ] |
410 | ] | 423 | ] |
424 | |||
425 | this.videoActions = this.videoActions.concat(this.moreActions) | ||
411 | } | 426 | } |
412 | } | 427 | } |
diff --git a/client/src/app/shared/shared-video-miniature/video-miniature.component.ts b/client/src/app/shared/shared-video-miniature/video-miniature.component.ts index 7de9fc8e2..42c472579 100644 --- a/client/src/app/shared/shared-video-miniature/video-miniature.component.ts +++ b/client/src/app/shared/shared-video-miniature/video-miniature.component.ts | |||
@@ -49,7 +49,20 @@ export class VideoMiniatureComponent implements OnInit { | |||
49 | state: false, | 49 | state: false, |
50 | blacklistInfo: false | 50 | blacklistInfo: false |
51 | } | 51 | } |
52 | |||
52 | @Input() displayVideoActions = true | 53 | @Input() displayVideoActions = true |
54 | @Input() videoActionsDisplayOptions: VideoActionsDisplayType = { | ||
55 | playlist: true, | ||
56 | download: false, | ||
57 | update: true, | ||
58 | blacklist: true, | ||
59 | delete: true, | ||
60 | report: true, | ||
61 | duplicate: true, | ||
62 | mute: true, | ||
63 | studio: false, | ||
64 | stats: false | ||
65 | } | ||
53 | 66 | ||
54 | @Input() actorImageSize: ActorAvatarSize = '40' | 67 | @Input() actorImageSize: ActorAvatarSize = '40' |
55 | 68 | ||
@@ -62,16 +75,6 @@ export class VideoMiniatureComponent implements OnInit { | |||
62 | @Output() videoRemoved = new EventEmitter() | 75 | @Output() videoRemoved = new EventEmitter() |
63 | @Output() videoAccountMuted = new EventEmitter() | 76 | @Output() videoAccountMuted = new EventEmitter() |
64 | 77 | ||
65 | videoActionsDisplayOptions: VideoActionsDisplayType = { | ||
66 | playlist: true, | ||
67 | download: false, | ||
68 | update: true, | ||
69 | blacklist: true, | ||
70 | delete: true, | ||
71 | report: true, | ||
72 | duplicate: true, | ||
73 | mute: true | ||
74 | } | ||
75 | showActions = false | 78 | showActions = false |
76 | serverConfig: HTMLServerConfig | 79 | serverConfig: HTMLServerConfig |
77 | 80 | ||