diff options
author | Chocobozzz <me@florianbigard.com> | 2023-01-20 15:06:08 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-01-20 15:06:08 +0100 |
commit | e854d57bed56bcbba4d191af54125ae6dd569a88 (patch) | |
tree | c0f772a395301dbbc40e4a014fce9fb5fec921d0 /client/src/app/+admin/overview/videos | |
parent | 345f579b8e36ed743be66a1541c7444098eb0a02 (diff) | |
download | PeerTube-e854d57bed56bcbba4d191af54125ae6dd569a88.tar.gz PeerTube-e854d57bed56bcbba4d191af54125ae6dd569a88.tar.zst PeerTube-e854d57bed56bcbba4d191af54125ae6dd569a88.zip |
Refactor row selection reset
Diffstat (limited to 'client/src/app/+admin/overview/videos')
-rw-r--r-- | client/src/app/+admin/overview/videos/video-list.component.ts | 34 |
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 }, |