aboutsummaryrefslogtreecommitdiffhomepage
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/src/app/+videos/+video-edit/video-add-components/video-upload.component.html2
-rw-r--r--client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts80
2 files changed, 43 insertions, 39 deletions
diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.html b/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.html
index 86a779f8a..14cd06fcf 100644
--- a/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.html
+++ b/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.html
@@ -96,7 +96,7 @@
96 <my-video-edit 96 <my-video-edit
97 [form]="form" [formErrors]="formErrors" [videoCaptions]="videoCaptions" 97 [form]="form" [formErrors]="formErrors" [videoCaptions]="videoCaptions"
98 [validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels" 98 [validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels"
99 [waitTranscodingEnabled]="true" 99 [waitTranscodingEnabled]="true" [schedulePublicationPossible]="schedulePublicationPossible"
100 type="upload" 100 type="upload"
101 ></my-video-edit> 101 ></my-video-edit>
102 102
diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts b/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts
index 627de33c0..d8d20a249 100644
--- a/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts
+++ b/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts
@@ -45,6 +45,8 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy
45 error: string 45 error: string
46 enableRetryAfterError: boolean 46 enableRetryAfterError: boolean
47 47
48 schedulePublicationPossible = false
49
48 // So that it can be accessed in the template 50 // So that it can be accessed in the template
49 protected readonly BASE_VIDEO_UPLOAD_URL = VideoService.BASE_VIDEO_URL + 'upload-resumable' 51 protected readonly BASE_VIDEO_UPLOAD_URL = VideoService.BASE_VIDEO_URL + 'upload-resumable'
50 52
@@ -85,6 +87,46 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy
85 return this.serverConfig.video.file.extensions.join(', ') 87 return this.serverConfig.video.file.extensions.join(', ')
86 } 88 }
87 89
90 ngOnInit () {
91 super.ngOnInit()
92
93 this.userService.getMyVideoQuotaUsed()
94 .subscribe(data => {
95 this.userVideoQuotaUsed = data.videoQuotaUsed
96 this.userVideoQuotaUsedDaily = data.videoQuotaUsedDaily
97 })
98
99 this.resumableUploadService.events
100 .subscribe(state => this.onUploadVideoOngoing(state))
101
102 this.schedulePublicationPossible = this.videoPrivacies.some(p => p.id === VideoPrivacy.PRIVATE)
103 }
104
105 ngAfterViewInit () {
106 this.hooks.runAction('action:video-upload.init', 'video-edit')
107 }
108
109 ngOnDestroy () {
110 this.cancelUpload()
111 }
112
113 canDeactivate () {
114 let text = ''
115
116 if (this.videoUploaded === true) {
117 // FIXME: cannot concatenate strings using $localize
118 text = $localize`Your video was uploaded to your account and is private.` + ' ' +
119 $localize`But associated data (tags, description...) will be lost, are you sure you want to leave this page?`
120 } else {
121 text = $localize`Your video is not uploaded yet, are you sure you want to leave this page?`
122 }
123
124 return {
125 canDeactivate: !this.isUploadingVideo,
126 text
127 }
128 }
129
88 onUploadVideoOngoing (state: UploadState) { 130 onUploadVideoOngoing (state: UploadState) {
89 switch (state.status) { 131 switch (state.status) {
90 case 'error': 132 case 'error':
@@ -133,44 +175,6 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy
133 } 175 }
134 } 176 }
135 177
136 ngOnInit () {
137 super.ngOnInit()
138
139 this.userService.getMyVideoQuotaUsed()
140 .subscribe(data => {
141 this.userVideoQuotaUsed = data.videoQuotaUsed
142 this.userVideoQuotaUsedDaily = data.videoQuotaUsedDaily
143 })
144
145 this.resumableUploadService.events
146 .subscribe(state => this.onUploadVideoOngoing(state))
147 }
148
149 ngAfterViewInit () {
150 this.hooks.runAction('action:video-upload.init', 'video-edit')
151 }
152
153 ngOnDestroy () {
154 this.cancelUpload()
155 }
156
157 canDeactivate () {
158 let text = ''
159
160 if (this.videoUploaded === true) {
161 // FIXME: cannot concatenate strings using $localize
162 text = $localize`Your video was uploaded to your account and is private.` + ' ' +
163 $localize`But associated data (tags, description...) will be lost, are you sure you want to leave this page?`
164 } else {
165 text = $localize`Your video is not uploaded yet, are you sure you want to leave this page?`
166 }
167
168 return {
169 canDeactivate: !this.isUploadingVideo,
170 text
171 }
172 }
173
174 onFileDropped (files: FileList) { 178 onFileDropped (files: FileList) {
175 this.videofileInput.nativeElement.files = files 179 this.videofileInput.nativeElement.files = files
176 180