aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+videos
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-30 11:38:19 +0200
committerChocobozzz <me@florianbigard.com>2021-07-30 11:38:19 +0200
commit171efc48e67498406feb6d7873b3482b41505515 (patch)
treec39c4a4fbdb5074d74471bfe02fb519210c1e21d /client/src/app/+videos
parent9e8789497377cac5554a622da605f5b89587aa9c (diff)
parent3ce48a0cd062d9ff64d9411d702453503a49f3b1 (diff)
downloadPeerTube-171efc48e67498406feb6d7873b3482b41505515.tar.gz
PeerTube-171efc48e67498406feb6d7873b3482b41505515.tar.zst
PeerTube-171efc48e67498406feb6d7873b3482b41505515.zip
Merge branch 'release/3.3.0' into develop
Diffstat (limited to 'client/src/app/+videos')
-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 e9420fe62..189bc9669 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
@@ -44,6 +44,8 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy
44 error: string 44 error: string
45 enableRetryAfterError: boolean 45 enableRetryAfterError: boolean
46 46
47 schedulePublicationPossible = false
48
47 // So that it can be accessed in the template 49 // So that it can be accessed in the template
48 protected readonly BASE_VIDEO_UPLOAD_URL = VideoService.BASE_VIDEO_URL + 'upload-resumable' 50 protected readonly BASE_VIDEO_UPLOAD_URL = VideoService.BASE_VIDEO_URL + 'upload-resumable'
49 51
@@ -84,6 +86,46 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy
84 return this.serverConfig.video.file.extensions.join(', ') 86 return this.serverConfig.video.file.extensions.join(', ')
85 } 87 }
86 88
89 ngOnInit () {
90 super.ngOnInit()
91
92 this.userService.getMyVideoQuotaUsed()
93 .subscribe(data => {
94 this.userVideoQuotaUsed = data.videoQuotaUsed
95 this.userVideoQuotaUsedDaily = data.videoQuotaUsedDaily
96 })
97
98 this.resumableUploadService.events
99 .subscribe(state => this.onUploadVideoOngoing(state))
100
101 this.schedulePublicationPossible = this.videoPrivacies.some(p => p.id === VideoPrivacy.PRIVATE)
102 }
103
104 ngAfterViewInit () {
105 this.hooks.runAction('action:video-upload.init', 'video-edit')
106 }
107
108 ngOnDestroy () {
109 this.cancelUpload()
110 }
111
112 canDeactivate () {
113 let text = ''
114
115 if (this.videoUploaded === true) {
116 // FIXME: cannot concatenate strings using $localize
117 text = $localize`Your video was uploaded to your account and is private.` + ' ' +
118 $localize`But associated data (tags, description...) will be lost, are you sure you want to leave this page?`
119 } else {
120 text = $localize`Your video is not uploaded yet, are you sure you want to leave this page?`
121 }
122
123 return {
124 canDeactivate: !this.isUploadingVideo,
125 text
126 }
127 }
128
87 onUploadVideoOngoing (state: UploadState) { 129 onUploadVideoOngoing (state: UploadState) {
88 switch (state.status) { 130 switch (state.status) {
89 case 'error': 131 case 'error':
@@ -132,44 +174,6 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy
132 } 174 }
133 } 175 }
134 176
135 ngOnInit () {
136 super.ngOnInit()
137
138 this.userService.getMyVideoQuotaUsed()
139 .subscribe(data => {
140 this.userVideoQuotaUsed = data.videoQuotaUsed
141 this.userVideoQuotaUsedDaily = data.videoQuotaUsedDaily
142 })
143
144 this.resumableUploadService.events
145 .subscribe(state => this.onUploadVideoOngoing(state))
146 }
147
148 ngAfterViewInit () {
149 this.hooks.runAction('action:video-upload.init', 'video-edit')
150 }
151
152 ngOnDestroy () {
153 this.cancelUpload()
154 }
155
156 canDeactivate () {
157 let text = ''
158
159 if (this.videoUploaded === true) {
160 // FIXME: cannot concatenate strings using $localize
161 text = $localize`Your video was uploaded to your account and is private.` + ' ' +
162 $localize`But associated data (tags, description...) will be lost, are you sure you want to leave this page?`
163 } else {
164 text = $localize`Your video is not uploaded yet, are you sure you want to leave this page?`
165 }
166
167 return {
168 canDeactivate: !this.isUploadingVideo,
169 text
170 }
171 }
172
173 onFileDropped (files: FileList) { 177 onFileDropped (files: FileList) {
174 this.videofileInput.nativeElement.files = files 178 this.videofileInput.nativeElement.files = files
175 179