diff options
Diffstat (limited to 'client/src/app')
6 files changed, 40 insertions, 13 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({ |
diff --git a/client/src/app/shared/shared-main/buttons/button.component.html b/client/src/app/shared/shared-main/buttons/button.component.html index 65e06f7a4..11c8ffedd 100644 --- a/client/src/app/shared/shared-main/buttons/button.component.html +++ b/client/src/app/shared/shared-main/buttons/button.component.html | |||
@@ -1,5 +1,5 @@ | |||
1 | <span class="action-button" [ngClass]="getClasses()" [ngbTooltip]="getTitle()" tabindex="0"> | 1 | <span class="action-button" [ngClass]="getClasses()" [ngbTooltip]="title" tabindex="0"> |
2 | <my-global-icon *ngIf="!loading" [iconName]="icon"></my-global-icon> | 2 | <my-global-icon *ngIf="icon && !loading" [iconName]="icon"></my-global-icon> |
3 | <my-small-loader [loading]="loading"></my-small-loader> | 3 | <my-small-loader [loading]="loading"></my-small-loader> |
4 | 4 | ||
5 | <span *ngIf="label" class="button-label">{{ label }}</span> | 5 | <span *ngIf="label" class="button-label">{{ label }}</span> |
diff --git a/client/src/app/shared/shared-main/buttons/button.component.ts b/client/src/app/shared/shared-main/buttons/button.component.ts index ee74b3d12..b97012d9a 100644 --- a/client/src/app/shared/shared-main/buttons/button.component.ts +++ b/client/src/app/shared/shared-main/buttons/button.component.ts | |||
@@ -16,10 +16,6 @@ export class ButtonComponent { | |||
16 | @Input() disabled = false | 16 | @Input() disabled = false |
17 | @Input() responsiveLabel = false | 17 | @Input() responsiveLabel = false |
18 | 18 | ||
19 | getTitle () { | ||
20 | return this.title || this.label | ||
21 | } | ||
22 | |||
23 | getClasses () { | 19 | getClasses () { |
24 | return { | 20 | return { |
25 | [this.className]: true, | 21 | [this.className]: true, |
diff --git a/client/src/app/shared/shared-main/buttons/delete-button.component.ts b/client/src/app/shared/shared-main/buttons/delete-button.component.ts index c091f5309..90735852c 100644 --- a/client/src/app/shared/shared-main/buttons/delete-button.component.ts +++ b/client/src/app/shared/shared-main/buttons/delete-button.component.ts | |||
@@ -20,10 +20,6 @@ export class DeleteButtonComponent implements OnInit { | |||
20 | // <my-delete-button label /> Use default label | 20 | // <my-delete-button label /> Use default label |
21 | if (this.label === '') { | 21 | if (this.label === '') { |
22 | this.label = $localize`Delete` | 22 | this.label = $localize`Delete` |
23 | |||
24 | if (!this.title) { | ||
25 | this.title = this.label | ||
26 | } | ||
27 | } | 23 | } |
28 | } | 24 | } |
29 | } | 25 | } |
diff --git a/client/src/app/shared/shared-main/video/video-import.service.ts b/client/src/app/shared/shared-main/video/video-import.service.ts index 99df78e3a..0a610ab1f 100644 --- a/client/src/app/shared/shared-main/video/video-import.service.ts +++ b/client/src/app/shared/shared-main/video/video-import.service.ts | |||
@@ -56,6 +56,16 @@ export class VideoImportService { | |||
56 | ) | 56 | ) |
57 | } | 57 | } |
58 | 58 | ||
59 | deleteVideoImport (videoImport: VideoImport) { | ||
60 | return this.authHttp.delete(VideoImportService.BASE_VIDEO_IMPORT_URL + videoImport.id) | ||
61 | .pipe(catchError(err => this.restExtractor.handleError(err))) | ||
62 | } | ||
63 | |||
64 | cancelVideoImport (videoImport: VideoImport) { | ||
65 | return this.authHttp.post(VideoImportService.BASE_VIDEO_IMPORT_URL + videoImport.id + '/cancel', {}) | ||
66 | .pipe(catchError(err => this.restExtractor.handleError(err))) | ||
67 | } | ||
68 | |||
59 | private buildImportVideoObject (video: VideoUpdate): VideoImportCreate { | 69 | private buildImportVideoObject (video: VideoUpdate): VideoImportCreate { |
60 | const language = video.language || null | 70 | const language = video.language || null |
61 | const licence = video.licence || null | 71 | const licence = video.licence || null |