Improve video edit/update/add typings

pull/777/merge
Chocobozzz 2018-07-16 17:36:42 +02:00
parent 019e475072
commit ef4c78da4f
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
4 changed files with 18 additions and 16 deletions

View File

@ -69,10 +69,10 @@ export class ServerService {
videoQuota: -1 videoQuota: -1
} }
} }
private videoCategories: Array<VideoConstant<number>> = [] private videoCategories: Array<VideoConstant<string>> = []
private videoLicences: Array<VideoConstant<number>> = [] private videoLicences: Array<VideoConstant<string>> = []
private videoLanguages: Array<VideoConstant<string>> = [] private videoLanguages: Array<VideoConstant<string>> = []
private videoPrivacies: Array<VideoConstant<VideoPrivacy>> = [] private videoPrivacies: Array<VideoConstant<string>> = []
constructor ( constructor (
private http: HttpClient, private http: HttpClient,
@ -134,7 +134,7 @@ export class ServerService {
private loadVideoAttributeEnum ( private loadVideoAttributeEnum (
attributeName: 'categories' | 'licences' | 'languages' | 'privacies', attributeName: 'categories' | 'licences' | 'languages' | 'privacies',
hashToPopulate: VideoConstant<number | string>[], hashToPopulate: VideoConstant<string>[],
notifier: ReplaySubject<boolean>, notifier: ReplaySubject<boolean>,
sort = false sort = false
) { ) {

View File

@ -12,18 +12,18 @@ import { VideoCaptionService } from '@app/shared/video-caption'
import { VideoCaptionAddModalComponent } from '@app/videos/+video-edit/shared/video-caption-add-modal.component' import { VideoCaptionAddModalComponent } from '@app/videos/+video-edit/shared/video-caption-add-modal.component'
import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model' import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model'
import { removeElementFromArray } from '@app/shared/misc/utils' import { removeElementFromArray } from '@app/shared/misc/utils'
import { VideoConstant } from '../../../../../../shared'
@Component({ @Component({
selector: 'my-video-edit', selector: 'my-video-edit',
styleUrls: [ './video-edit.component.scss' ], styleUrls: [ './video-edit.component.scss' ],
templateUrl: './video-edit.component.html' templateUrl: './video-edit.component.html'
}) })
export class VideoEditComponent implements OnInit, OnDestroy { export class VideoEditComponent implements OnInit, OnDestroy {
@Input() form: FormGroup @Input() form: FormGroup
@Input() formErrors: { [ id: string ]: string } = {} @Input() formErrors: { [ id: string ]: string } = {}
@Input() validationMessages: FormReactiveValidationMessages = {} @Input() validationMessages: FormReactiveValidationMessages = {}
@Input() videoPrivacies = [] @Input() videoPrivacies: { id: number, label: string }[] = []
@Input() userVideoChannels: { id: number, label: string, support: string }[] = [] @Input() userVideoChannels: { id: number, label: string, support: string }[] = []
@Input() schedulePublicationPossible = true @Input() schedulePublicationPossible = true
@Input() videoCaptions: VideoCaptionEdit[] = [] @Input() videoCaptions: VideoCaptionEdit[] = []
@ -33,9 +33,9 @@ export class VideoEditComponent implements OnInit, OnDestroy {
// So that it can be accessed in the template // So that it can be accessed in the template
readonly SPECIAL_SCHEDULED_PRIVACY = VideoEdit.SPECIAL_SCHEDULED_PRIVACY readonly SPECIAL_SCHEDULED_PRIVACY = VideoEdit.SPECIAL_SCHEDULED_PRIVACY
videoCategories = [] videoCategories: VideoConstant<string>[] = []
videoLicences = [] videoLicences: VideoConstant<string>[] = []
videoLanguages = [] videoLanguages: VideoConstant<string>[] = []
tagValidators: ValidatorFn[] tagValidators: ValidatorFn[]
tagValidatorsMessages: { [ name: string ]: string } tagValidatorsMessages: { [ name: string ]: string }

View File

@ -7,7 +7,7 @@ import { LoadingBarService } from '@ngx-loading-bar/core'
import { NotificationsService } from 'angular2-notifications' import { NotificationsService } from 'angular2-notifications'
import { BytesPipe } from 'ngx-pipes' import { BytesPipe } from 'ngx-pipes'
import { Subscription } from 'rxjs' import { Subscription } from 'rxjs'
import { VideoPrivacy } from '../../../../../shared/models/videos' import { VideoConstant, VideoPrivacy } from '../../../../../shared/models/videos'
import { AuthService, ServerService } from '../../core' import { AuthService, ServerService } from '../../core'
import { FormReactive } from '../../shared' import { FormReactive } from '../../shared'
import { populateAsyncUserVideoChannels } from '../../shared/misc/utils' import { populateAsyncUserVideoChannels } from '../../shared/misc/utils'
@ -17,6 +17,7 @@ import { I18n } from '@ngx-translate/i18n-polyfill'
import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service'
import { switchMap } from 'rxjs/operators' import { switchMap } from 'rxjs/operators'
import { VideoCaptionService } from '@app/shared/video-caption' import { VideoCaptionService } from '@app/shared/video-caption'
import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model'
@Component({ @Component({
selector: 'my-videos-add', selector: 'my-videos-add',
@ -45,10 +46,10 @@ export class VideoAddComponent extends FormReactive implements OnInit, OnDestroy
userVideoChannels: { id: number, label: string, support: string }[] = [] userVideoChannels: { id: number, label: string, support: string }[] = []
userVideoQuotaUsed = 0 userVideoQuotaUsed = 0
videoPrivacies = [] videoPrivacies: VideoConstant<string>[] = []
firstStepPrivacyId = 0 firstStepPrivacyId = 0
firstStepChannelId = 0 firstStepChannelId = 0
videoCaptions = [] videoCaptions: VideoCaptionEdit[] = []
constructor ( constructor (
protected formValidatorService: FormValidatorService, protected formValidatorService: FormValidatorService,

View File

@ -3,7 +3,7 @@ import { Component, OnInit } from '@angular/core'
import { ActivatedRoute, Router } from '@angular/router' import { ActivatedRoute, Router } from '@angular/router'
import { LoadingBarService } from '@ngx-loading-bar/core' import { LoadingBarService } from '@ngx-loading-bar/core'
import { NotificationsService } from 'angular2-notifications' import { NotificationsService } from 'angular2-notifications'
import { VideoPrivacy } from '../../../../../shared/models/videos' import { VideoConstant, VideoPrivacy } from '../../../../../shared/models/videos'
import { ServerService } from '../../core' import { ServerService } from '../../core'
import { AuthService } from '../../core/auth' import { AuthService } from '../../core/auth'
import { FormReactive } from '../../shared' import { FormReactive } from '../../shared'
@ -13,6 +13,7 @@ import { VideoChannelService } from '@app/shared/video-channel/video-channel.ser
import { I18n } from '@ngx-translate/i18n-polyfill' import { I18n } from '@ngx-translate/i18n-polyfill'
import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service'
import { VideoCaptionService } from '@app/shared/video-caption' import { VideoCaptionService } from '@app/shared/video-caption'
import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model'
@Component({ @Component({
selector: 'my-videos-update', selector: 'my-videos-update',
@ -23,10 +24,10 @@ export class VideoUpdateComponent extends FormReactive implements OnInit {
video: VideoEdit video: VideoEdit
isUpdatingVideo = false isUpdatingVideo = false
videoPrivacies = [] videoPrivacies: VideoConstant<string>[] = []
userVideoChannels = [] userVideoChannels: { id: number, label: string, support: string }[] = []
schedulePublicationPossible = false schedulePublicationPossible = false
videoCaptions = [] videoCaptions: VideoCaptionEdit[] = []
constructor ( constructor (
protected formValidatorService: FormValidatorService, protected formValidatorService: FormValidatorService,