From 7e7d8e485356402e7652c61c9f004e850b0a1607 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 2 Nov 2021 11:00:40 +0100 Subject: Some fixes for admin videos list --- .../app/+admin/overview/videos/video-list.component.html | 5 +++-- .../app/+admin/overview/videos/video-list.component.ts | 4 ++-- client/src/app/shared/shared-main/video/video.service.ts | 16 ++++++++-------- 3 files changed, 13 insertions(+), 12 deletions(-) (limited to 'client/src/app') diff --git a/client/src/app/+admin/overview/videos/video-list.component.html b/client/src/app/+admin/overview/videos/video-list.component.html index eedf6f3dc..dd4ab178e 100644 --- a/client/src/app/+admin/overview/videos/video-list.component.html +++ b/client/src/app/+admin/overview/videos/video-list.component.html @@ -69,7 +69,7 @@ NSFW - Not published yet + {{ video.state.label }} Account muted Server muted @@ -80,8 +80,9 @@ HLS WebTorrent + Live - {{ getFilesSize(video) | bytes: 1 }} + {{ getFilesSize(video) | bytes: 1 }} 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 6885abfc7..8bd171c53 100644 --- a/client/src/app/+admin/overview/videos/video-list.component.ts +++ b/client/src/app/+admin/overview/videos/video-list.component.ts @@ -16,7 +16,7 @@ export class VideoListComponent extends RestTable implements OnInit { videos: Video[] = [] totalRecords = 0 - sort: SortMeta = { field: 'publishedAt', order: 1 } + sort: SortMeta = { field: 'publishedAt', order: -1 } pagination: RestPagination = { count: this.rowsPerPage, start: 0 } bulkVideoActions: DropdownAction[][] = [] @@ -99,7 +99,7 @@ export class VideoListComponent extends RestTable implements OnInit { } isUnpublished (state: VideoState) { - return state !== VideoState.PUBLISHED + return state !== VideoState.LIVE_ENDED && state !== VideoState.PUBLISHED } isAccountBlocked (video: Video) { diff --git a/client/src/app/shared/shared-main/video/video.service.ts b/client/src/app/shared/shared-main/video/video.service.ts index 5db9a8704..819847ac6 100644 --- a/client/src/app/shared/shared-main/video/video.service.ts +++ b/client/src/app/shared/shared-main/video/video.service.ts @@ -48,7 +48,7 @@ export type CommonVideoParams = { @Injectable() export class VideoService { - static BASE_VIDEO_URL = environment.apiUrl + '/api/v1/videos/' + static BASE_VIDEO_URL = environment.apiUrl + '/api/v1/videos' static BASE_FEEDS_URL = environment.apiUrl + '/feeds/videos.' static BASE_SUBSCRIPTION_FEEDS_URL = environment.apiUrl + '/feeds/subscriptions.' @@ -60,18 +60,18 @@ export class VideoService { ) {} getVideoViewUrl (uuid: string) { - return VideoService.BASE_VIDEO_URL + uuid + '/views' + return VideoService.BASE_VIDEO_URL + '/' + uuid + '/views' } getUserWatchingVideoUrl (uuid: string) { - return VideoService.BASE_VIDEO_URL + uuid + '/watching' + return VideoService.BASE_VIDEO_URL + '/' + uuid + '/watching' } getVideo (options: { videoId: string }): Observable { return this.serverService.getServerLocale() .pipe( switchMap(translations => { - return this.authHttp.get(VideoService.BASE_VIDEO_URL + options.videoId) + return this.authHttp.get(VideoService.BASE_VIDEO_URL + '/' + options.videoId) .pipe(map(videoHash => ({ videoHash, translations }))) }), map(({ videoHash, translations }) => new VideoDetails(videoHash, translations)), @@ -111,7 +111,7 @@ export class VideoService { const data = objectToFormData(body) - return this.authHttp.put(VideoService.BASE_VIDEO_URL + video.id, data) + return this.authHttp.put(VideoService.BASE_VIDEO_URL + '/' + video.id, data) .pipe( map(this.restExtractor.extractDataBool), catchError(err => this.restExtractor.handleError(err)) @@ -119,7 +119,7 @@ export class VideoService { } uploadVideo (video: FormData) { - const req = new HttpRequest('POST', VideoService.BASE_VIDEO_URL + 'upload', video, { reportProgress: true }) + const req = new HttpRequest('POST', VideoService.BASE_VIDEO_URL + '/' + 'upload', video, { reportProgress: true }) return this.authHttp .request<{ video: { id: number, uuid: string } }>(req) @@ -321,7 +321,7 @@ export class VideoService { return from(ids) .pipe( - concatMap(id => this.authHttp.delete(VideoService.BASE_VIDEO_URL + id)), + concatMap(id => this.authHttp.delete(VideoService.BASE_VIDEO_URL + '/' + id)), toArray(), catchError(err => this.restExtractor.handleError(err)) ) @@ -413,7 +413,7 @@ export class VideoService { } private setVideoRate (id: number, rateType: UserVideoRateType) { - const url = VideoService.BASE_VIDEO_URL + id + '/rate' + const url = VideoService.BASE_VIDEO_URL + '/' + id + '/rate' const body: UserVideoRateUpdate = { rating: rateType } -- cgit v1.2.3