aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/video
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-10-18 14:35:31 +0200
committerChocobozzz <me@florianbigard.com>2018-10-18 14:35:31 +0200
commitc199c427d4ae586339822320f20f512a7a19dc3f (patch)
tree9cbe8bebc25e97d2e8086c41bcd7180dd752dbac /client/src/app/shared/video
parentcdf4cb9eaf5f6bc71f7c1e1963c07575f1d2593d (diff)
downloadPeerTube-c199c427d4ae586339822320f20f512a7a19dc3f.tar.gz
PeerTube-c199c427d4ae586339822320f20f512a7a19dc3f.tar.zst
PeerTube-c199c427d4ae586339822320f20f512a7a19dc3f.zip
Better typings
Diffstat (limited to 'client/src/app/shared/video')
-rw-r--r--client/src/app/shared/video/abstract-video-list.html2
-rw-r--r--client/src/app/shared/video/abstract-video-list.scss2
-rw-r--r--client/src/app/shared/video/abstract-video-list.ts11
-rw-r--r--client/src/app/shared/video/feed.component.html (renamed from client/src/app/shared/video/video-feed.component.html)0
-rw-r--r--client/src/app/shared/video/feed.component.scss (renamed from client/src/app/shared/video/video-feed.component.scss)0
-rw-r--r--client/src/app/shared/video/feed.component.ts11
-rw-r--r--client/src/app/shared/video/syndication.model.ts7
-rw-r--r--client/src/app/shared/video/video-edit.model.ts5
-rw-r--r--client/src/app/shared/video/video-feed.component.ts10
-rw-r--r--client/src/app/shared/video/video.service.ts4
10 files changed, 31 insertions, 21 deletions
diff --git a/client/src/app/shared/video/abstract-video-list.html b/client/src/app/shared/video/abstract-video-list.html
index 69a619b76..29492351b 100644
--- a/client/src/app/shared/video/abstract-video-list.html
+++ b/client/src/app/shared/video/abstract-video-list.html
@@ -3,7 +3,7 @@
3 <div *ngIf="titlePage" class="title-page title-page-single"> 3 <div *ngIf="titlePage" class="title-page title-page-single">
4 {{ titlePage }} 4 {{ titlePage }}
5 </div> 5 </div>
6 <my-video-feed [syndicationItems]="syndicationItems"></my-video-feed> 6 <my-feed [syndicationItems]="syndicationItems"></my-feed>
7 7
8 <div class="moderation-block" *ngIf="displayModerationBlock"> 8 <div class="moderation-block" *ngIf="displayModerationBlock">
9 <my-peertube-checkbox 9 <my-peertube-checkbox
diff --git a/client/src/app/shared/video/abstract-video-list.scss b/client/src/app/shared/video/abstract-video-list.scss
index 92998cb44..9fb3fd4d6 100644
--- a/client/src/app/shared/video/abstract-video-list.scss
+++ b/client/src/app/shared/video/abstract-video-list.scss
@@ -17,7 +17,7 @@
17 margin: 0 5px 0 0; 17 margin: 0 5px 0 0;
18 } 18 }
19 19
20 my-video-feed { 20 my-feed {
21 display: inline-block; 21 display: inline-block;
22 position: relative; 22 position: relative;
23 top: 1px; 23 top: 1px;
diff --git a/client/src/app/shared/video/abstract-video-list.ts b/client/src/app/shared/video/abstract-video-list.ts
index 87814d4ba..2d32dd6ad 100644
--- a/client/src/app/shared/video/abstract-video-list.ts
+++ b/client/src/app/shared/video/abstract-video-list.ts
@@ -12,6 +12,7 @@ import { Video } from './video.model'
12import { I18n } from '@ngx-translate/i18n-polyfill' 12import { I18n } from '@ngx-translate/i18n-polyfill'
13import { ScreenService } from '@app/shared/misc/screen.service' 13import { ScreenService } from '@app/shared/misc/screen.service'
14import { OwnerDisplayType } from '@app/shared/video/video-miniature.component' 14import { OwnerDisplayType } from '@app/shared/video/video-miniature.component'
15import { Syndication } from '@app/shared/video/syndication.model'
15 16
16export abstract class AbstractVideoList implements OnInit, OnDestroy { 17export abstract class AbstractVideoList implements OnInit, OnDestroy {
17 private static LINES_PER_PAGE = 4 18 private static LINES_PER_PAGE = 4
@@ -27,7 +28,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy {
27 sort: VideoSortField = '-publishedAt' 28 sort: VideoSortField = '-publishedAt'
28 categoryOneOf?: number 29 categoryOneOf?: number
29 defaultSort: VideoSortField = '-publishedAt' 30 defaultSort: VideoSortField = '-publishedAt'
30 syndicationItems: any = [] 31 syndicationItems: Syndication[] = []
31 32
32 loadOnInit = true 33 loadOnInit = true
33 marginContent = true 34 marginContent = true
@@ -59,7 +60,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy {
59 private resizeSubscription: Subscription 60 private resizeSubscription: Subscription
60 61
61 abstract getVideosObservable (page: number): Observable<{ videos: Video[], totalVideos: number}> 62 abstract getVideosObservable (page: number): Observable<{ videos: Video[], totalVideos: number}>
62 abstract generateSyndicationList (): any 63 abstract generateSyndicationList (): void
63 64
64 get user () { 65 get user () {
65 return this.authService.getUser() 66 return this.authService.getUser()
@@ -209,9 +210,11 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy {
209 } 210 }
210 211
211 protected setNewRouteParams () { 212 protected setNewRouteParams () {
212 const paramsObject: any = this.buildRouteParams() 213 const paramsObject = this.buildRouteParams()
213 214
214 const queryParams = Object.keys(paramsObject).map(p => p + '=' + paramsObject[p]).join('&') 215 const queryParams = Object.keys(paramsObject)
216 .map(p => p + '=' + paramsObject[p])
217 .join('&')
215 this.location.replaceState(this.currentRoute, queryParams) 218 this.location.replaceState(this.currentRoute, queryParams)
216 } 219 }
217 220
diff --git a/client/src/app/shared/video/video-feed.component.html b/client/src/app/shared/video/feed.component.html
index 16116ba88..16116ba88 100644
--- a/client/src/app/shared/video/video-feed.component.html
+++ b/client/src/app/shared/video/feed.component.html
diff --git a/client/src/app/shared/video/video-feed.component.scss b/client/src/app/shared/video/feed.component.scss
index 385764be0..385764be0 100644
--- a/client/src/app/shared/video/video-feed.component.scss
+++ b/client/src/app/shared/video/feed.component.scss
diff --git a/client/src/app/shared/video/feed.component.ts b/client/src/app/shared/video/feed.component.ts
new file mode 100644
index 000000000..12507458f
--- /dev/null
+++ b/client/src/app/shared/video/feed.component.ts
@@ -0,0 +1,11 @@
1import { Component, Input } from '@angular/core'
2import { Syndication } from '@app/shared/video/syndication.model'
3
4@Component({
5 selector: 'my-feed',
6 styleUrls: [ './feed.component.scss' ],
7 templateUrl: './feed.component.html'
8})
9export class FeedComponent {
10 @Input() syndicationItems: Syndication[]
11}
diff --git a/client/src/app/shared/video/syndication.model.ts b/client/src/app/shared/video/syndication.model.ts
new file mode 100644
index 000000000..a52b5771b
--- /dev/null
+++ b/client/src/app/shared/video/syndication.model.ts
@@ -0,0 +1,7 @@
1import { FeedFormat } from '../../../../../shared/models/feeds/feed-format.enum'
2
3export interface Syndication {
4 format: FeedFormat,
5 label: string,
6 url: string
7} \ No newline at end of file
diff --git a/client/src/app/shared/video/video-edit.model.ts b/client/src/app/shared/video/video-edit.model.ts
index a62277e04..fc772a3cf 100644
--- a/client/src/app/shared/video/video-edit.model.ts
+++ b/client/src/app/shared/video/video-edit.model.ts
@@ -25,7 +25,6 @@ export class VideoEdit implements VideoUpdate {
25 uuid?: string 25 uuid?: string
26 id?: number 26 id?: number
27 scheduleUpdate?: VideoScheduleUpdate 27 scheduleUpdate?: VideoScheduleUpdate
28 [key: string]: any
29 28
30 constructor (video?: Video & { tags: string[], commentsEnabled: boolean, support: string, thumbnailUrl: string, previewUrl: string }) { 29 constructor (video?: Video & { tags: string[], commentsEnabled: boolean, support: string, thumbnailUrl: string, previewUrl: string }) {
31 if (video) { 30 if (video) {
@@ -50,14 +49,14 @@ export class VideoEdit implements VideoUpdate {
50 } 49 }
51 } 50 }
52 51
53 patch (values: any) { 52 patch (values: { [ id: string ]: string }) {
54 Object.keys(values).forEach((key) => { 53 Object.keys(values).forEach((key) => {
55 this[ key ] = values[ key ] 54 this[ key ] = values[ key ]
56 }) 55 })
57 56
58 // If schedule publication, the video is private and will be changed to public privacy 57 // If schedule publication, the video is private and will be changed to public privacy
59 if (parseInt(values['privacy'], 10) === VideoEdit.SPECIAL_SCHEDULED_PRIVACY) { 58 if (parseInt(values['privacy'], 10) === VideoEdit.SPECIAL_SCHEDULED_PRIVACY) {
60 const updateAt = (values['schedulePublicationAt'] as Date) 59 const updateAt = new Date(values['schedulePublicationAt'])
61 updateAt.setSeconds(0) 60 updateAt.setSeconds(0)
62 61
63 this.privacy = VideoPrivacy.PRIVATE 62 this.privacy = VideoPrivacy.PRIVATE
diff --git a/client/src/app/shared/video/video-feed.component.ts b/client/src/app/shared/video/video-feed.component.ts
deleted file mode 100644
index be6c80c3f..000000000
--- a/client/src/app/shared/video/video-feed.component.ts
+++ /dev/null
@@ -1,10 +0,0 @@
1import { Component, Input } from '@angular/core'
2
3@Component({
4 selector: 'my-video-feed',
5 styleUrls: [ './video-feed.component.scss' ],
6 templateUrl: './video-feed.component.html'
7})
8export class VideoFeedComponent {
9 @Input() syndicationItems: any
10}
diff --git a/client/src/app/shared/video/video.service.ts b/client/src/app/shared/video/video.service.ts
index 6283cf84d..65297d7a1 100644
--- a/client/src/app/shared/video/video.service.ts
+++ b/client/src/app/shared/video/video.service.ts
@@ -274,9 +274,9 @@ export class VideoService implements VideosProvider {
274 274
275 loadCompleteDescription (descriptionPath: string) { 275 loadCompleteDescription (descriptionPath: string) {
276 return this.authHttp 276 return this.authHttp
277 .get(environment.apiUrl + descriptionPath) 277 .get<{ description: string }>(environment.apiUrl + descriptionPath)
278 .pipe( 278 .pipe(
279 map((res: any) => res[ 'description' ]), 279 map(res => res.description),
280 catchError(err => this.restExtractor.handleError(err)) 280 catchError(err => this.restExtractor.handleError(err))
281 ) 281 )
282 } 282 }