aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-07-29 14:50:41 +0200
committerChocobozzz <me@florianbigard.com>2022-08-01 14:55:10 +0200
commit1bb4c9ab2e8b3b3022351b33a82a5e527fa5d4d7 (patch)
treea6554ee0a3ccc2ae402665b2ecf57bb38fd0ed72 /client/src/app/+admin
parent12d84abeca4917d2f1e3f308010bfcd56d37cb7c (diff)
downloadPeerTube-1bb4c9ab2e8b3b3022351b33a82a5e527fa5d4d7.tar.gz
PeerTube-1bb4c9ab2e8b3b3022351b33a82a5e527fa5d4d7.tar.zst
PeerTube-1bb4c9ab2e8b3b3022351b33a82a5e527fa5d4d7.zip
Add ability to delete a specific video file
Diffstat (limited to 'client/src/app/+admin')
-rw-r--r--client/src/app/+admin/overview/videos/video-list.component.html10
-rw-r--r--client/src/app/+admin/overview/videos/video-list.component.scss7
-rw-r--r--client/src/app/+admin/overview/videos/video-list.component.ts18
3 files changed, 34 insertions, 1 deletions
diff --git a/client/src/app/+admin/overview/videos/video-list.component.html b/client/src/app/+admin/overview/videos/video-list.component.html
index fdd682ee2..06b9ab347 100644
--- a/client/src/app/+admin/overview/videos/video-list.component.html
+++ b/client/src/app/+admin/overview/videos/video-list.component.html
@@ -107,6 +107,11 @@
107 <ul> 107 <ul>
108 <li *ngFor="let file of video.files"> 108 <li *ngFor="let file of video.files">
109 {{ file.resolution.label }}: {{ file.size | bytes: 1 }} 109 {{ file.resolution.label }}: {{ file.size | bytes: 1 }}
110
111 <my-global-icon
112 i18n-ngbTooltip ngbTooltip="Delete this file" iconName="delete" role="button"
113 (click)="removeVideoFile(video, file, 'webtorrent')"
114 ></my-global-icon>
110 </li> 115 </li>
111 </ul> 116 </ul>
112 </div> 117 </div>
@@ -117,6 +122,11 @@
117 <ul> 122 <ul>
118 <li *ngFor="let file of video.streamingPlaylists[0].files"> 123 <li *ngFor="let file of video.streamingPlaylists[0].files">
119 {{ file.resolution.label }}: {{ file.size | bytes: 1 }} 124 {{ file.resolution.label }}: {{ file.size | bytes: 1 }}
125
126 <my-global-icon
127 i18n-ngbTooltip ngbTooltip="Delete this file" iconName="delete" role="button"
128 (click)="removeVideoFile(video, file, 'hls')"
129 ></my-global-icon>
120 </li> 130 </li>
121 </ul> 131 </ul>
122 </div> 132 </div>
diff --git a/client/src/app/+admin/overview/videos/video-list.component.scss b/client/src/app/+admin/overview/videos/video-list.component.scss
index dcd41a1b4..d538ca30a 100644
--- a/client/src/app/+admin/overview/videos/video-list.component.scss
+++ b/client/src/app/+admin/overview/videos/video-list.component.scss
@@ -13,6 +13,13 @@ my-embed {
13 13
14.video-info > div { 14.video-info > div {
15 display: flex; 15 display: flex;
16
17 my-global-icon {
18 width: 16px;
19 margin-left: 3px;
20 position: relative;
21 top: -2px;
22 }
16} 23}
17 24
18.loading { 25.loading {
diff --git a/client/src/app/+admin/overview/videos/video-list.component.ts b/client/src/app/+admin/overview/videos/video-list.component.ts
index 67e52d100..ed7ec54a1 100644
--- a/client/src/app/+admin/overview/videos/video-list.component.ts
+++ b/client/src/app/+admin/overview/videos/video-list.component.ts
@@ -8,7 +8,7 @@ import { AdvancedInputFilter } from '@app/shared/shared-forms'
8import { DropdownAction, Video, VideoService } from '@app/shared/shared-main' 8import { DropdownAction, Video, VideoService } from '@app/shared/shared-main'
9import { VideoBlockComponent, VideoBlockService } from '@app/shared/shared-moderation' 9import { VideoBlockComponent, VideoBlockService } from '@app/shared/shared-moderation'
10import { VideoActionsDisplayType } from '@app/shared/shared-video-miniature' 10import { VideoActionsDisplayType } from '@app/shared/shared-video-miniature'
11import { UserRight, VideoPrivacy, VideoState, VideoStreamingPlaylistType } from '@shared/models' 11import { UserRight, VideoFile, VideoPrivacy, VideoState, VideoStreamingPlaylistType } from '@shared/models'
12import { VideoAdminService } from './video-admin.service' 12import { VideoAdminService } from './video-admin.service'
13 13
14@Component({ 14@Component({
@@ -196,6 +196,22 @@ export class VideoListComponent extends RestTable implements OnInit {
196 }) 196 })
197 } 197 }
198 198
199 async removeVideoFile (video: Video, file: VideoFile, type: 'hls' | 'webtorrent') {
200 const message = $localize`Are you sure you want to delete this ${file.resolution.label} file?`
201 const res = await this.confirmService.confirm(message, $localize`Delete file`)
202 if (res === false) return
203
204 this.videoService.removeFile(video.uuid, file.id, type)
205 .subscribe({
206 next: () => {
207 this.notifier.success($localize`File removed.`)
208 this.reloadData()
209 },
210
211 error: err => this.notifier.error(err.message)
212 })
213 }
214
199 private async removeVideos (videos: Video[]) { 215 private async removeVideos (videos: Video[]) {
200 const message = prepareIcu($localize`Are you sure you want to delete {count, plural, =1 {this video} other {these {count} videos}}?`)( 216 const message = prepareIcu($localize`Are you sure you want to delete {count, plural, =1 {this video} other {these {count} videos}}?`)(
201 { count: videos.length }, 217 { count: videos.length },