aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/+video-edit
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-12-19 16:04:34 +0100
committerChocobozzz <me@florianbigard.com>2018-12-19 17:26:52 +0100
commitf8b2c1b4f509c037b9650cca2c5befd21f056df3 (patch)
tree89d278f9628d657e6aad1b1e15febaf8ff9fcfa9 /client/src/app/videos/+video-edit
parente0e665f0efa98f2701dd9f5529e99989680481ae (diff)
downloadPeerTube-f8b2c1b4f509c037b9650cca2c5befd21f056df3.tar.gz
PeerTube-f8b2c1b4f509c037b9650cca2c5befd21f056df3.tar.zst
PeerTube-f8b2c1b4f509c037b9650cca2c5befd21f056df3.zip
Refractor notification service
Shorter name and use primeng component
Diffstat (limited to 'client/src/app/videos/+video-edit')
-rw-r--r--client/src/app/videos/+video-edit/shared/video-edit.component.ts4
-rw-r--r--client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts9
-rw-r--r--client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts9
-rw-r--r--client/src/app/videos/+video-edit/video-add-components/video-send.ts5
-rw-r--r--client/src/app/videos/+video-edit/video-add-components/video-upload.component.ts15
-rw-r--r--client/src/app/videos/+video-edit/video-update.component.ts10
6 files changed, 24 insertions, 28 deletions
diff --git a/client/src/app/videos/+video-edit/shared/video-edit.component.ts b/client/src/app/videos/+video-edit/shared/video-edit.component.ts
index 1d35b4ba8..85e015901 100644
--- a/client/src/app/videos/+video-edit/shared/video-edit.component.ts
+++ b/client/src/app/videos/+video-edit/shared/video-edit.component.ts
@@ -2,7 +2,7 @@ import { Component, Input, OnDestroy, OnInit, ViewChild } from '@angular/core'
2import { FormArray, FormControl, FormGroup, ValidatorFn, Validators } from '@angular/forms' 2import { FormArray, FormControl, FormGroup, ValidatorFn, Validators } from '@angular/forms'
3import { ActivatedRoute, Router } from '@angular/router' 3import { ActivatedRoute, Router } from '@angular/router'
4import { FormReactiveValidationMessages, VideoValidatorsService } from '@app/shared' 4import { FormReactiveValidationMessages, VideoValidatorsService } from '@app/shared'
5import { NotificationsService } from 'angular2-notifications' 5import { Notifier } from '@app/core'
6import { ServerService } from '../../../core/server' 6import { ServerService } from '../../../core/server'
7import { VideoEdit } from '../../../shared/video/video-edit.model' 7import { VideoEdit } from '../../../shared/video/video-edit.model'
8import { map } from 'rxjs/operators' 8import { map } from 'rxjs/operators'
@@ -59,7 +59,7 @@ export class VideoEditComponent implements OnInit, OnDestroy {
59 private videoCaptionService: VideoCaptionService, 59 private videoCaptionService: VideoCaptionService,
60 private route: ActivatedRoute, 60 private route: ActivatedRoute,
61 private router: Router, 61 private router: Router,
62 private notificationsService: NotificationsService, 62 private notifier: Notifier,
63 private serverService: ServerService, 63 private serverService: ServerService,
64 private i18nPrimengCalendarService: I18nPrimengCalendarService 64 private i18nPrimengCalendarService: I18nPrimengCalendarService
65 ) { 65 ) {
diff --git a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts
index 13776ae36..63db06919 100644
--- a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts
+++ b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts
@@ -1,8 +1,7 @@
1import { Component, ElementRef, EventEmitter, OnInit, Output, ViewChild } from '@angular/core' 1import { Component, ElementRef, EventEmitter, OnInit, Output, ViewChild } from '@angular/core'
2import { Router } from '@angular/router' 2import { Router } from '@angular/router'
3import { NotificationsService } from 'angular2-notifications'
4import { VideoPrivacy, VideoUpdate } from '../../../../../../shared/models/videos' 3import { VideoPrivacy, VideoUpdate } from '../../../../../../shared/models/videos'
5import { AuthService, ServerService } from '../../../core' 4import { AuthService, Notifier, ServerService } from '../../../core'
6import { VideoService } from '../../../shared/video/video.service' 5import { VideoService } from '../../../shared/video/video.service'
7import { I18n } from '@ngx-translate/i18n-polyfill' 6import { I18n } from '@ngx-translate/i18n-polyfill'
8import { LoadingBarService } from '@ngx-loading-bar/core' 7import { LoadingBarService } from '@ngx-loading-bar/core'
@@ -41,7 +40,7 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Ca
41 constructor ( 40 constructor (
42 protected formValidatorService: FormValidatorService, 41 protected formValidatorService: FormValidatorService,
43 protected loadingBar: LoadingBarService, 42 protected loadingBar: LoadingBarService,
44 protected notificationsService: NotificationsService, 43 protected notifier: Notifier,
45 protected authService: AuthService, 44 protected authService: AuthService,
46 protected serverService: ServerService, 45 protected serverService: ServerService,
47 protected videoService: VideoService, 46 protected videoService: VideoService,
@@ -107,7 +106,7 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Ca
107 this.loadingBar.complete() 106 this.loadingBar.complete()
108 this.isImportingVideo = false 107 this.isImportingVideo = false
109 this.firstStepError.emit() 108 this.firstStepError.emit()
110 this.notificationsService.error(this.i18n('Error'), err.message) 109 this.notifier.error(err.message)
111 } 110 }
112 ) 111 )
113 } 112 }
@@ -126,7 +125,7 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Ca
126 .subscribe( 125 .subscribe(
127 () => { 126 () => {
128 this.isUpdatingVideo = false 127 this.isUpdatingVideo = false
129 this.notificationsService.success(this.i18n('Success'), this.i18n('Video to import updated.')) 128 this.notifier.success(this.i18n('Video to import updated.'))
130 129
131 this.router.navigate([ '/my-account', 'video-imports' ]) 130 this.router.navigate([ '/my-account', 'video-imports' ])
132 }, 131 },
diff --git a/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts b/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts
index 9cdface75..a1810b7a0 100644
--- a/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts
+++ b/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts
@@ -1,8 +1,7 @@
1import { Component, EventEmitter, OnInit, Output } from '@angular/core' 1import { Component, EventEmitter, OnInit, Output } from '@angular/core'
2import { Router } from '@angular/router' 2import { Router } from '@angular/router'
3import { NotificationsService } from 'angular2-notifications'
4import { VideoPrivacy, VideoUpdate } from '../../../../../../shared/models/videos' 3import { VideoPrivacy, VideoUpdate } from '../../../../../../shared/models/videos'
5import { AuthService, ServerService } from '../../../core' 4import { AuthService, Notifier, ServerService } from '../../../core'
6import { VideoService } from '../../../shared/video/video.service' 5import { VideoService } from '../../../shared/video/video.service'
7import { I18n } from '@ngx-translate/i18n-polyfill' 6import { I18n } from '@ngx-translate/i18n-polyfill'
8import { LoadingBarService } from '@ngx-loading-bar/core' 7import { LoadingBarService } from '@ngx-loading-bar/core'
@@ -40,7 +39,7 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, CanCom
40 constructor ( 39 constructor (
41 protected formValidatorService: FormValidatorService, 40 protected formValidatorService: FormValidatorService,
42 protected loadingBar: LoadingBarService, 41 protected loadingBar: LoadingBarService,
43 protected notificationsService: NotificationsService, 42 protected notifier: Notifier,
44 protected authService: AuthService, 43 protected authService: AuthService,
45 protected serverService: ServerService, 44 protected serverService: ServerService,
46 protected videoService: VideoService, 45 protected videoService: VideoService,
@@ -99,7 +98,7 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, CanCom
99 this.loadingBar.complete() 98 this.loadingBar.complete()
100 this.isImportingVideo = false 99 this.isImportingVideo = false
101 this.firstStepError.emit() 100 this.firstStepError.emit()
102 this.notificationsService.error(this.i18n('Error'), err.message) 101 this.notifier.error(err.message)
103 } 102 }
104 ) 103 )
105 } 104 }
@@ -118,7 +117,7 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, CanCom
118 .subscribe( 117 .subscribe(
119 () => { 118 () => {
120 this.isUpdatingVideo = false 119 this.isUpdatingVideo = false
121 this.notificationsService.success(this.i18n('Success'), this.i18n('Video to import updated.')) 120 this.notifier.success(this.i18n('Video to import updated.'))
122 121
123 this.router.navigate([ '/my-account', 'video-imports' ]) 122 this.router.navigate([ '/my-account', 'video-imports' ])
124 }, 123 },
diff --git a/client/src/app/videos/+video-edit/video-add-components/video-send.ts b/client/src/app/videos/+video-edit/video-add-components/video-send.ts
index 71d2544d8..580c123a0 100644
--- a/client/src/app/videos/+video-edit/video-add-components/video-send.ts
+++ b/client/src/app/videos/+video-edit/video-add-components/video-send.ts
@@ -1,10 +1,9 @@
1import { EventEmitter, OnInit } from '@angular/core' 1import { EventEmitter, OnInit } from '@angular/core'
2import { LoadingBarService } from '@ngx-loading-bar/core' 2import { LoadingBarService } from '@ngx-loading-bar/core'
3import { NotificationsService } from 'angular2-notifications' 3import { AuthService, Notifier, ServerService } from '@app/core'
4import { catchError, switchMap, tap } from 'rxjs/operators' 4import { catchError, switchMap, tap } from 'rxjs/operators'
5import { FormReactive } from '@app/shared' 5import { FormReactive } from '@app/shared'
6import { VideoConstant, VideoPrivacy } from '../../../../../../shared' 6import { VideoConstant, VideoPrivacy } from '../../../../../../shared'
7import { AuthService, ServerService } from '@app/core'
8import { VideoService } from '@app/shared/video/video.service' 7import { VideoService } from '@app/shared/video/video.service'
9import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model' 8import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model'
10import { VideoCaptionService } from '@app/shared/video-caption' 9import { VideoCaptionService } from '@app/shared/video-caption'
@@ -25,7 +24,7 @@ export abstract class VideoSend extends FormReactive implements OnInit {
25 protected abstract readonly DEFAULT_VIDEO_PRIVACY: VideoPrivacy 24 protected abstract readonly DEFAULT_VIDEO_PRIVACY: VideoPrivacy
26 25
27 protected loadingBar: LoadingBarService 26 protected loadingBar: LoadingBarService
28 protected notificationsService: NotificationsService 27 protected notifier: Notifier
29 protected authService: AuthService 28 protected authService: AuthService
30 protected serverService: ServerService 29 protected serverService: ServerService
31 protected videoService: VideoService 30 protected videoService: VideoService
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 2180e22ab..aa40f8781 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
@@ -2,11 +2,10 @@ import { HttpEventType, HttpResponse } from '@angular/common/http'
2import { Component, ElementRef, EventEmitter, OnDestroy, OnInit, Output, ViewChild } from '@angular/core' 2import { Component, ElementRef, EventEmitter, OnDestroy, OnInit, Output, ViewChild } from '@angular/core'
3import { Router } from '@angular/router' 3import { Router } from '@angular/router'
4import { LoadingBarService } from '@ngx-loading-bar/core' 4import { LoadingBarService } from '@ngx-loading-bar/core'
5import { NotificationsService } from 'angular2-notifications'
6import { BytesPipe } from 'ngx-pipes' 5import { BytesPipe } from 'ngx-pipes'
7import { Subscription } from 'rxjs' 6import { Subscription } from 'rxjs'
8import { VideoPrivacy } from '../../../../../../shared/models/videos' 7import { VideoPrivacy } from '../../../../../../shared/models/videos'
9import { AuthService, ServerService } from '../../../core' 8import { AuthService, Notifier, ServerService } from '../../../core'
10import { VideoEdit } from '../../../shared/video/video-edit.model' 9import { VideoEdit } from '../../../shared/video/video-edit.model'
11import { VideoService } from '../../../shared/video/video.service' 10import { VideoService } from '../../../shared/video/video.service'
12import { I18n } from '@ngx-translate/i18n-polyfill' 11import { I18n } from '@ngx-translate/i18n-polyfill'
@@ -53,7 +52,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy
53 constructor ( 52 constructor (
54 protected formValidatorService: FormValidatorService, 53 protected formValidatorService: FormValidatorService,
55 protected loadingBar: LoadingBarService, 54 protected loadingBar: LoadingBarService,
56 protected notificationsService: NotificationsService, 55 protected notifier: Notifier,
57 protected authService: AuthService, 56 protected authService: AuthService,
58 protected serverService: ServerService, 57 protected serverService: ServerService,
59 protected videoService: VideoService, 58 protected videoService: VideoService,
@@ -110,7 +109,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy
110 this.isUploadingVideo = false 109 this.isUploadingVideo = false
111 this.videoUploadPercents = 0 110 this.videoUploadPercents = 0
112 this.videoUploadObservable = null 111 this.videoUploadObservable = null
113 this.notificationsService.info(this.i18n('Info'), this.i18n('Upload cancelled')) 112 this.notifier.info(this.i18n('Upload cancelled'))
114 } 113 }
115 } 114 }
116 115
@@ -130,7 +129,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy
130 videoQuota: bytePipes.transform(videoQuota, 0) 129 videoQuota: bytePipes.transform(videoQuota, 0)
131 } 130 }
132 ) 131 )
133 this.notificationsService.error(this.i18n('Error'), msg) 132 this.notifier.error(msg)
134 return 133 return
135 } 134 }
136 135
@@ -145,7 +144,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy
145 quotaDaily: bytePipes.transform(videoQuotaDaily, 0) 144 quotaDaily: bytePipes.transform(videoQuotaDaily, 0)
146 } 145 }
147 ) 146 )
148 this.notificationsService.error(this.i18n('Error'), msg) 147 this.notifier.error(msg)
149 return 148 return
150 } 149 }
151 150
@@ -209,7 +208,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy
209 this.videoUploadPercents = 0 208 this.videoUploadPercents = 0
210 this.videoUploadObservable = null 209 this.videoUploadObservable = null
211 this.firstStepError.emit() 210 this.firstStepError.emit()
212 this.notificationsService.error(this.i18n('Error'), err.message) 211 this.notifier.error(err.message)
213 } 212 }
214 ) 213 )
215 } 214 }
@@ -238,7 +237,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy
238 this.isUpdatingVideo = false 237 this.isUpdatingVideo = false
239 this.isUploadingVideo = false 238 this.isUploadingVideo = false
240 239
241 this.notificationsService.success(this.i18n('Success'), this.i18n('Video published.')) 240 this.notifier.success(this.i18n('Video published.'))
242 this.router.navigate([ '/videos/watch', video.uuid ]) 241 this.router.navigate([ '/videos/watch', video.uuid ])
243 }, 242 },
244 243
diff --git a/client/src/app/videos/+video-edit/video-update.component.ts b/client/src/app/videos/+video-edit/video-update.component.ts
index d99a02b18..d22ee540a 100644
--- a/client/src/app/videos/+video-edit/video-update.component.ts
+++ b/client/src/app/videos/+video-edit/video-update.component.ts
@@ -2,7 +2,7 @@ import { map, switchMap } from 'rxjs/operators'
2import { Component, OnInit } from '@angular/core' 2import { Component, OnInit } from '@angular/core'
3import { ActivatedRoute, Router } from '@angular/router' 3import { ActivatedRoute, Router } from '@angular/router'
4import { LoadingBarService } from '@ngx-loading-bar/core' 4import { LoadingBarService } from '@ngx-loading-bar/core'
5import { NotificationsService } from 'angular2-notifications' 5import { Notifier } from '@app/core'
6import { VideoConstant, VideoPrivacy } from '../../../../../shared/models/videos' 6import { VideoConstant, VideoPrivacy } from '../../../../../shared/models/videos'
7import { ServerService } from '../../core' 7import { ServerService } from '../../core'
8import { FormReactive } from '../../shared' 8import { FormReactive } from '../../shared'
@@ -35,7 +35,7 @@ export class VideoUpdateComponent extends FormReactive implements OnInit {
35 protected formValidatorService: FormValidatorService, 35 protected formValidatorService: FormValidatorService,
36 private route: ActivatedRoute, 36 private route: ActivatedRoute,
37 private router: Router, 37 private router: Router,
38 private notificationsService: NotificationsService, 38 private notifier: Notifier,
39 private serverService: ServerService, 39 private serverService: ServerService,
40 private videoService: VideoService, 40 private videoService: VideoService,
41 private loadingBar: LoadingBarService, 41 private loadingBar: LoadingBarService,
@@ -78,7 +78,7 @@ export class VideoUpdateComponent extends FormReactive implements OnInit {
78 78
79 err => { 79 err => {
80 console.error(err) 80 console.error(err)
81 this.notificationsService.error(this.i18n('Error'), err.message) 81 this.notifier.error(err.message)
82 } 82 }
83 ) 83 )
84 } 84 }
@@ -121,14 +121,14 @@ export class VideoUpdateComponent extends FormReactive implements OnInit {
121 this.updateDone = true 121 this.updateDone = true
122 this.isUpdatingVideo = false 122 this.isUpdatingVideo = false
123 this.loadingBar.complete() 123 this.loadingBar.complete()
124 this.notificationsService.success(this.i18n('Success'), this.i18n('Video updated.')) 124 this.notifier.success(this.i18n('Video updated.'))
125 this.router.navigate([ '/videos/watch', this.video.uuid ]) 125 this.router.navigate([ '/videos/watch', this.video.uuid ])
126 }, 126 },
127 127
128 err => { 128 err => {
129 this.loadingBar.complete() 129 this.loadingBar.complete()
130 this.isUpdatingVideo = false 130 this.isUpdatingVideo = false
131 this.notificationsService.error(this.i18n('Error'), err.message) 131 this.notifier.error(err.message)
132 console.error(err) 132 console.error(err)
133 } 133 }
134 ) 134 )