Refactor views component
This commit is contained in:
parent
0d8de2756f
commit
5cac83a78d
|
@ -53,12 +53,8 @@
|
||||||
|
|
||||||
<div class="video-info-date-views">
|
<div class="video-info-date-views">
|
||||||
<ng-container i18n>Published <my-date-toggle [date]="video.publishedAt"></my-date-toggle></ng-container>
|
<ng-container i18n>Published <my-date-toggle [date]="video.publishedAt"></my-date-toggle></ng-container>
|
||||||
|
•
|
||||||
<span i18n [title]="video.getExactNumberOfViews()" class="views">
|
<my-video-views-counter [video]="video"></my-video-views-counter>
|
||||||
• {{ video.views | myNumberFormatter }}
|
|
||||||
<ng-container *ngIf="!video.isLive">views</ng-container>
|
|
||||||
<ng-container *ngIf="video.isLive">viewers</ng-container>
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import { SharedMainModule } from '@app/shared/shared-main'
|
||||||
import { SharedModerationModule } from '@app/shared/shared-moderation'
|
import { SharedModerationModule } from '@app/shared/shared-moderation'
|
||||||
import { SharedShareModal } from '@app/shared/shared-share-modal'
|
import { SharedShareModal } from '@app/shared/shared-share-modal'
|
||||||
import { SharedUserSubscriptionModule } from '@app/shared/shared-user-subscription'
|
import { SharedUserSubscriptionModule } from '@app/shared/shared-user-subscription'
|
||||||
|
import { SharedVideoModule } from '@app/shared/shared-video'
|
||||||
import { SharedVideoCommentModule } from '@app/shared/shared-video-comment'
|
import { SharedVideoCommentModule } from '@app/shared/shared-video-comment'
|
||||||
import { SharedVideoMiniatureModule } from '@app/shared/shared-video-miniature'
|
import { SharedVideoMiniatureModule } from '@app/shared/shared-video-miniature'
|
||||||
import { SharedVideoPlaylistModule } from '@app/shared/shared-video-playlist'
|
import { SharedVideoPlaylistModule } from '@app/shared/shared-video-playlist'
|
||||||
|
@ -32,7 +33,8 @@ import { VideoWatchComponent } from './video-watch.component'
|
||||||
SharedModerationModule,
|
SharedModerationModule,
|
||||||
SharedGlobalIconModule,
|
SharedGlobalIconModule,
|
||||||
SharedVideoCommentModule,
|
SharedVideoCommentModule,
|
||||||
SharedShareModal
|
SharedShareModal,
|
||||||
|
SharedVideoModule
|
||||||
],
|
],
|
||||||
|
|
||||||
declarations: [
|
declarations: [
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { SharedFormModule } from '../shared-forms'
|
||||||
import { SharedGlobalIconModule } from '../shared-icons'
|
import { SharedGlobalIconModule } from '../shared-icons'
|
||||||
import { SharedMainModule } from '../shared-main/shared-main.module'
|
import { SharedMainModule } from '../shared-main/shared-main.module'
|
||||||
import { SharedModerationModule } from '../shared-moderation'
|
import { SharedModerationModule } from '../shared-moderation'
|
||||||
|
import { SharedVideoModule } from '../shared-video'
|
||||||
import { SharedThumbnailModule } from '../shared-thumbnail'
|
import { SharedThumbnailModule } from '../shared-thumbnail'
|
||||||
import { SharedVideoLiveModule } from '../shared-video-live'
|
import { SharedVideoLiveModule } from '../shared-video-live'
|
||||||
import { SharedVideoPlaylistModule } from '../shared-video-playlist/shared-video-playlist.module'
|
import { SharedVideoPlaylistModule } from '../shared-video-playlist/shared-video-playlist.module'
|
||||||
|
@ -20,7 +21,8 @@ import { VideosSelectionComponent } from './videos-selection.component'
|
||||||
SharedVideoPlaylistModule,
|
SharedVideoPlaylistModule,
|
||||||
SharedThumbnailModule,
|
SharedThumbnailModule,
|
||||||
SharedGlobalIconModule,
|
SharedGlobalIconModule,
|
||||||
SharedVideoLiveModule
|
SharedVideoLiveModule,
|
||||||
|
SharedVideoModule
|
||||||
],
|
],
|
||||||
|
|
||||||
declarations: [
|
declarations: [
|
||||||
|
|
|
@ -28,9 +28,8 @@
|
||||||
|
|
||||||
<span class="views" [title]="video.getExactNumberOfViews()">
|
<span class="views" [title]="video.getExactNumberOfViews()">
|
||||||
<ng-container *ngIf="displayOptions.date && displayOptions.views"> • </ng-container>
|
<ng-container *ngIf="displayOptions.date && displayOptions.views"> • </ng-container>
|
||||||
<ng-container i18n *ngIf="displayOptions.views">
|
|
||||||
{video.views, plural, =1 {1 view} other {{{ video.views | myNumberFormatter }} views}}
|
<my-video-views-counter *ngIf="displayOptions.views" [video]="video"></my-video-views-counter>
|
||||||
</ng-container>
|
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
export * from './shared-video.module'
|
|
@ -0,0 +1,19 @@
|
||||||
|
|
||||||
|
import { NgModule } from '@angular/core'
|
||||||
|
import { SharedMainModule } from '../shared-main/shared-main.module'
|
||||||
|
import { VideoViewsCounterComponent } from './video-views-counter.component'
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
SharedMainModule
|
||||||
|
],
|
||||||
|
|
||||||
|
declarations: [
|
||||||
|
VideoViewsCounterComponent
|
||||||
|
],
|
||||||
|
|
||||||
|
exports: [
|
||||||
|
VideoViewsCounterComponent
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class SharedVideoModule { }
|
|
@ -0,0 +1,9 @@
|
||||||
|
<span [title]="video.getExactNumberOfViews()">
|
||||||
|
<ng-container i18n *ngIf="!video.isLive">
|
||||||
|
{video.views, plural, =1 {1 view} other {{{ video.views | myNumberFormatter }} views}}
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-container i18n *ngIf="video.isLive">
|
||||||
|
{video.views, plural, =1 {1 viewer} other {{{ video.views | myNumberFormatter }} viewers}}
|
||||||
|
</ng-container>
|
||||||
|
</span>
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { Component, Input } from '@angular/core'
|
||||||
|
import { Video } from '../shared-main'
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'my-video-views-counter',
|
||||||
|
styleUrls: [ './video-views-counter.component.scss' ],
|
||||||
|
templateUrl: './video-views-counter.component.html'
|
||||||
|
})
|
||||||
|
export class VideoViewsCounterComponent {
|
||||||
|
@Input() video: Video
|
||||||
|
}
|
|
@ -42,8 +42,7 @@ import {
|
||||||
waitJobs,
|
waitJobs,
|
||||||
waitUntilLiveEnded,
|
waitUntilLiveEnded,
|
||||||
waitUntilLivePublished,
|
waitUntilLivePublished,
|
||||||
waitUntilLiveSegmentGeneration,
|
waitUntilLiveSegmentGeneration
|
||||||
waitUntilLog
|
|
||||||
} from '../../../../shared/extra-utils'
|
} from '../../../../shared/extra-utils'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
@ -329,7 +328,7 @@ describe('Test live', function () {
|
||||||
await checkResolutionsInMasterPlaylist(hlsPlaylist.playlistUrl, resolutions)
|
await checkResolutionsInMasterPlaylist(hlsPlaylist.playlistUrl, resolutions)
|
||||||
|
|
||||||
for (let i = 0; i < resolutions.length; i++) {
|
for (let i = 0; i < resolutions.length; i++) {
|
||||||
const segmentNum = 1
|
const segmentNum = 2
|
||||||
const segmentName = `${i}-00000${segmentNum}.ts`
|
const segmentName = `${i}-00000${segmentNum}.ts`
|
||||||
await waitUntilLiveSegmentGeneration(servers[0], video.uuid, i, segmentNum)
|
await waitUntilLiveSegmentGeneration(servers[0], video.uuid, i, segmentNum)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue