From 747c562837e37f2fa455e8ef62165e9bb4e365f1 Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Tue, 24 Mar 2020 01:12:30 +0100 Subject: Put channel stats behind withStats flag --- .../my-account-video-channels.component.ts | 16 +++++++--------- .../src/app/shared/video-channel/video-channel.model.ts | 2 +- .../app/shared/video-channel/video-channel.service.ts | 7 ++++++- 3 files changed, 14 insertions(+), 11 deletions(-) (limited to 'client/src') diff --git a/client/src/app/+my-account/my-account-video-channels/my-account-video-channels.component.ts b/client/src/app/+my-account/my-account-video-channels/my-account-video-channels.component.ts index eeab3a8dd..27a157621 100644 --- a/client/src/app/+my-account/my-account-video-channels/my-account-video-channels.component.ts +++ b/client/src/app/+my-account/my-account-video-channels/my-account-video-channels.component.ts @@ -57,7 +57,7 @@ export class MyAccountVideoChannelsComponent implements OnInit { min: Math.max(0, this.videoChannelsMinimumDailyViews - (3 * this.videoChannelsMaximumDailyViews / 100)), max: this.videoChannelsMaximumDailyViews } - }], + }] }, layout: { padding: { @@ -68,7 +68,7 @@ export class MyAccountVideoChannelsComponent implements OnInit { } }, elements: { - point:{ + point: { radius: 0 } }, @@ -76,14 +76,12 @@ export class MyAccountVideoChannelsComponent implements OnInit { mode: 'index', intersect: false, custom: function (tooltip: any) { - if (!tooltip) return; - // disable displaying the color box; - tooltip.displayColors = false; + if (!tooltip) return + // disable displaying the color box + tooltip.displayColors = false }, callbacks: { - label: function (tooltip: any, data: any) { - return `${tooltip.value} views`; - } + label: (tooltip: any, data: any) => `${tooltip.value} views` } }, hover: { @@ -124,7 +122,7 @@ export class MyAccountVideoChannelsComponent implements OnInit { private loadVideoChannels () { this.authService.userInformationLoaded - .pipe(flatMap(() => this.videoChannelService.listAccountVideoChannels(this.user.account))) + .pipe(flatMap(() => this.videoChannelService.listAccountVideoChannels(this.user.account, null, true))) .subscribe(res => { this.videoChannels = res.data this.videoChannelsData = this.videoChannels.map(v => ({ diff --git a/client/src/app/shared/video-channel/video-channel.model.ts b/client/src/app/shared/video-channel/video-channel.model.ts index ee3288d7a..c93af0ca5 100644 --- a/client/src/app/shared/video-channel/video-channel.model.ts +++ b/client/src/app/shared/video-channel/video-channel.model.ts @@ -25,7 +25,7 @@ export class VideoChannel extends Actor implements ServerVideoChannel { this.nameWithHostForced = Actor.CREATE_BY_STRING(this.name, this.host, true) if (hash.viewsPerDay) { - this.viewsPerDay = hash.viewsPerDay.map(v => ({ ...v, date: new Date(v.date)})) + this.viewsPerDay = hash.viewsPerDay.map(v => ({ ...v, date: new Date(v.date) })) } if (hash.ownerAccount) { diff --git a/client/src/app/shared/video-channel/video-channel.service.ts b/client/src/app/shared/video-channel/video-channel.service.ts index adb4f4819..0e036bda7 100644 --- a/client/src/app/shared/video-channel/video-channel.service.ts +++ b/client/src/app/shared/video-channel/video-channel.service.ts @@ -44,13 +44,18 @@ export class VideoChannelService { ) } - listAccountVideoChannels (account: Account, componentPagination?: ComponentPaginationLight): Observable> { + listAccountVideoChannels ( + account: Account, + componentPagination?: ComponentPaginationLight, + withStats = false + ): Observable> { const pagination = componentPagination ? this.restService.componentPaginationToRestPagination(componentPagination) : { start: 0, count: 20 } let params = new HttpParams() params = this.restService.addRestGetParams(params, pagination) + params = params.set('withStats', withStats + '') const url = AccountService.BASE_ACCOUNT_URL + account.nameWithHost + '/video-channels' return this.authHttp.get>(url, { params }) -- cgit v1.2.3