aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-07-16 17:36:42 +0200
committerChocobozzz <me@florianbigard.com>2018-07-16 17:36:42 +0200
commitef4c78da4f0da61aebfa42f6e8420bf431a68bc8 (patch)
tree085411f6c1086bf57da6e3b4821e16dff2587705 /client/src
parent019e47507212072a7b91fb18dd31b4170d9cb40c (diff)
downloadPeerTube-ef4c78da4f0da61aebfa42f6e8420bf431a68bc8.tar.gz
PeerTube-ef4c78da4f0da61aebfa42f6e8420bf431a68bc8.tar.zst
PeerTube-ef4c78da4f0da61aebfa42f6e8420bf431a68bc8.zip
Improve video edit/update/add typings
Diffstat (limited to 'client/src')
-rw-r--r--client/src/app/core/server/server.service.ts8
-rw-r--r--client/src/app/videos/+video-edit/shared/video-edit.component.ts10
-rw-r--r--client/src/app/videos/+video-edit/video-add.component.ts7
-rw-r--r--client/src/app/videos/+video-edit/video-update.component.ts9
4 files changed, 18 insertions, 16 deletions
diff --git a/client/src/app/core/server/server.service.ts b/client/src/app/core/server/server.service.ts
index 3baefb6a7..87280e16f 100644
--- a/client/src/app/core/server/server.service.ts
+++ b/client/src/app/core/server/server.service.ts
@@ -69,10 +69,10 @@ export class ServerService {
69 videoQuota: -1 69 videoQuota: -1
70 } 70 }
71 } 71 }
72 private videoCategories: Array<VideoConstant<number>> = [] 72 private videoCategories: Array<VideoConstant<string>> = []
73 private videoLicences: Array<VideoConstant<number>> = [] 73 private videoLicences: Array<VideoConstant<string>> = []
74 private videoLanguages: Array<VideoConstant<string>> = [] 74 private videoLanguages: Array<VideoConstant<string>> = []
75 private videoPrivacies: Array<VideoConstant<VideoPrivacy>> = [] 75 private videoPrivacies: Array<VideoConstant<string>> = []
76 76
77 constructor ( 77 constructor (
78 private http: HttpClient, 78 private http: HttpClient,
@@ -134,7 +134,7 @@ export class ServerService {
134 134
135 private loadVideoAttributeEnum ( 135 private loadVideoAttributeEnum (
136 attributeName: 'categories' | 'licences' | 'languages' | 'privacies', 136 attributeName: 'categories' | 'licences' | 'languages' | 'privacies',
137 hashToPopulate: VideoConstant<number | string>[], 137 hashToPopulate: VideoConstant<string>[],
138 notifier: ReplaySubject<boolean>, 138 notifier: ReplaySubject<boolean>,
139 sort = false 139 sort = false
140 ) { 140 ) {
diff --git a/client/src/app/videos/+video-edit/shared/video-edit.component.ts b/client/src/app/videos/+video-edit/shared/video-edit.component.ts
index c7beccb30..743c015cb 100644
--- a/client/src/app/videos/+video-edit/shared/video-edit.component.ts
+++ b/client/src/app/videos/+video-edit/shared/video-edit.component.ts
@@ -12,18 +12,18 @@ import { VideoCaptionService } from '@app/shared/video-caption'
12import { VideoCaptionAddModalComponent } from '@app/videos/+video-edit/shared/video-caption-add-modal.component' 12import { VideoCaptionAddModalComponent } from '@app/videos/+video-edit/shared/video-caption-add-modal.component'
13import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model' 13import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model'
14import { removeElementFromArray } from '@app/shared/misc/utils' 14import { removeElementFromArray } from '@app/shared/misc/utils'
15import { VideoConstant } from '../../../../../../shared'
15 16
16@Component({ 17@Component({
17 selector: 'my-video-edit', 18 selector: 'my-video-edit',
18 styleUrls: [ './video-edit.component.scss' ], 19 styleUrls: [ './video-edit.component.scss' ],
19 templateUrl: './video-edit.component.html' 20 templateUrl: './video-edit.component.html'
20}) 21})
21
22export class VideoEditComponent implements OnInit, OnDestroy { 22export class VideoEditComponent implements OnInit, OnDestroy {
23 @Input() form: FormGroup 23 @Input() form: FormGroup
24 @Input() formErrors: { [ id: string ]: string } = {} 24 @Input() formErrors: { [ id: string ]: string } = {}
25 @Input() validationMessages: FormReactiveValidationMessages = {} 25 @Input() validationMessages: FormReactiveValidationMessages = {}
26 @Input() videoPrivacies = [] 26 @Input() videoPrivacies: { id: number, label: string }[] = []
27 @Input() userVideoChannels: { id: number, label: string, support: string }[] = [] 27 @Input() userVideoChannels: { id: number, label: string, support: string }[] = []
28 @Input() schedulePublicationPossible = true 28 @Input() schedulePublicationPossible = true
29 @Input() videoCaptions: VideoCaptionEdit[] = [] 29 @Input() videoCaptions: VideoCaptionEdit[] = []
@@ -33,9 +33,9 @@ export class VideoEditComponent implements OnInit, OnDestroy {
33 // So that it can be accessed in the template 33 // So that it can be accessed in the template
34 readonly SPECIAL_SCHEDULED_PRIVACY = VideoEdit.SPECIAL_SCHEDULED_PRIVACY 34 readonly SPECIAL_SCHEDULED_PRIVACY = VideoEdit.SPECIAL_SCHEDULED_PRIVACY
35 35
36 videoCategories = [] 36 videoCategories: VideoConstant<string>[] = []
37 videoLicences = [] 37 videoLicences: VideoConstant<string>[] = []
38 videoLanguages = [] 38 videoLanguages: VideoConstant<string>[] = []
39 39
40 tagValidators: ValidatorFn[] 40 tagValidators: ValidatorFn[]
41 tagValidatorsMessages: { [ name: string ]: string } 41 tagValidatorsMessages: { [ name: string ]: string }
diff --git a/client/src/app/videos/+video-edit/video-add.component.ts b/client/src/app/videos/+video-edit/video-add.component.ts
index 8c30cedfb..651ee8dd2 100644
--- a/client/src/app/videos/+video-edit/video-add.component.ts
+++ b/client/src/app/videos/+video-edit/video-add.component.ts
@@ -7,7 +7,7 @@ import { LoadingBarService } from '@ngx-loading-bar/core'
7import { NotificationsService } from 'angular2-notifications' 7import { NotificationsService } from 'angular2-notifications'
8import { BytesPipe } from 'ngx-pipes' 8import { BytesPipe } from 'ngx-pipes'
9import { Subscription } from 'rxjs' 9import { Subscription } from 'rxjs'
10import { VideoPrivacy } from '../../../../../shared/models/videos' 10import { VideoConstant, VideoPrivacy } from '../../../../../shared/models/videos'
11import { AuthService, ServerService } from '../../core' 11import { AuthService, ServerService } from '../../core'
12import { FormReactive } from '../../shared' 12import { FormReactive } from '../../shared'
13import { populateAsyncUserVideoChannels } from '../../shared/misc/utils' 13import { populateAsyncUserVideoChannels } from '../../shared/misc/utils'
@@ -17,6 +17,7 @@ import { I18n } from '@ngx-translate/i18n-polyfill'
17import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' 17import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service'
18import { switchMap } from 'rxjs/operators' 18import { switchMap } from 'rxjs/operators'
19import { VideoCaptionService } from '@app/shared/video-caption' 19import { VideoCaptionService } from '@app/shared/video-caption'
20import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model'
20 21
21@Component({ 22@Component({
22 selector: 'my-videos-add', 23 selector: 'my-videos-add',
@@ -45,10 +46,10 @@ export class VideoAddComponent extends FormReactive implements OnInit, OnDestroy
45 46
46 userVideoChannels: { id: number, label: string, support: string }[] = [] 47 userVideoChannels: { id: number, label: string, support: string }[] = []
47 userVideoQuotaUsed = 0 48 userVideoQuotaUsed = 0
48 videoPrivacies = [] 49 videoPrivacies: VideoConstant<string>[] = []
49 firstStepPrivacyId = 0 50 firstStepPrivacyId = 0
50 firstStepChannelId = 0 51 firstStepChannelId = 0
51 videoCaptions = [] 52 videoCaptions: VideoCaptionEdit[] = []
52 53
53 constructor ( 54 constructor (
54 protected formValidatorService: FormValidatorService, 55 protected formValidatorService: FormValidatorService,
diff --git a/client/src/app/videos/+video-edit/video-update.component.ts b/client/src/app/videos/+video-edit/video-update.component.ts
index 72fcc8659..4fe65bccd 100644
--- a/client/src/app/videos/+video-edit/video-update.component.ts
+++ b/client/src/app/videos/+video-edit/video-update.component.ts
@@ -3,7 +3,7 @@ import { Component, OnInit } from '@angular/core'
3import { ActivatedRoute, Router } from '@angular/router' 3import { ActivatedRoute, Router } from '@angular/router'
4import { LoadingBarService } from '@ngx-loading-bar/core' 4import { LoadingBarService } from '@ngx-loading-bar/core'
5import { NotificationsService } from 'angular2-notifications' 5import { NotificationsService } from 'angular2-notifications'
6import { VideoPrivacy } from '../../../../../shared/models/videos' 6import { VideoConstant, VideoPrivacy } from '../../../../../shared/models/videos'
7import { ServerService } from '../../core' 7import { ServerService } from '../../core'
8import { AuthService } from '../../core/auth' 8import { AuthService } from '../../core/auth'
9import { FormReactive } from '../../shared' 9import { FormReactive } from '../../shared'
@@ -13,6 +13,7 @@ import { VideoChannelService } from '@app/shared/video-channel/video-channel.ser
13import { I18n } from '@ngx-translate/i18n-polyfill' 13import { I18n } from '@ngx-translate/i18n-polyfill'
14import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' 14import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service'
15import { VideoCaptionService } from '@app/shared/video-caption' 15import { VideoCaptionService } from '@app/shared/video-caption'
16import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model'
16 17
17@Component({ 18@Component({
18 selector: 'my-videos-update', 19 selector: 'my-videos-update',
@@ -23,10 +24,10 @@ export class VideoUpdateComponent extends FormReactive implements OnInit {
23 video: VideoEdit 24 video: VideoEdit
24 25
25 isUpdatingVideo = false 26 isUpdatingVideo = false
26 videoPrivacies = [] 27 videoPrivacies: VideoConstant<string>[] = []
27 userVideoChannels = [] 28 userVideoChannels: { id: number, label: string, support: string }[] = []
28 schedulePublicationPossible = false 29 schedulePublicationPossible = false
29 videoCaptions = [] 30 videoCaptions: VideoCaptionEdit[] = []
30 31
31 constructor ( 32 constructor (
32 protected formValidatorService: FormValidatorService, 33 protected formValidatorService: FormValidatorService,