diff options
4 files changed, 28 insertions, 13 deletions
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 ec858c8a8..0a83215b9 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 | |||
@@ -3,8 +3,8 @@ import { UploadState, UploadxOptions, UploadxService } from 'ngx-uploadx' | |||
3 | import { isIOS } from '@root-helpers/web-browser' | 3 | import { isIOS } from '@root-helpers/web-browser' |
4 | import { HttpErrorResponse, HttpEventType, HttpHeaders } from '@angular/common/http' | 4 | import { HttpErrorResponse, HttpEventType, HttpHeaders } from '@angular/common/http' |
5 | import { AfterViewInit, Component, ElementRef, EventEmitter, OnDestroy, OnInit, Output, ViewChild } from '@angular/core' | 5 | import { AfterViewInit, Component, ElementRef, EventEmitter, OnDestroy, OnInit, Output, ViewChild } from '@angular/core' |
6 | import { Router } from '@angular/router' | 6 | import { ActivatedRoute, Router } from '@angular/router' |
7 | import { AuthService, CanComponentDeactivate, HooksService, Notifier, ServerService, UserService } from '@app/core' | 7 | import { AuthService, CanComponentDeactivate, HooksService, MetaService, Notifier, ServerService, UserService } from '@app/core' |
8 | import { genericUploadErrorHandler, scrollToTop } from '@app/helpers' | 8 | import { genericUploadErrorHandler, scrollToTop } from '@app/helpers' |
9 | import { FormValidatorService } from '@app/shared/shared-forms' | 9 | import { FormValidatorService } from '@app/shared/shared-forms' |
10 | import { BytesPipe, Video, VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main' | 10 | import { BytesPipe, Video, VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main' |
@@ -66,7 +66,9 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy | |||
66 | private userService: UserService, | 66 | private userService: UserService, |
67 | private router: Router, | 67 | private router: Router, |
68 | private hooks: HooksService, | 68 | private hooks: HooksService, |
69 | private resumableUploadService: UploadxService | 69 | private resumableUploadService: UploadxService, |
70 | private metaService: MetaService, | ||
71 | private route: ActivatedRoute | ||
70 | ) { | 72 | ) { |
71 | super() | 73 | super() |
72 | } | 74 | } |
@@ -113,6 +115,18 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy | |||
113 | } | 115 | } |
114 | } | 116 | } |
115 | 117 | ||
118 | updateTitle () { | ||
119 | const videoName = this.form.get('name').value | ||
120 | |||
121 | if (this.videoUploaded) { | ||
122 | this.metaService.setTitle($localize`Upload ${videoName}`) | ||
123 | } else if (this.isUploadingAudioFile || this.isUploadingVideo) { | ||
124 | this.metaService.setTitle(`${this.videoUploadPercents}% - ${videoName}`) | ||
125 | } else { | ||
126 | this.metaService.update(this.route.snapshot.data['meta']) | ||
127 | } | ||
128 | } | ||
129 | |||
116 | onUploadVideoOngoing (state: UploadState) { | 130 | onUploadVideoOngoing (state: UploadState) { |
117 | switch (state.status) { | 131 | switch (state.status) { |
118 | case 'error': { | 132 | case 'error': { |
@@ -153,7 +167,8 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy | |||
153 | break | 167 | break |
154 | 168 | ||
155 | case 'uploading': | 169 | case 'uploading': |
156 | this.videoUploadPercents = state.progress | 170 | // TODO: remove || 0 when // https://github.com/kukhariev/ngx-uploadx/pull/368 is released |
171 | this.videoUploadPercents = state.progress || 0 | ||
157 | break | 172 | break |
158 | 173 | ||
159 | case 'paused': | 174 | case 'paused': |
@@ -167,6 +182,8 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy | |||
167 | this.videoUploadedIds = state?.response.video | 182 | this.videoUploadedIds = state?.response.video |
168 | break | 183 | break |
169 | } | 184 | } |
185 | |||
186 | this.updateTitle() | ||
170 | } | 187 | } |
171 | 188 | ||
172 | onFileDropped (files: FileList) { | 189 | onFileDropped (files: FileList) { |
@@ -305,6 +322,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy | |||
305 | }) | 322 | }) |
306 | 323 | ||
307 | this.firstStepDone.emit(name) | 324 | this.firstStepDone.emit(name) |
325 | this.updateTitle() | ||
308 | } | 326 | } |
309 | 327 | ||
310 | private checkGlobalUserQuota (videofile: File) { | 328 | private checkGlobalUserQuota (videofile: File) { |
diff --git a/client/src/app/+videos/+video-edit/video-add.module.ts b/client/src/app/+videos/+video-edit/video-add.module.ts index e836cf81e..f5bfc925a 100644 --- a/client/src/app/+videos/+video-edit/video-add.module.ts +++ b/client/src/app/+videos/+video-edit/video-add.module.ts | |||
@@ -1,11 +1,10 @@ | |||
1 | import { NgModule } from '@angular/core' | ||
2 | import { CanDeactivateGuard } from '@app/core' | ||
3 | import { UploadxModule } from 'ngx-uploadx' | 1 | import { UploadxModule } from 'ngx-uploadx' |
2 | import { NgModule } from '@angular/core' | ||
4 | import { VideoEditModule } from './shared/video-edit.module' | 3 | import { VideoEditModule } from './shared/video-edit.module' |
5 | import { DragDropDirective } from './video-add-components/drag-drop.directive' | 4 | import { DragDropDirective } from './video-add-components/drag-drop.directive' |
5 | import { VideoGoLiveComponent } from './video-add-components/video-go-live.component' | ||
6 | import { VideoImportTorrentComponent } from './video-add-components/video-import-torrent.component' | 6 | import { VideoImportTorrentComponent } from './video-add-components/video-import-torrent.component' |
7 | import { VideoImportUrlComponent } from './video-add-components/video-import-url.component' | 7 | import { VideoImportUrlComponent } from './video-add-components/video-import-url.component' |
8 | import { VideoGoLiveComponent } from './video-add-components/video-go-live.component' | ||
9 | import { VideoUploadComponent } from './video-add-components/video-upload.component' | 8 | import { VideoUploadComponent } from './video-add-components/video-upload.component' |
10 | import { VideoAddRoutingModule } from './video-add-routing.module' | 9 | import { VideoAddRoutingModule } from './video-add-routing.module' |
11 | import { VideoAddComponent } from './video-add.component' | 10 | import { VideoAddComponent } from './video-add.component' |
@@ -30,8 +29,6 @@ import { VideoAddComponent } from './video-add.component' | |||
30 | 29 | ||
31 | exports: [ ], | 30 | exports: [ ], |
32 | 31 | ||
33 | providers: [ | 32 | providers: [] |
34 | CanDeactivateGuard | ||
35 | ] | ||
36 | }) | 33 | }) |
37 | export class VideoAddModule { } | 34 | export class VideoAddModule { } |
diff --git a/client/src/app/+videos/+video-edit/video-update.module.ts b/client/src/app/+videos/+video-edit/video-update.module.ts index 99cd8bea1..92d32ffc8 100644 --- a/client/src/app/+videos/+video-edit/video-update.module.ts +++ b/client/src/app/+videos/+video-edit/video-update.module.ts | |||
@@ -1,5 +1,4 @@ | |||
1 | import { NgModule } from '@angular/core' | 1 | import { NgModule } from '@angular/core' |
2 | import { CanDeactivateGuard } from '@app/core' | ||
3 | import { VideoEditModule } from './shared/video-edit.module' | 2 | import { VideoEditModule } from './shared/video-edit.module' |
4 | import { VideoUpdateRoutingModule } from './video-update-routing.module' | 3 | import { VideoUpdateRoutingModule } from './video-update-routing.module' |
5 | import { VideoUpdateComponent } from './video-update.component' | 4 | import { VideoUpdateComponent } from './video-update.component' |
@@ -19,8 +18,7 @@ import { VideoUpdateResolver } from './video-update.resolver' | |||
19 | exports: [ ], | 18 | exports: [ ], |
20 | 19 | ||
21 | providers: [ | 20 | providers: [ |
22 | VideoUpdateResolver, | 21 | VideoUpdateResolver |
23 | CanDeactivateGuard | ||
24 | ] | 22 | ] |
25 | }) | 23 | }) |
26 | export class VideoUpdateModule { } | 24 | export class VideoUpdateModule { } |
diff --git a/client/src/app/app-routing.module.ts b/client/src/app/app-routing.module.ts index a831da099..db48b2eea 100644 --- a/client/src/app/app-routing.module.ts +++ b/client/src/app/app-routing.module.ts | |||
@@ -96,6 +96,7 @@ const routes: Routes = [ | |||
96 | { | 96 | { |
97 | path: 'videos/upload', | 97 | path: 'videos/upload', |
98 | loadChildren: () => import('@app/+videos/+video-edit/video-add.module').then(m => m.VideoAddModule), | 98 | loadChildren: () => import('@app/+videos/+video-edit/video-add.module').then(m => m.VideoAddModule), |
99 | canActivateChild: [ MetaGuard ], | ||
99 | data: { | 100 | data: { |
100 | meta: { | 101 | meta: { |
101 | title: $localize`Upload a video` | 102 | title: $localize`Upload a video` |
@@ -105,6 +106,7 @@ const routes: Routes = [ | |||
105 | { | 106 | { |
106 | path: 'videos/update/:uuid', | 107 | path: 'videos/update/:uuid', |
107 | loadChildren: () => import('@app/+videos/+video-edit/video-update.module').then(m => m.VideoUpdateModule), | 108 | loadChildren: () => import('@app/+videos/+video-edit/video-update.module').then(m => m.VideoUpdateModule), |
109 | canActivateChild: [ MetaGuard ], | ||
108 | data: { | 110 | data: { |
109 | meta: { | 111 | meta: { |
110 | title: $localize`Edit a video` | 112 | title: $localize`Edit a video` |