diff options
author | Chocobozzz <me@florianbigard.com> | 2018-07-16 17:36:42 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-07-16 17:36:42 +0200 |
commit | ef4c78da4f0da61aebfa42f6e8420bf431a68bc8 (patch) | |
tree | 085411f6c1086bf57da6e3b4821e16dff2587705 /client | |
parent | 019e47507212072a7b91fb18dd31b4170d9cb40c (diff) | |
download | PeerTube-ef4c78da4f0da61aebfa42f6e8420bf431a68bc8.tar.gz PeerTube-ef4c78da4f0da61aebfa42f6e8420bf431a68bc8.tar.zst PeerTube-ef4c78da4f0da61aebfa42f6e8420bf431a68bc8.zip |
Improve video edit/update/add typings
Diffstat (limited to 'client')
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' | |||
12 | import { VideoCaptionAddModalComponent } from '@app/videos/+video-edit/shared/video-caption-add-modal.component' | 12 | import { VideoCaptionAddModalComponent } from '@app/videos/+video-edit/shared/video-caption-add-modal.component' |
13 | import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model' | 13 | import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model' |
14 | import { removeElementFromArray } from '@app/shared/misc/utils' | 14 | import { removeElementFromArray } from '@app/shared/misc/utils' |
15 | import { 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 | |||
22 | export class VideoEditComponent implements OnInit, OnDestroy { | 22 | export 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' | |||
7 | import { NotificationsService } from 'angular2-notifications' | 7 | import { NotificationsService } from 'angular2-notifications' |
8 | import { BytesPipe } from 'ngx-pipes' | 8 | import { BytesPipe } from 'ngx-pipes' |
9 | import { Subscription } from 'rxjs' | 9 | import { Subscription } from 'rxjs' |
10 | import { VideoPrivacy } from '../../../../../shared/models/videos' | 10 | import { VideoConstant, VideoPrivacy } from '../../../../../shared/models/videos' |
11 | import { AuthService, ServerService } from '../../core' | 11 | import { AuthService, ServerService } from '../../core' |
12 | import { FormReactive } from '../../shared' | 12 | import { FormReactive } from '../../shared' |
13 | import { populateAsyncUserVideoChannels } from '../../shared/misc/utils' | 13 | import { populateAsyncUserVideoChannels } from '../../shared/misc/utils' |
@@ -17,6 +17,7 @@ import { I18n } from '@ngx-translate/i18n-polyfill' | |||
17 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' | 17 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' |
18 | import { switchMap } from 'rxjs/operators' | 18 | import { switchMap } from 'rxjs/operators' |
19 | import { VideoCaptionService } from '@app/shared/video-caption' | 19 | import { VideoCaptionService } from '@app/shared/video-caption' |
20 | import { 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' | |||
3 | import { ActivatedRoute, Router } from '@angular/router' | 3 | import { ActivatedRoute, Router } from '@angular/router' |
4 | import { LoadingBarService } from '@ngx-loading-bar/core' | 4 | import { LoadingBarService } from '@ngx-loading-bar/core' |
5 | import { NotificationsService } from 'angular2-notifications' | 5 | import { NotificationsService } from 'angular2-notifications' |
6 | import { VideoPrivacy } from '../../../../../shared/models/videos' | 6 | import { VideoConstant, VideoPrivacy } from '../../../../../shared/models/videos' |
7 | import { ServerService } from '../../core' | 7 | import { ServerService } from '../../core' |
8 | import { AuthService } from '../../core/auth' | 8 | import { AuthService } from '../../core/auth' |
9 | import { FormReactive } from '../../shared' | 9 | import { FormReactive } from '../../shared' |
@@ -13,6 +13,7 @@ import { VideoChannelService } from '@app/shared/video-channel/video-channel.ser | |||
13 | import { I18n } from '@ngx-translate/i18n-polyfill' | 13 | import { I18n } from '@ngx-translate/i18n-polyfill' |
14 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' | 14 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' |
15 | import { VideoCaptionService } from '@app/shared/video-caption' | 15 | import { VideoCaptionService } from '@app/shared/video-caption' |
16 | import { 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, |