aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-08-10 11:51:13 +0200
committerChocobozzz <me@florianbigard.com>2022-08-10 14:32:00 +0200
commita3b472a12ec6e57dbe2f650419f8064864686eab (patch)
treef36559488e34493c029b686772e986902150a647 /client/src
parent0567049a9819d67070aa6d548a75a7e632a4aaa4 (diff)
downloadPeerTube-a3b472a12ec6e57dbe2f650419f8064864686eab.tar.gz
PeerTube-a3b472a12ec6e57dbe2f650419f8064864686eab.tar.zst
PeerTube-a3b472a12ec6e57dbe2f650419f8064864686eab.zip
Add ability to list imports of a channel sync
Diffstat (limited to 'client/src')
-rw-r--r--client/src/app/+my-library/my-video-channel-syncs/my-video-channel-syncs.component.html9
-rw-r--r--client/src/app/+my-library/my-video-channel-syncs/my-video-channel-syncs.component.ts2
-rw-r--r--client/src/app/+my-library/my-video-channel-syncs/video-channel-sync-edit/video-channel-sync-edit.component.ts2
-rw-r--r--client/src/app/+my-library/my-video-imports/my-video-imports.component.html11
-rw-r--r--client/src/app/+my-library/my-video-imports/my-video-imports.component.scss6
-rw-r--r--client/src/app/+my-library/my-video-imports/my-video-imports.component.ts6
-rw-r--r--client/src/app/shared/shared-main/video-channel/video-channel.service.ts19
-rw-r--r--client/src/app/shared/shared-main/video/video-import.service.ts15
8 files changed, 61 insertions, 9 deletions
diff --git a/client/src/app/+my-library/my-video-channel-syncs/my-video-channel-syncs.component.html b/client/src/app/+my-library/my-video-channel-syncs/my-video-channel-syncs.component.html
index 5141607b1..c2fed8112 100644
--- a/client/src/app/+my-library/my-video-channel-syncs/my-video-channel-syncs.component.html
+++ b/client/src/app/+my-library/my-video-channel-syncs/my-video-channel-syncs.component.html
@@ -30,12 +30,13 @@
30 30
31 <ng-template pTemplate="header"> 31 <ng-template pTemplate="header">
32 <tr> 32 <tr>
33 <th style="width: 10%"><my-global-icon iconName="columns"></my-global-icon></th> 33 <th style="width: 10%"></th>
34 <th style="width: 25%" i18n pSortableColumn="externalChannelUrl">External Channel <p-sortIcon field="externalChannelUrl"></p-sortIcon></th> 34 <th style="width: 25%" i18n pSortableColumn="externalChannelUrl">External Channel <p-sortIcon field="externalChannelUrl"></p-sortIcon></th>
35 <th style="width: 25%" i18n pSortableColumn="videoChannel">Channel <p-sortIcon field="videoChannel"></p-sortIcon></th> 35 <th style="width: 25%" i18n pSortableColumn="videoChannel">Channel <p-sortIcon field="videoChannel"></p-sortIcon></th>
36 <th style="width: 10%" i18n pSortableColumn="state">State <p-sortIcon field="state"></p-sortIcon></th> 36 <th style="width: 10%" i18n pSortableColumn="state">State <p-sortIcon field="state"></p-sortIcon></th>
37 <th style="width: 10%" i18n pSortableColumn="createdAt">Created <p-sortIcon field="createdAt"></p-sortIcon></th> 37 <th style="width: 10%" i18n pSortableColumn="createdAt">Created <p-sortIcon field="createdAt"></p-sortIcon></th>
38 <th style="width: 10%" i18n pSortableColumn="lastSyncAt">Last synchronization at <p-sortIcon field="lastSyncAt"></p-sortIcon></th> 38 <th style="width: 10%" i18n pSortableColumn="lastSyncAt">Last synchronization at <p-sortIcon field="lastSyncAt"></p-sortIcon></th>
39 <th></th>
39 </tr> 40 </tr>
40 </ng-template> 41 </ng-template>
41 42
@@ -78,6 +79,12 @@
78 79
79 <td>{{ videoChannelSync.createdAt | date: 'short' }}</td> 80 <td>{{ videoChannelSync.createdAt | date: 'short' }}</td>
80 <td>{{ videoChannelSync.lastSyncAt | date: 'short' }}</td> 81 <td>{{ videoChannelSync.lastSyncAt | date: 'short' }}</td>
82
83 <td>
84 <a i18n routerLink="/my-library/video-imports" [queryParams]="{ search: 'videoChannelSyncId:' + videoChannelSync.id }" class="peertube-button-link grey-button">
85 List imports
86 </a>
87 </td>
81 </tr> 88 </tr>
82 </ng-template> 89 </ng-template>
83</p-table> 90</p-table>
diff --git a/client/src/app/+my-library/my-video-channel-syncs/my-video-channel-syncs.component.ts b/client/src/app/+my-library/my-video-channel-syncs/my-video-channel-syncs.component.ts
index 81bdaf9f2..0c429e5dd 100644
--- a/client/src/app/+my-library/my-video-channel-syncs/my-video-channel-syncs.component.ts
+++ b/client/src/app/+my-library/my-video-channel-syncs/my-video-channel-syncs.component.ts
@@ -100,7 +100,7 @@ export class MyVideoChannelSyncsComponent extends RestTable implements OnInit {
100 } 100 }
101 101
102 fullySynchronize (videoChannelSync: VideoChannelSync) { 102 fullySynchronize (videoChannelSync: VideoChannelSync) {
103 this.videoChannelService.importVideos(videoChannelSync.channel.name, videoChannelSync.externalChannelUrl) 103 this.videoChannelService.importVideos(videoChannelSync.channel.name, videoChannelSync.externalChannelUrl, videoChannelSync.id)
104 .subscribe({ 104 .subscribe({
105 next: () => { 105 next: () => {
106 this.notifier.success($localize`Full synchronization requested successfully for ${videoChannelSync.channel.displayName}.`) 106 this.notifier.success($localize`Full synchronization requested successfully for ${videoChannelSync.channel.displayName}.`)
diff --git a/client/src/app/+my-library/my-video-channel-syncs/video-channel-sync-edit/video-channel-sync-edit.component.ts b/client/src/app/+my-library/my-video-channel-syncs/video-channel-sync-edit/video-channel-sync-edit.component.ts
index 836582609..9ceb6dfd1 100644
--- a/client/src/app/+my-library/my-video-channel-syncs/video-channel-sync-edit/video-channel-sync-edit.component.ts
+++ b/client/src/app/+my-library/my-video-channel-syncs/video-channel-sync-edit/video-channel-sync-edit.component.ts
@@ -59,7 +59,7 @@ export class VideoChannelSyncEditComponent extends FormReactive implements OnIni
59 this.videoChannelSyncService.createSync(videoChannelSyncCreate) 59 this.videoChannelSyncService.createSync(videoChannelSyncCreate)
60 .pipe(mergeMap(({ videoChannelSync }) => { 60 .pipe(mergeMap(({ videoChannelSync }) => {
61 return importExistingVideos 61 return importExistingVideos
62 ? this.videoChannelService.importVideos(videoChannelSync.channel.name, videoChannelSync.externalChannelUrl) 62 ? this.videoChannelService.importVideos(videoChannelSync.channel.name, videoChannelSync.externalChannelUrl, videoChannelSync.id)
63 : Promise.resolve(null) 63 : Promise.resolve(null)
64 })) 64 }))
65 .subscribe({ 65 .subscribe({
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 fb0f6f5a3..866cd1a72 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
@@ -3,9 +3,18 @@
3 <ng-container i18n>My imports</ng-container> 3 <ng-container i18n>My imports</ng-container>
4</h1> 4</h1>
5 5
6<div class="mb-4 d-flex justify-content-between">
7 <my-advanced-input-filter (search)="onSearch($event)"></my-advanced-input-filter>
8
9 <a routerLink="/my-library/video-channel-syncs" class="button-link">
10 <my-global-icon iconName="repeat" aria-hidden="true"></my-global-icon>
11 <ng-container i18n>My synchronizations</ng-container>
12 </a>
13</div>
14
6<p-table 15<p-table
7 [value]="videoImports" [lazy]="true" [paginator]="totalRecords > 0" [totalRecords]="totalRecords" [rows]="rowsPerPage" [first]="pagination.start" 16 [value]="videoImports" [lazy]="true" [paginator]="totalRecords > 0" [totalRecords]="totalRecords" [rows]="rowsPerPage" [first]="pagination.start"
8 [rowsPerPageOptions]="rowsPerPageOptions" [sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)" dataKey="id" 17 [rowsPerPageOptions]="rowsPerPageOptions" [sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)" [lazyLoadOnInit]="false" dataKey="id"
9 [showCurrentPageReport]="true" i18n-currentPageReportTemplate 18 [showCurrentPageReport]="true" i18n-currentPageReportTemplate
10 currentPageReportTemplate="Showing {{'{first}'}} to {{'{last}'}} of {{'{totalRecords}'}} imports" 19 currentPageReportTemplate="Showing {{'{first}'}} to {{'{last}'}} of {{'{totalRecords}'}} imports"
11 [expandedRowKeys]="expandedRows" 20 [expandedRowKeys]="expandedRows"
diff --git a/client/src/app/+my-library/my-video-imports/my-video-imports.component.scss b/client/src/app/+my-library/my-video-imports/my-video-imports.component.scss
index 7acacd47f..d9b12151e 100644
--- a/client/src/app/+my-library/my-video-imports/my-video-imports.component.scss
+++ b/client/src/app/+my-library/my-video-imports/my-video-imports.component.scss
@@ -8,3 +8,9 @@ pre {
8.video-import-error { 8.video-import-error {
9 color: #ff0000; 9 color: #ff0000;
10} 10}
11
12.button-link {
13 @include peertube-button-link;
14 @include grey-button;
15 @include button-with-icon(18px, 3px, -1px);
16}
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 f01558061..46d689bd1 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
@@ -33,12 +33,16 @@ export class MyVideoImportsComponent extends RestTable implements OnInit {
33 switch (state) { 33 switch (state) {
34 case VideoImportState.FAILED: 34 case VideoImportState.FAILED:
35 return 'badge-red' 35 return 'badge-red'
36
36 case VideoImportState.REJECTED: 37 case VideoImportState.REJECTED:
37 return 'badge-banned' 38 return 'badge-banned'
39
38 case VideoImportState.PENDING: 40 case VideoImportState.PENDING:
39 return 'badge-yellow' 41 return 'badge-yellow'
42
40 case VideoImportState.PROCESSING: 43 case VideoImportState.PROCESSING:
41 return 'badge-blue' 44 return 'badge-blue'
45
42 default: 46 default:
43 return 'badge-green' 47 return 'badge-green'
44 } 48 }
@@ -87,7 +91,7 @@ export class MyVideoImportsComponent extends RestTable implements OnInit {
87 } 91 }
88 92
89 protected reloadData () { 93 protected reloadData () {
90 this.videoImportService.getMyVideoImports(this.pagination, this.sort) 94 this.videoImportService.getMyVideoImports(this.pagination, this.sort, this.search)
91 .subscribe({ 95 .subscribe({
92 next: resultList => { 96 next: resultList => {
93 this.videoImports = resultList.data 97 this.videoImports = resultList.data
diff --git a/client/src/app/shared/shared-main/video-channel/video-channel.service.ts b/client/src/app/shared/shared-main/video-channel/video-channel.service.ts
index fa97025ac..5e3985526 100644
--- a/client/src/app/shared/shared-main/video-channel/video-channel.service.ts
+++ b/client/src/app/shared/shared-main/video-channel/video-channel.service.ts
@@ -3,7 +3,14 @@ import { catchError, map, tap } from 'rxjs/operators'
3import { HttpClient, HttpParams } from '@angular/common/http' 3import { HttpClient, HttpParams } from '@angular/common/http'
4import { Injectable } from '@angular/core' 4import { Injectable } from '@angular/core'
5import { ComponentPaginationLight, RestExtractor, RestService } from '@app/core' 5import { ComponentPaginationLight, RestExtractor, RestService } from '@app/core'
6import { ActorImage, ResultList, VideoChannel as VideoChannelServer, VideoChannelCreate, VideoChannelUpdate } from '@shared/models' 6import {
7 ActorImage,
8 ResultList,
9 VideoChannel as VideoChannelServer,
10 VideoChannelCreate,
11 VideoChannelUpdate,
12 VideosImportInChannelCreate
13} from '@shared/models'
7import { environment } from '../../../../environments/environment' 14import { environment } from '../../../../environments/environment'
8import { Account } from '../account' 15import { Account } from '../account'
9import { AccountService } from '../account/account.service' 16import { AccountService } from '../account/account.service'
@@ -96,9 +103,15 @@ export class VideoChannelService {
96 .pipe(catchError(err => this.restExtractor.handleError(err))) 103 .pipe(catchError(err => this.restExtractor.handleError(err)))
97 } 104 }
98 105
99 importVideos (videoChannelName: string, externalChannelUrl: string) { 106 importVideos (videoChannelName: string, externalChannelUrl: string, syncId?: number) {
100 const path = VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannelName + '/import-videos' 107 const path = VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannelName + '/import-videos'
101 return this.authHttp.post(path, { externalChannelUrl }) 108
109 const body: VideosImportInChannelCreate = {
110 externalChannelUrl,
111 videoChannelSyncId: syncId
112 }
113
114 return this.authHttp.post(path, body)
102 .pipe(catchError(err => this.restExtractor.handleError(err))) 115 .pipe(catchError(err => this.restExtractor.handleError(err)))
103 } 116 }
104} 117}
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 0a610ab1f..f9720033a 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
@@ -43,10 +43,23 @@ export class VideoImportService {
43 .pipe(catchError(res => this.restExtractor.handleError(res))) 43 .pipe(catchError(res => this.restExtractor.handleError(res)))
44 } 44 }
45 45
46 getMyVideoImports (pagination: RestPagination, sort: SortMeta): Observable<ResultList<VideoImport>> { 46 getMyVideoImports (pagination: RestPagination, sort: SortMeta, search?: string): Observable<ResultList<VideoImport>> {
47 let params = new HttpParams() 47 let params = new HttpParams()
48 params = this.restService.addRestGetParams(params, pagination, sort) 48 params = this.restService.addRestGetParams(params, pagination, sort)
49 49
50 if (search) {
51 const filters = this.restService.parseQueryStringFilter(search, {
52 videoChannelSyncId: {
53 prefix: 'videoChannelSyncId:'
54 },
55 targetUrl: {
56 prefix: 'targetUrl:'
57 }
58 })
59
60 params = this.restService.addObjectParams(params, filters)
61 }
62
50 return this.authHttp 63 return this.authHttp
51 .get<ResultList<VideoImport>>(UserService.BASE_USERS_URL + '/me/videos/imports', { params }) 64 .get<ResultList<VideoImport>>(UserService.BASE_USERS_URL + '/me/videos/imports', { params })
52 .pipe( 65 .pipe(