From ef4c78da4f0da61aebfa42f6e8420bf431a68bc8 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 16 Jul 2018 17:36:42 +0200 Subject: Improve video edit/update/add typings --- .../src/app/videos/+video-edit/shared/video-edit.component.ts | 10 +++++----- client/src/app/videos/+video-edit/video-add.component.ts | 7 ++++--- client/src/app/videos/+video-edit/video-update.component.ts | 9 +++++---- 3 files changed, 14 insertions(+), 12 deletions(-) (limited to 'client/src/app/videos/+video-edit') 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' 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 { removeElementFromArray } from '@app/shared/misc/utils' +import { VideoConstant } from '../../../../../../shared' @Component({ selector: 'my-video-edit', styleUrls: [ './video-edit.component.scss' ], templateUrl: './video-edit.component.html' }) - export class VideoEditComponent implements OnInit, OnDestroy { @Input() form: FormGroup @Input() formErrors: { [ id: string ]: string } = {} @Input() validationMessages: FormReactiveValidationMessages = {} - @Input() videoPrivacies = [] + @Input() videoPrivacies: { id: number, label: string }[] = [] @Input() userVideoChannels: { id: number, label: string, support: string }[] = [] @Input() schedulePublicationPossible = true @Input() videoCaptions: VideoCaptionEdit[] = [] @@ -33,9 +33,9 @@ export class VideoEditComponent implements OnInit, OnDestroy { // So that it can be accessed in the template readonly SPECIAL_SCHEDULED_PRIVACY = VideoEdit.SPECIAL_SCHEDULED_PRIVACY - videoCategories = [] - videoLicences = [] - videoLanguages = [] + videoCategories: VideoConstant[] = [] + videoLicences: VideoConstant[] = [] + videoLanguages: VideoConstant[] = [] tagValidators: ValidatorFn[] 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' import { NotificationsService } from 'angular2-notifications' import { BytesPipe } from 'ngx-pipes' import { Subscription } from 'rxjs' -import { VideoPrivacy } from '../../../../../shared/models/videos' +import { VideoConstant, VideoPrivacy } from '../../../../../shared/models/videos' import { AuthService, ServerService } from '../../core' import { FormReactive } from '../../shared' 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 { switchMap } from 'rxjs/operators' import { VideoCaptionService } from '@app/shared/video-caption' +import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model' @Component({ selector: 'my-videos-add', @@ -45,10 +46,10 @@ export class VideoAddComponent extends FormReactive implements OnInit, OnDestroy userVideoChannels: { id: number, label: string, support: string }[] = [] userVideoQuotaUsed = 0 - videoPrivacies = [] + videoPrivacies: VideoConstant[] = [] firstStepPrivacyId = 0 firstStepChannelId = 0 - videoCaptions = [] + videoCaptions: VideoCaptionEdit[] = [] constructor ( 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' import { ActivatedRoute, Router } from '@angular/router' import { LoadingBarService } from '@ngx-loading-bar/core' import { NotificationsService } from 'angular2-notifications' -import { VideoPrivacy } from '../../../../../shared/models/videos' +import { VideoConstant, VideoPrivacy } from '../../../../../shared/models/videos' import { ServerService } from '../../core' import { AuthService } from '../../core/auth' 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 { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' import { VideoCaptionService } from '@app/shared/video-caption' +import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model' @Component({ selector: 'my-videos-update', @@ -23,10 +24,10 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { video: VideoEdit isUpdatingVideo = false - videoPrivacies = [] - userVideoChannels = [] + videoPrivacies: VideoConstant[] = [] + userVideoChannels: { id: number, label: string, support: string }[] = [] schedulePublicationPossible = false - videoCaptions = [] + videoCaptions: VideoCaptionEdit[] = [] constructor ( protected formValidatorService: FormValidatorService, -- cgit v1.2.3