diff options
Diffstat (limited to 'client')
5 files changed, 25 insertions, 17 deletions
diff --git a/client/src/app/+videos/+video-edit/shared/i18n-primeng-calendar.service.ts b/client/src/app/+videos/+video-edit/shared/i18n-primeng-calendar.service.ts index 6ef4dbc68..34848b036 100644 --- a/client/src/app/+videos/+video-edit/shared/i18n-primeng-calendar.service.ts +++ b/client/src/app/+videos/+video-edit/shared/i18n-primeng-calendar.service.ts | |||
@@ -3,7 +3,6 @@ import { PrimeNGConfig } from 'primeng/api' | |||
3 | 3 | ||
4 | @Injectable() | 4 | @Injectable() |
5 | export class I18nPrimengCalendarService { | 5 | export class I18nPrimengCalendarService { |
6 | private readonly calendarLocale: any = {} | ||
7 | 6 | ||
8 | constructor (private config: PrimeNGConfig) { | 7 | constructor (private config: PrimeNGConfig) { |
9 | this.config.setTranslation({ | 8 | this.config.setTranslation({ |
@@ -73,10 +72,6 @@ export class I18nPrimengCalendarService { | |||
73 | }) | 72 | }) |
74 | } | 73 | } |
75 | 74 | ||
76 | getCalendarLocale () { | ||
77 | return this.calendarLocale | ||
78 | } | ||
79 | |||
80 | getTimezone () { | 75 | getTimezone () { |
81 | const gmt = new Date().toString().match(/([A-Z]+[\+-][0-9]+)/)[1] | 76 | const gmt = new Date().toString().match(/([A-Z]+[\+-][0-9]+)/)[1] |
82 | const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone | 77 | const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone |
diff --git a/client/src/app/+videos/+video-edit/shared/video-edit.component.html b/client/src/app/+videos/+video-edit/shared/video-edit.component.html index 6208ab69b..6fe52af67 100644 --- a/client/src/app/+videos/+video-edit/shared/video-edit.component.html +++ b/client/src/app/+videos/+video-edit/shared/video-edit.component.html | |||
@@ -333,7 +333,7 @@ | |||
333 | <div class="row plugin-settings"> | 333 | <div class="row plugin-settings"> |
334 | 334 | ||
335 | <div class="col-md-12 col-xl-8"> | 335 | <div class="col-md-12 col-xl-8"> |
336 | <div *ngFor="let pluginSetting of pluginFields" class="form-group"> | 336 | <div *ngFor="let pluginSetting of pluginFields" class="form-group" [hidden]="isPluginFieldHidden(pluginSetting)"> |
337 | <my-dynamic-form-field [form]="pluginDataFormGroup" [formErrors]="formErrors" [setting]="pluginSetting.commonOptions"></my-dynamic-form-field> | 337 | <my-dynamic-form-field [form]="pluginDataFormGroup" [formErrors]="formErrors" [setting]="pluginSetting.commonOptions"></my-dynamic-form-field> |
338 | </div> | 338 | </div> |
339 | </div> | 339 | </div> |
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 f51f52160..34119f7ab 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 | |||
@@ -2,7 +2,7 @@ import { forkJoin } from 'rxjs' | |||
2 | import { map } from 'rxjs/operators' | 2 | import { map } from 'rxjs/operators' |
3 | import { SelectChannelItem } from 'src/types/select-options-item.model' | 3 | import { SelectChannelItem } from 'src/types/select-options-item.model' |
4 | import { Component, EventEmitter, Input, NgZone, OnDestroy, OnInit, Output, ViewChild } from '@angular/core' | 4 | import { Component, EventEmitter, Input, NgZone, OnDestroy, OnInit, Output, ViewChild } from '@angular/core' |
5 | import { FormArray, FormControl, FormGroup, ValidatorFn, Validators } from '@angular/forms' | 5 | import { FormArray, FormControl, FormGroup, Validators } from '@angular/forms' |
6 | import { HooksService, PluginService, ServerService } from '@app/core' | 6 | import { HooksService, PluginService, ServerService } from '@app/core' |
7 | import { removeElementFromArray } from '@app/helpers' | 7 | import { removeElementFromArray } from '@app/helpers' |
8 | import { | 8 | import { |
@@ -21,13 +21,17 @@ import { | |||
21 | import { FormReactiveValidationMessages, FormValidatorService } from '@app/shared/shared-forms' | 21 | import { FormReactiveValidationMessages, FormValidatorService } from '@app/shared/shared-forms' |
22 | import { InstanceService } from '@app/shared/shared-instance' | 22 | import { InstanceService } from '@app/shared/shared-instance' |
23 | import { VideoCaptionEdit, VideoEdit, VideoService } from '@app/shared/shared-main' | 23 | import { VideoCaptionEdit, VideoEdit, VideoService } from '@app/shared/shared-main' |
24 | import { LiveVideo, ServerConfig, VideoConstant, VideoPrivacy } from '@shared/models' | 24 | import { LiveVideo, ServerConfig, VideoConstant, VideoDetails, VideoPrivacy } from '@shared/models' |
25 | import { RegisterClientFormFieldOptions, RegisterClientVideoFieldOptions } from '@shared/models/plugins/register-client-form-field.model' | 25 | import { RegisterClientFormFieldOptions, RegisterClientVideoFieldOptions } from '@shared/models/plugins/register-client-form-field.model' |
26 | import { I18nPrimengCalendarService } from './i18n-primeng-calendar.service' | 26 | import { I18nPrimengCalendarService } from './i18n-primeng-calendar.service' |
27 | import { VideoCaptionAddModalComponent } from './video-caption-add-modal.component' | 27 | import { VideoCaptionAddModalComponent } from './video-caption-add-modal.component' |
28 | import { VideoEditType } from './video-edit.type' | 28 | import { VideoEditType } from './video-edit.type' |
29 | 29 | ||
30 | type VideoLanguages = VideoConstant<string> & { group?: string } | 30 | type VideoLanguages = VideoConstant<string> & { group?: string } |
31 | type PluginField = { | ||
32 | commonOptions: RegisterClientFormFieldOptions | ||
33 | videoFormOptions: RegisterClientVideoFieldOptions | ||
34 | } | ||
31 | 35 | ||
32 | @Component({ | 36 | @Component({ |
33 | selector: 'my-video-edit', | 37 | selector: 'my-video-edit', |
@@ -38,9 +42,14 @@ export class VideoEditComponent implements OnInit, OnDestroy { | |||
38 | @Input() form: FormGroup | 42 | @Input() form: FormGroup |
39 | @Input() formErrors: { [ id: string ]: string } = {} | 43 | @Input() formErrors: { [ id: string ]: string } = {} |
40 | @Input() validationMessages: FormReactiveValidationMessages = {} | 44 | @Input() validationMessages: FormReactiveValidationMessages = {} |
45 | |||
46 | @Input() videoToUpdate: VideoDetails | ||
47 | |||
41 | @Input() userVideoChannels: SelectChannelItem[] = [] | 48 | @Input() userVideoChannels: SelectChannelItem[] = [] |
42 | @Input() schedulePublicationPossible = true | 49 | @Input() schedulePublicationPossible = true |
50 | |||
43 | @Input() videoCaptions: (VideoCaptionEdit & { captionPath?: string })[] = [] | 51 | @Input() videoCaptions: (VideoCaptionEdit & { captionPath?: string })[] = [] |
52 | |||
44 | @Input() waitTranscodingEnabled = true | 53 | @Input() waitTranscodingEnabled = true |
45 | @Input() type: VideoEditType | 54 | @Input() type: VideoEditType |
46 | @Input() liveVideo: LiveVideo | 55 | @Input() liveVideo: LiveVideo |
@@ -57,9 +66,6 @@ export class VideoEditComponent implements OnInit, OnDestroy { | |||
57 | videoLicences: VideoConstant<number>[] = [] | 66 | videoLicences: VideoConstant<number>[] = [] |
58 | videoLanguages: VideoLanguages[] = [] | 67 | videoLanguages: VideoLanguages[] = [] |
59 | 68 | ||
60 | tagValidators: ValidatorFn[] | ||
61 | tagValidatorsMessages: { [ name: string ]: string } | ||
62 | |||
63 | pluginDataFormGroup: FormGroup | 69 | pluginDataFormGroup: FormGroup |
64 | 70 | ||
65 | schedulePublicationEnabled = false | 71 | schedulePublicationEnabled = false |
@@ -73,10 +79,7 @@ export class VideoEditComponent implements OnInit, OnDestroy { | |||
73 | 79 | ||
74 | serverConfig: ServerConfig | 80 | serverConfig: ServerConfig |
75 | 81 | ||
76 | pluginFields: { | 82 | pluginFields: PluginField[] = [] |
77 | commonOptions: RegisterClientFormFieldOptions | ||
78 | videoFormOptions: RegisterClientVideoFieldOptions | ||
79 | }[] = [] | ||
80 | 83 | ||
81 | private schedulerInterval: any | 84 | private schedulerInterval: any |
82 | private firstPatchDone = false | 85 | private firstPatchDone = false |
@@ -92,7 +95,6 @@ export class VideoEditComponent implements OnInit, OnDestroy { | |||
92 | private ngZone: NgZone, | 95 | private ngZone: NgZone, |
93 | private hooks: HooksService | 96 | private hooks: HooksService |
94 | ) { | 97 | ) { |
95 | this.calendarLocale = this.i18nPrimengCalendarService.getCalendarLocale() | ||
96 | this.calendarTimezone = this.i18nPrimengCalendarService.getTimezone() | 98 | this.calendarTimezone = this.i18nPrimengCalendarService.getTimezone() |
97 | this.calendarDateFormat = this.i18nPrimengCalendarService.getDateFormat() | 99 | this.calendarDateFormat = this.i18nPrimengCalendarService.getDateFormat() |
98 | } | 100 | } |
@@ -251,6 +253,16 @@ export class VideoEditComponent implements OnInit, OnDestroy { | |||
251 | return this.form.value['permanentLive'] === true | 253 | return this.form.value['permanentLive'] === true |
252 | } | 254 | } |
253 | 255 | ||
256 | isPluginFieldHidden (pluginField: PluginField) { | ||
257 | if (typeof pluginField.commonOptions.hidden !== 'function') return false | ||
258 | |||
259 | return pluginField.commonOptions.hidden({ | ||
260 | formValues: this.form.value, | ||
261 | videoToUpdate: this.videoToUpdate, | ||
262 | liveVideo: this.liveVideo | ||
263 | }) | ||
264 | } | ||
265 | |||
254 | private sortVideoCaptions () { | 266 | private sortVideoCaptions () { |
255 | this.videoCaptions.sort((v1, v2) => { | 267 | this.videoCaptions.sort((v1, v2) => { |
256 | if (v1.language.label < v2.language.label) return -1 | 268 | if (v1.language.label < v2.language.label) return -1 |
diff --git a/client/src/app/+videos/+video-edit/video-update.component.html b/client/src/app/+videos/+video-edit/video-update.component.html index 41501714f..3ce3e623e 100644 --- a/client/src/app/+videos/+video-edit/video-update.component.html +++ b/client/src/app/+videos/+video-edit/video-update.component.html | |||
@@ -11,7 +11,7 @@ | |||
11 | [validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels" | 11 | [validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels" |
12 | [videoCaptions]="videoCaptions" [waitTranscodingEnabled]="isWaitTranscodingEnabled()" | 12 | [videoCaptions]="videoCaptions" [waitTranscodingEnabled]="isWaitTranscodingEnabled()" |
13 | type="update" (pluginFieldsAdded)="hydratePluginFieldsFromVideo()" | 13 | type="update" (pluginFieldsAdded)="hydratePluginFieldsFromVideo()" |
14 | [liveVideo]="liveVideo" | 14 | [liveVideo]="liveVideo" [videoToUpdate]="videoDetails" |
15 | ></my-video-edit> | 15 | ></my-video-edit> |
16 | 16 | ||
17 | <div class="submit-container"> | 17 | <div class="submit-container"> |
diff --git a/client/src/standalone/videos/embed.ts b/client/src/standalone/videos/embed.ts index 103014bb0..3a90fdc58 100644 --- a/client/src/standalone/videos/embed.ts +++ b/client/src/standalone/videos/embed.ts | |||
@@ -777,6 +777,7 @@ export class PeerTubeEmbed { | |||
777 | getSettings: unimplemented, | 777 | getSettings: unimplemented, |
778 | 778 | ||
779 | isLoggedIn: unimplemented, | 779 | isLoggedIn: unimplemented, |
780 | getAuthHeader: unimplemented, | ||
780 | 781 | ||
781 | notifier: { | 782 | notifier: { |
782 | info: unimplemented, | 783 | info: unimplemented, |