mirror of https://github.com/Chocobozzz/PeerTube
Add progress bar for video upload
parent
baeefe22ca
commit
c182778e26
|
@ -84,19 +84,19 @@ styles:
|
|||
navs: true
|
||||
navbar: false
|
||||
breadcrumbs: false
|
||||
pagination: true
|
||||
pagination: false
|
||||
pager: false
|
||||
labels: true
|
||||
labels: false
|
||||
badges: false
|
||||
jumbotron: false
|
||||
thumbnails: true
|
||||
thumbnails: false
|
||||
alerts: true
|
||||
progress-bars: true
|
||||
progress-bars: false
|
||||
media: true
|
||||
list-group: false
|
||||
panels: true
|
||||
wells: false
|
||||
responsive-embed: true
|
||||
responsive-embed: false
|
||||
close: true
|
||||
|
||||
# Components w/ JavaScript
|
||||
|
|
|
@ -6,7 +6,6 @@ import { RouterModule } from '@angular/router'
|
|||
|
||||
import { BsDropdownModule } from 'ngx-bootstrap/dropdown'
|
||||
import { ModalModule } from 'ngx-bootstrap/modal'
|
||||
import { ProgressbarModule } from 'ngx-bootstrap/progressbar'
|
||||
import { InfiniteScrollModule } from 'ngx-infinite-scroll'
|
||||
import { BytesPipe, KeysPipe, NgPipesModule } from 'ngx-pipes'
|
||||
import { SharedModule as PrimeSharedModule } from 'primeng/components/common/shared'
|
||||
|
@ -34,7 +33,6 @@ import { VideoService } from './video/video.service'
|
|||
|
||||
BsDropdownModule.forRoot(),
|
||||
ModalModule.forRoot(),
|
||||
ProgressbarModule.forRoot(),
|
||||
|
||||
DataTableModule,
|
||||
PrimeSharedModule,
|
||||
|
@ -59,7 +57,6 @@ import { VideoService } from './video/video.service'
|
|||
|
||||
BsDropdownModule,
|
||||
ModalModule,
|
||||
ProgressbarModule,
|
||||
DataTableModule,
|
||||
PrimeSharedModule,
|
||||
InfiniteScrollModule,
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<p-progressBar *ngIf="isUploadingVideo" [value]="videoUploadPercents"></p-progressBar>
|
||||
|
||||
<!-- Hidden because we need to load the component -->
|
||||
<form [hidden]="!isUploadingVideo" novalidate [formGroup]="form">
|
||||
<my-video-edit
|
||||
|
|
|
@ -57,4 +57,27 @@
|
|||
}
|
||||
}
|
||||
|
||||
p-progressBar {
|
||||
margin-top: 50px;
|
||||
margin-bottom: 40px;
|
||||
|
||||
/deep/ .ui-progressbar {
|
||||
font-size: 15px !important;
|
||||
color: #fff !important;
|
||||
height: 30px !important;
|
||||
line-height: 30px !important;
|
||||
border-radius: 3px !important;
|
||||
background-color: rgba(11, 204, 41, 0.16) !important;
|
||||
|
||||
.ui-progressbar-value {
|
||||
background-color: #0BCC29 !important;
|
||||
}
|
||||
|
||||
.ui-progressbar-label {
|
||||
text-align: left;
|
||||
padding-left: 18px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ export class VideoAddComponent extends FormReactive implements OnInit {
|
|||
|
||||
isUploadingVideo = false
|
||||
videoUploaded = false
|
||||
progressPercent = 0
|
||||
videoUploadPercents = 0
|
||||
|
||||
error: string = null
|
||||
form: FormGroup
|
||||
|
@ -55,7 +55,7 @@ export class VideoAddComponent extends FormReactive implements OnInit {
|
|||
ngOnInit () {
|
||||
this.buildForm()
|
||||
|
||||
this.serverService.videoCategoriesLoaded
|
||||
this.serverService.videoPrivaciesLoaded
|
||||
.subscribe(
|
||||
() => {
|
||||
this.videoPrivacies = this.serverService.getVideoPrivacies()
|
||||
|
@ -112,7 +112,7 @@ export class VideoAddComponent extends FormReactive implements OnInit {
|
|||
this.videoService.uploadVideo(formData).subscribe(
|
||||
event => {
|
||||
if (event.type === HttpEventType.UploadProgress) {
|
||||
this.progressPercent = Math.round(100 * event.loaded / event.total)
|
||||
this.videoUploadPercents = Math.round(100 * event.loaded / event.total)
|
||||
} else if (event instanceof HttpResponse) {
|
||||
console.log('Video uploaded.')
|
||||
|
||||
|
@ -122,7 +122,7 @@ export class VideoAddComponent extends FormReactive implements OnInit {
|
|||
|
||||
err => {
|
||||
// Reset progress
|
||||
this.progressPercent = 0
|
||||
this.videoUploadPercents = 0
|
||||
this.error = err.message
|
||||
}
|
||||
)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { NgModule } from '@angular/core'
|
||||
import { ProgressBarModule } from 'primeng/primeng'
|
||||
import { SharedModule } from '../../shared'
|
||||
import { VideoEditModule } from './shared/video-edit.module'
|
||||
import { VideoAddRoutingModule } from './video-add-routing.module'
|
||||
|
@ -8,7 +9,8 @@ import { VideoAddComponent } from './video-add.component'
|
|||
imports: [
|
||||
VideoAddRoutingModule,
|
||||
VideoEditModule,
|
||||
SharedModule
|
||||
SharedModule,
|
||||
ProgressBarModule
|
||||
],
|
||||
|
||||
declarations: [
|
||||
|
|
Loading…
Reference in New Issue