aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/overview/videos/video-list.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/+admin/overview/videos/video-list.component.ts')
-rw-r--r--client/src/app/+admin/overview/videos/video-list.component.ts34
1 files changed, 16 insertions, 18 deletions
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 cd5d2eb34..1ea295499 100644
--- a/client/src/app/+admin/overview/videos/video-list.component.ts
+++ b/client/src/app/+admin/overview/videos/video-list.component.ts
@@ -183,9 +183,23 @@ export class VideoListComponent extends RestTable <Video> implements OnInit {
183 return files.reduce((p, f) => p += f.size, 0) 183 return files.reduce((p, f) => p += f.size, 0)
184 } 184 }
185 185
186 reloadData () { 186 async removeVideoFile (video: Video, file: VideoFile, type: 'hls' | 'webtorrent') {
187 this.selectedRows = [] 187 const message = $localize`Are you sure you want to delete this ${file.resolution.label} file?`
188 const res = await this.confirmService.confirm(message, $localize`Delete file`)
189 if (res === false) return
190
191 this.videoService.removeFile(video.uuid, file.id, type)
192 .subscribe({
193 next: () => {
194 this.notifier.success($localize`File removed.`)
195 this.reloadData()
196 },
197
198 error: err => this.notifier.error(err.message)
199 })
200 }
188 201
202 protected reloadDataInternal () {
189 this.loading = true 203 this.loading = true
190 204
191 this.videoAdminService.getAdminVideos({ 205 this.videoAdminService.getAdminVideos({
@@ -203,22 +217,6 @@ export class VideoListComponent extends RestTable <Video> implements OnInit {
203 }) 217 })
204 } 218 }
205 219
206 async removeVideoFile (video: Video, file: VideoFile, type: 'hls' | 'webtorrent') {
207 const message = $localize`Are you sure you want to delete this ${file.resolution.label} file?`
208 const res = await this.confirmService.confirm(message, $localize`Delete file`)
209 if (res === false) return
210
211 this.videoService.removeFile(video.uuid, file.id, type)
212 .subscribe({
213 next: () => {
214 this.notifier.success($localize`File removed.`)
215 this.reloadData()
216 },
217
218 error: err => this.notifier.error(err.message)
219 })
220 }
221
222 private async removeVideos (videos: Video[]) { 220 private async removeVideos (videos: Video[]) {
223 const message = prepareIcu($localize`Are you sure you want to delete {count, plural, =1 {this video} other {these {count} videos}}?`)( 221 const message = prepareIcu($localize`Are you sure you want to delete {count, plural, =1 {this video} other {these {count} videos}}?`)(
224 { count: videos.length }, 222 { count: videos.length },