aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+my-library
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/+my-library')
-rw-r--r--client/src/app/+my-library/my-video-imports/my-video-imports.component.html7
-rw-r--r--client/src/app/+my-library/my-video-imports/my-video-imports.component.ts24
2 files changed, 28 insertions, 3 deletions
diff --git a/client/src/app/+my-library/my-video-imports/my-video-imports.component.html b/client/src/app/+my-library/my-video-imports/my-video-imports.component.html
index bd29b11c8..e0d4e8f14 100644
--- a/client/src/app/+my-library/my-video-imports/my-video-imports.component.html
+++ b/client/src/app/+my-library/my-video-imports/my-video-imports.component.html
@@ -13,7 +13,7 @@
13 <ng-template pTemplate="header"> 13 <ng-template pTemplate="header">
14 <tr> 14 <tr>
15 <th style="width: 40px;"></th> 15 <th style="width: 40px;"></th>
16 <th style="width: 70px">Action</th> 16 <th style="width: 200px">Action</th>
17 <th style="width: 45%" i18n>Target</th> 17 <th style="width: 45%" i18n>Target</th>
18 <th style="width: 55%" i18n>Video</th> 18 <th style="width: 55%" i18n>Video</th>
19 <th style="width: 150px" i18n>State</th> 19 <th style="width: 150px" i18n>State</th>
@@ -28,8 +28,9 @@
28 </td> 28 </td>
29 29
30 <td class="action-cell"> 30 <td class="action-cell">
31 <my-edit-button *ngIf="isVideoImportSuccess(videoImport) && videoImport.video" 31 <my-button *ngIf="isVideoImportPending(videoImport)" i18n-label label="Cancel" icon="no" (click)="cancelImport(videoImport)"></my-button>
32 [routerLink]="getEditVideoUrl(videoImport.video)"></my-edit-button> 32 <my-delete-button *ngIf="isVideoImportFailed(videoImport) || isVideoImportCancelled(videoImport) || !videoImport.video" (click)="deleteImport(videoImport)"></my-delete-button>
33 <my-edit-button *ngIf="isVideoImportSuccess(videoImport) && videoImport.video" [routerLink]="getEditVideoUrl(videoImport.video)"></my-edit-button>
33 </td> 34 </td>
34 35
35 <td> 36 <td>
diff --git a/client/src/app/+my-library/my-video-imports/my-video-imports.component.ts b/client/src/app/+my-library/my-video-imports/my-video-imports.component.ts
index 914785bf7..f01558061 100644
--- a/client/src/app/+my-library/my-video-imports/my-video-imports.component.ts
+++ b/client/src/app/+my-library/my-video-imports/my-video-imports.component.ts
@@ -37,6 +37,8 @@ export class MyVideoImportsComponent extends RestTable implements OnInit {
37 return 'badge-banned' 37 return 'badge-banned'
38 case VideoImportState.PENDING: 38 case VideoImportState.PENDING:
39 return 'badge-yellow' 39 return 'badge-yellow'
40 case VideoImportState.PROCESSING:
41 return 'badge-blue'
40 default: 42 default:
41 return 'badge-green' 43 return 'badge-green'
42 } 44 }
@@ -54,6 +56,10 @@ export class MyVideoImportsComponent extends RestTable implements OnInit {
54 return videoImport.state.id === VideoImportState.FAILED 56 return videoImport.state.id === VideoImportState.FAILED
55 } 57 }
56 58
59 isVideoImportCancelled (videoImport: VideoImport) {
60 return videoImport.state.id === VideoImportState.CANCELLED
61 }
62
57 getVideoUrl (video: { uuid: string }) { 63 getVideoUrl (video: { uuid: string }) {
58 return Video.buildWatchUrl(video) 64 return Video.buildWatchUrl(video)
59 } 65 }
@@ -62,6 +68,24 @@ export class MyVideoImportsComponent extends RestTable implements OnInit {
62 return Video.buildUpdateUrl(video) 68 return Video.buildUpdateUrl(video)
63 } 69 }
64 70
71 deleteImport (videoImport: VideoImport) {
72 this.videoImportService.deleteVideoImport(videoImport)
73 .subscribe({
74 next: () => this.reloadData(),
75
76 error: err => this.notifier.error(err.message)
77 })
78 }
79
80 cancelImport (videoImport: VideoImport) {
81 this.videoImportService.cancelVideoImport(videoImport)
82 .subscribe({
83 next: () => this.reloadData(),
84
85 error: err => this.notifier.error(err.message)
86 })
87 }
88
65 protected reloadData () { 89 protected reloadData () {
66 this.videoImportService.getMyVideoImports(this.pagination, this.sort) 90 this.videoImportService.getMyVideoImports(this.pagination, this.sort)
67 .subscribe({ 91 .subscribe({