"@angular/router": "~5.2.2",
"@angular/service-worker": "^5.2.4",
"@angularclass/hmr": "^2.1.3",
+ "@ngx-loading-bar/core": "^1.1.1",
"@ngx-loading-bar/http-client": "^1.0.0-rc.1",
"@ngx-meta/core": "^5.0.0",
"@types/core-js": "^0.9.28",
import { NgModule, Optional, SkipSelf } from '@angular/core'
import { CommonModule } from '@angular/common'
-import { HttpModule } from '@angular/http'
import { RouterModule } from '@angular/router'
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'
+import { LoadingBarModule } from '@ngx-loading-bar/core'
+import { LoadingBarHttpClientModule } from '@ngx-loading-bar/http-client'
import { SimpleNotificationsModule } from 'angular2-notifications'
import { ModalModule } from 'ngx-bootstrap/modal'
@NgModule({
imports: [
CommonModule,
- HttpModule,
RouterModule,
BrowserAnimationsModule,
ModalModule,
- SimpleNotificationsModule.forRoot()
+ SimpleNotificationsModule.forRoot(),
+
+ LoadingBarHttpClientModule,
+ LoadingBarModule.forRoot()
],
declarations: [
exports: [
SimpleNotificationsModule,
+ LoadingBarHttpClientModule,
+ LoadingBarModule,
ConfirmComponent
],
import { MarkdownTextareaComponent } from '@app/shared/forms/markdown-textarea.component'
import { InfiniteScrollerDirective } from '@app/shared/video/infinite-scroller.directive'
import { MarkdownService } from '@app/videos/shared'
-import { LoadingBarHttpClientModule } from '@ngx-loading-bar/http-client'
import { BsDropdownModule } from 'ngx-bootstrap/dropdown'
import { ModalModule } from 'ngx-bootstrap/modal'
RouterModule,
HttpClientModule,
- LoadingBarHttpClientModule,
-
BsDropdownModule.forRoot(),
ModalModule.forRoot(),
TabsModule.forRoot(),
RouterModule,
HttpClientModule,
- LoadingBarHttpClientModule,
-
BsDropdownModule,
ModalModule,
TabsModule,
import { NgModule } from '@angular/core'
-import { VideoImageComponent } from '@app/videos/+video-edit/shared/video-image.component'
+import { VideoImageComponent } from './video-image.component'
import { TabsModule } from 'ngx-bootstrap/tabs'
import { TagInputModule } from 'ngx-chips'
import { SharedModule } from '../../../shared'
<div class="submit-container">
<div *ngIf="videoUploaded === false" class="message-submit">Publish will be available when upload is finished</div>
- <div class="submit-button" (click)="updateSecondStep()" [ngClass]="{ disabled: !form.valid || videoUploaded !== true }">
+ <div class="submit-button"
+ (click)="updateSecondStep()"
+ [ngClass]="{ disabled: !form.valid || isUpdatingVideo === true || videoUploaded !== true }"
+ >
<span class="icon icon-validate"></span>
<input type="button" value="Publish" />
</div>
import { Router } from '@angular/router'
import { UserService } from '@app/shared'
import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard.service'
+import { LoadingBarService } from '@ngx-loading-bar/core'
import { NotificationsService } from 'angular2-notifications'
import { BytesPipe } from 'ngx-pipes'
import { Subscription } from 'rxjs/Subscription'
@ViewChild('videofileInput') videofileInput
isUploadingVideo = false
+ isUpdatingVideo = false
videoUploaded = false
videoUploadObservable: Subscription = null
videoUploadPercents = 0
private authService: AuthService,
private userService: UserService,
private serverService: ServerService,
- private videoService: VideoService
+ private videoService: VideoService,
+ private loadingBar: LoadingBarService
) {
super()
}
video.id = this.videoUploadedIds.id
video.uuid = this.videoUploadedIds.uuid
+ this.isUpdatingVideo = true
+ this.loadingBar.start()
this.videoService.updateVideo(video)
.subscribe(
() => {
+ this.isUpdatingVideo = false
this.isUploadingVideo = false
+ this.loadingBar.complete()
+
this.notificationsService.success('Success', 'Video published.')
this.router.navigate([ '/videos/watch', video.uuid ])
},
err => {
+ this.isUpdatingVideo = false
this.notificationsService.error('Error', err.message)
console.error(err)
}
></my-video-edit>
<div class="submit-container">
- <div class="submit-button" (click)="update()" [ngClass]="{ disabled: !form.valid }">
+ <div class="submit-button" (click)="update()" [ngClass]="{ disabled: !form.valid || isUpdatingVideo === true }">
<span class="icon icon-validate"></span>
<input type="button" value="Update" />
</div>
import { Component, OnInit } from '@angular/core'
import { FormBuilder, FormGroup } from '@angular/forms'
import { ActivatedRoute, Router } from '@angular/router'
+import { LoadingBarService } from '@ngx-loading-bar/core'
import { NotificationsService } from 'angular2-notifications'
import 'rxjs/add/observable/forkJoin'
import { VideoPrivacy } from '../../../../../shared/models/videos'
export class VideoUpdateComponent extends FormReactive implements OnInit {
video: VideoEdit
+ isUpdatingVideo = false
form: FormGroup
formErrors: { [ id: string ]: string } = {}
validationMessages: ValidatorMessage = {}
private notificationsService: NotificationsService,
private serverService: ServerService,
private videoService: VideoService,
- private authService: AuthService
+ private authService: AuthService,
+ private loadingBar: LoadingBarService
) {
super()
}
this.video.patch(this.form.value)
+ this.loadingBar.start()
+ this.isUpdatingVideo = true
this.videoService.updateVideo(this.video)
.subscribe(
() => {
+ this.isUpdatingVideo = false
+ this.loadingBar.complete()
this.notificationsService.success('Success', 'Video updated.')
this.router.navigate([ '/videos/watch', this.video.uuid ])
},
err => {
+ this.isUpdatingVideo = false
this.notificationsService.error('Error', err.message)
console.error(err)
}
tree-kill "^1.0.0"
webpack-sources "^1.1.0"
-"@ngx-loading-bar/core@1.1.1":
+"@ngx-loading-bar/core@1.1.1", "@ngx-loading-bar/core@^1.1.1":
version "1.1.1"
resolved "https://registry.yarnpkg.com/@ngx-loading-bar/core/-/core-1.1.1.tgz#bcfc8e968f121ca431b4926dfd3465739f7076cd"
dependencies: