diff options
Diffstat (limited to 'client/src/app/shared/shared-main')
-rw-r--r-- | client/src/app/shared/shared-main/video-channel/video-channel.service.ts | 19 | ||||
-rw-r--r-- | client/src/app/shared/shared-main/video/video-import.service.ts | 15 |
2 files changed, 30 insertions, 4 deletions
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' | |||
3 | import { HttpClient, HttpParams } from '@angular/common/http' | 3 | import { HttpClient, HttpParams } from '@angular/common/http' |
4 | import { Injectable } from '@angular/core' | 4 | import { Injectable } from '@angular/core' |
5 | import { ComponentPaginationLight, RestExtractor, RestService } from '@app/core' | 5 | import { ComponentPaginationLight, RestExtractor, RestService } from '@app/core' |
6 | import { ActorImage, ResultList, VideoChannel as VideoChannelServer, VideoChannelCreate, VideoChannelUpdate } from '@shared/models' | 6 | import { |
7 | ActorImage, | ||
8 | ResultList, | ||
9 | VideoChannel as VideoChannelServer, | ||
10 | VideoChannelCreate, | ||
11 | VideoChannelUpdate, | ||
12 | VideosImportInChannelCreate | ||
13 | } from '@shared/models' | ||
7 | import { environment } from '../../../../environments/environment' | 14 | import { environment } from '../../../../environments/environment' |
8 | import { Account } from '../account' | 15 | import { Account } from '../account' |
9 | import { AccountService } from '../account/account.service' | 16 | import { 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( |