diff options
Diffstat (limited to 'client/src/app/shared/video-channel')
-rw-r--r-- | client/src/app/shared/video-channel/video-channel.model.ts | 9 | ||||
-rw-r--r-- | client/src/app/shared/video-channel/video-channel.service.ts | 7 |
2 files changed, 14 insertions, 2 deletions
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 309b614ae..617d6d44d 100644 --- a/client/src/app/shared/video-channel/video-channel.model.ts +++ b/client/src/app/shared/video-channel/video-channel.model.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { VideoChannel as ServerVideoChannel } from '../../../../../shared/models/videos' | 1 | import { VideoChannel as ServerVideoChannel, ViewsPerDate } from '../../../../../shared/models/videos' |
2 | import { Actor } from '../actor/actor.model' | 2 | import { Actor } from '../actor/actor.model' |
3 | import { Account } from '../../../../../shared/models/actors' | 3 | import { Account } from '../../../../../shared/models/actors' |
4 | 4 | ||
@@ -8,9 +8,11 @@ export class VideoChannel extends Actor implements ServerVideoChannel { | |||
8 | support: string | 8 | support: string |
9 | isLocal: boolean | 9 | isLocal: boolean |
10 | nameWithHost: string | 10 | nameWithHost: string |
11 | nameWithHostForced: string | ||
11 | ownerAccount?: Account | 12 | ownerAccount?: Account |
12 | ownerBy?: string | 13 | ownerBy?: string |
13 | ownerAvatarUrl?: string | 14 | ownerAvatarUrl?: string |
15 | viewsPerDay?: ViewsPerDate[] | ||
14 | 16 | ||
15 | constructor (hash: ServerVideoChannel) { | 17 | constructor (hash: ServerVideoChannel) { |
16 | super(hash) | 18 | super(hash) |
@@ -20,6 +22,11 @@ export class VideoChannel extends Actor implements ServerVideoChannel { | |||
20 | this.support = hash.support | 22 | this.support = hash.support |
21 | this.isLocal = hash.isLocal | 23 | this.isLocal = hash.isLocal |
22 | this.nameWithHost = Actor.CREATE_BY_STRING(this.name, this.host) | 24 | this.nameWithHost = Actor.CREATE_BY_STRING(this.name, this.host) |
25 | this.nameWithHostForced = Actor.CREATE_BY_STRING(this.name, this.host, true) | ||
26 | |||
27 | if (hash.viewsPerDay) { | ||
28 | this.viewsPerDay = hash.viewsPerDay.map(v => ({ ...v, date: new Date(v.date) })) | ||
29 | } | ||
23 | 30 | ||
24 | if (hash.ownerAccount) { | 31 | if (hash.ownerAccount) { |
25 | this.ownerAccount = hash.ownerAccount | 32 | this.ownerAccount = 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 { | |||
44 | ) | 44 | ) |
45 | } | 45 | } |
46 | 46 | ||
47 | listAccountVideoChannels (account: Account, componentPagination?: ComponentPaginationLight): Observable<ResultList<VideoChannel>> { | 47 | listAccountVideoChannels ( |
48 | account: Account, | ||
49 | componentPagination?: ComponentPaginationLight, | ||
50 | withStats = false | ||
51 | ): Observable<ResultList<VideoChannel>> { | ||
48 | const pagination = componentPagination | 52 | const pagination = componentPagination |
49 | ? this.restService.componentPaginationToRestPagination(componentPagination) | 53 | ? this.restService.componentPaginationToRestPagination(componentPagination) |
50 | : { start: 0, count: 20 } | 54 | : { start: 0, count: 20 } |
51 | 55 | ||
52 | let params = new HttpParams() | 56 | let params = new HttpParams() |
53 | params = this.restService.addRestGetParams(params, pagination) | 57 | params = this.restService.addRestGetParams(params, pagination) |
58 | params = params.set('withStats', withStats + '') | ||
54 | 59 | ||
55 | const url = AccountService.BASE_ACCOUNT_URL + account.nameWithHost + '/video-channels' | 60 | const url = AccountService.BASE_ACCOUNT_URL + account.nameWithHost + '/video-channels' |
56 | return this.authHttp.get<ResultList<VideoChannelServer>>(url, { params }) | 61 | return this.authHttp.get<ResultList<VideoChannelServer>>(url, { params }) |