aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-video-miniature
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-07-15 15:30:14 +0200
committerChocobozzz <me@florianbigard.com>2022-07-18 11:37:18 +0200
commit42b40636991b97fe818007fab19091764fc5db73 (patch)
treedb431787c06ce898d22e91ff771f795219274fc6 /client/src/app/shared/shared-video-miniature
parent654d4ede7fa4d0faa71e49bcfab6b65a686397b2 (diff)
downloadPeerTube-42b40636991b97fe818007fab19091764fc5db73.tar.gz
PeerTube-42b40636991b97fe818007fab19091764fc5db73.tar.zst
PeerTube-42b40636991b97fe818007fab19091764fc5db73.zip
Add ability for client to create server logs
Diffstat (limited to 'client/src/app/shared/shared-video-miniature')
-rw-r--r--client/src/app/shared/shared-video-miniature/video-download.component.ts5
-rw-r--r--client/src/app/shared/shared-video-miniature/video-filters-header.component.ts6
-rw-r--r--client/src/app/shared/shared-video-miniature/videos-list.component.ts11
-rw-r--r--client/src/app/shared/shared-video-miniature/videos-selection.component.ts3
4 files changed, 14 insertions, 11 deletions
diff --git a/client/src/app/shared/shared-video-miniature/video-download.component.ts b/client/src/app/shared/shared-video-miniature/video-download.component.ts
index bbda39c2d..47482caaa 100644
--- a/client/src/app/shared/shared-video-miniature/video-download.component.ts
+++ b/client/src/app/shared/shared-video-miniature/video-download.component.ts
@@ -4,6 +4,7 @@ import { tap } from 'rxjs/operators'
4import { Component, ElementRef, Inject, LOCALE_ID, ViewChild } from '@angular/core' 4import { Component, ElementRef, Inject, LOCALE_ID, ViewChild } from '@angular/core'
5import { AuthService, HooksService, Notifier } from '@app/core' 5import { AuthService, HooksService, Notifier } from '@app/core'
6import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap' 6import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'
7import { logger } from '@root-helpers/logger'
7import { VideoCaption, VideoFile, VideoPrivacy } from '@shared/models' 8import { VideoCaption, VideoFile, VideoPrivacy } from '@shared/models'
8import { BytesPipe, NumberFormatterPipe, VideoDetails, VideoService } from '../shared-main' 9import { BytesPipe, NumberFormatterPipe, VideoDetails, VideoService } from '../shared-main'
9 10
@@ -142,7 +143,7 @@ export class VideoDownloadComponent {
142 .find(f => f.resolution.id === this.resolutionId) 143 .find(f => f.resolution.id === this.resolutionId)
143 144
144 if (!file) { 145 if (!file) {
145 console.error('Could not find file with resolution %d.', this.resolutionId) 146 logger.error(`Could not find file with resolution ${this.resolutionId}`)
146 return undefined 147 return undefined
147 } 148 }
148 149
@@ -175,7 +176,7 @@ export class VideoDownloadComponent {
175 .find(c => c.language.id === this.subtitleLanguageId) 176 .find(c => c.language.id === this.subtitleLanguageId)
176 177
177 if (!caption) { 178 if (!caption) {
178 console.error('Cannot find caption %s.', this.subtitleLanguageId) 179 logger.error(`Cannot find caption ${this.subtitleLanguageId}`)
179 return undefined 180 return undefined
180 } 181 }
181 182
diff --git a/client/src/app/shared/shared-video-miniature/video-filters-header.component.ts b/client/src/app/shared/shared-video-miniature/video-filters-header.component.ts
index 7b806248b..a5da9ebf3 100644
--- a/client/src/app/shared/shared-video-miniature/video-filters-header.component.ts
+++ b/client/src/app/shared/shared-video-miniature/video-filters-header.component.ts
@@ -8,7 +8,7 @@ import { UserRight } from '@shared/models'
8import { PeertubeModalService } from '../shared-main' 8import { PeertubeModalService } from '../shared-main'
9import { VideoFilters } from './video-filters.model' 9import { VideoFilters } from './video-filters.model'
10 10
11const logger = debug('peertube:videos:VideoFiltersHeaderComponent') 11const debugLogger = debug('peertube:videos:VideoFiltersHeaderComponent')
12 12
13@Component({ 13@Component({
14 selector: 'my-video-filters-header', 14 selector: 'my-video-filters-header',
@@ -54,7 +54,7 @@ export class VideoFiltersHeaderComponent implements OnInit, OnDestroy {
54 }) 54 })
55 55
56 this.form.valueChanges.subscribe(values => { 56 this.form.valueChanges.subscribe(values => {
57 logger('Loading values from form: %O', values) 57 debugLogger('Loading values from form: %O', values)
58 58
59 this.filters.load(values) 59 this.filters.load(values)
60 this.filtersChanged.emit() 60 this.filtersChanged.emit()
@@ -105,6 +105,6 @@ export class VideoFiltersHeaderComponent implements OnInit, OnDestroy {
105 const defaultValues = this.filters.toFormObject() 105 const defaultValues = this.filters.toFormObject()
106 this.form.patchValue(defaultValues, { emitEvent }) 106 this.form.patchValue(defaultValues, { emitEvent })
107 107
108 logger('Patched form: %O', defaultValues) 108 debugLogger('Patched form: %O', defaultValues)
109 } 109 }
110} 110}
diff --git a/client/src/app/shared/shared-video-miniature/videos-list.component.ts b/client/src/app/shared/shared-video-miniature/videos-list.component.ts
index 38a80b973..508a189fd 100644
--- a/client/src/app/shared/shared-video-miniature/videos-list.component.ts
+++ b/client/src/app/shared/shared-video-miniature/videos-list.component.ts
@@ -14,13 +14,14 @@ import {
14 UserService 14 UserService
15} from '@app/core' 15} from '@app/core'
16import { GlobalIconName } from '@app/shared/shared-icons' 16import { GlobalIconName } from '@app/shared/shared-icons'
17import { logger } from '@root-helpers/logger'
17import { isLastMonth, isLastWeek, isThisMonth, isToday, isYesterday } from '@shared/core-utils' 18import { isLastMonth, isLastWeek, isThisMonth, isToday, isYesterday } from '@shared/core-utils'
18import { ResultList, UserRight, VideoSortField } from '@shared/models' 19import { ResultList, UserRight, VideoSortField } from '@shared/models'
19import { Syndication, Video } from '../shared-main' 20import { Syndication, Video } from '../shared-main'
20import { VideoFilters, VideoFilterScope } from './video-filters.model' 21import { VideoFilters, VideoFilterScope } from './video-filters.model'
21import { MiniatureDisplayOptions } from './video-miniature.component' 22import { MiniatureDisplayOptions } from './video-miniature.component'
22 23
23const logger = debug('peertube:videos:VideosListComponent') 24const debugLogger = debug('peertube:videos:VideosListComponent')
24 25
25export type HeaderAction = { 26export type HeaderAction = {
26 iconName: GlobalIconName 27 iconName: GlobalIconName
@@ -245,7 +246,7 @@ export class VideosListComponent implements OnInit, OnChanges, OnDestroy {
245 error: err => { 246 error: err => {
246 const message = $localize`Cannot load more videos. Try again later.` 247 const message = $localize`Cannot load more videos. Try again later.`
247 248
248 console.error(message, { err }) 249 logger.error(message, err)
249 this.notifier.error(message) 250 this.notifier.error(message)
250 } 251 }
251 }) 252 })
@@ -323,7 +324,7 @@ export class VideosListComponent implements OnInit, OnChanges, OnDestroy {
323 } 324 }
324 325
325 onFiltersChanged (customizedByUser: boolean) { 326 onFiltersChanged (customizedByUser: boolean) {
326 logger('Running on filters changed') 327 debugLogger('Running on filters changed')
327 328
328 this.updateUrl(customizedByUser) 329 this.updateUrl(customizedByUser)
329 330
@@ -364,7 +365,7 @@ export class VideosListComponent implements OnInit, OnChanges, OnDestroy {
364 if (!items || items.length === 0) this.syndicationItems = undefined 365 if (!items || items.length === 0) this.syndicationItems = undefined
365 else this.syndicationItems = items 366 else this.syndicationItems = items
366 }) 367 })
367 .catch(err => console.error('Cannot get syndication items.', err)) 368 .catch(err => logger.error('Cannot get syndication items.', err))
368 } 369 }
369 370
370 private updateUrl (customizedByUser: boolean) { 371 private updateUrl (customizedByUser: boolean) {
@@ -375,7 +376,7 @@ export class VideosListComponent implements OnInit, OnChanges, OnDestroy {
375 ? { ...baseQuery, c: customizedByUser } 376 ? { ...baseQuery, c: customizedByUser }
376 : baseQuery 377 : baseQuery
377 378
378 logger('Will inject %O in URL query', queryParams) 379 debugLogger('Will inject %O in URL query', queryParams)
379 380
380 const baseRoute = this.baseRouteBuilderFunction 381 const baseRoute = this.baseRouteBuilderFunction
381 ? this.baseRouteBuilderFunction(this.filters) 382 ? this.baseRouteBuilderFunction(this.filters)
diff --git a/client/src/app/shared/shared-video-miniature/videos-selection.component.ts b/client/src/app/shared/shared-video-miniature/videos-selection.component.ts
index bac828fba..fa3c79bbb 100644
--- a/client/src/app/shared/shared-video-miniature/videos-selection.component.ts
+++ b/client/src/app/shared/shared-video-miniature/videos-selection.component.ts
@@ -1,6 +1,7 @@
1import { Observable, Subject } from 'rxjs' 1import { Observable, Subject } from 'rxjs'
2import { AfterContentInit, Component, ContentChildren, EventEmitter, Input, Output, QueryList, TemplateRef } from '@angular/core' 2import { AfterContentInit, Component, ContentChildren, EventEmitter, Input, Output, QueryList, TemplateRef } from '@angular/core'
3import { ComponentPagination, Notifier, User } from '@app/core' 3import { ComponentPagination, Notifier, User } from '@app/core'
4import { logger } from '@root-helpers/logger'
4import { ResultList, VideoSortField } from '@shared/models' 5import { ResultList, VideoSortField } from '@shared/models'
5import { PeerTubeTemplateDirective, Video } from '../shared-main' 6import { PeerTubeTemplateDirective, Video } from '../shared-main'
6import { MiniatureDisplayOptions } from './video-miniature.component' 7import { MiniatureDisplayOptions } from './video-miniature.component'
@@ -128,7 +129,7 @@ export class VideosSelectionComponent implements AfterContentInit {
128 error: err => { 129 error: err => {
129 const message = $localize`Cannot load more videos. Try again later.` 130 const message = $localize`Cannot load more videos. Try again later.`
130 131
131 console.error(message, { err }) 132 logger.error(message, err)
132 this.notifier.error(message) 133 this.notifier.error(message)
133 } 134 }
134 }) 135 })