Add client action hooks for pubish pages
This commit is contained in:
parent
74a4d53110
commit
2e257e36b7
|
@ -1,8 +1,8 @@
|
||||||
|
|
||||||
import { forkJoin } from 'rxjs'
|
import { forkJoin } from 'rxjs'
|
||||||
import { Component, EventEmitter, OnInit, Output } from '@angular/core'
|
import { AfterViewChecked, AfterViewInit, Component, EventEmitter, OnInit, Output } from '@angular/core'
|
||||||
import { Router } from '@angular/router'
|
import { Router } from '@angular/router'
|
||||||
import { AuthService, CanComponentDeactivate, Notifier, ServerService } from '@app/core'
|
import { AuthService, CanComponentDeactivate, HooksService, Notifier, ServerService } from '@app/core'
|
||||||
import { scrollToTop } from '@app/helpers'
|
import { scrollToTop } from '@app/helpers'
|
||||||
import { FormValidatorService } from '@app/shared/shared-forms'
|
import { FormValidatorService } from '@app/shared/shared-forms'
|
||||||
import { VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main'
|
import { VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main'
|
||||||
|
@ -19,7 +19,7 @@ import { VideoSend } from './video-send'
|
||||||
'./video-send.scss'
|
'./video-send.scss'
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class VideoGoLiveComponent extends VideoSend implements OnInit, CanComponentDeactivate {
|
export class VideoGoLiveComponent extends VideoSend implements OnInit, AfterViewInit, CanComponentDeactivate {
|
||||||
@Output() firstStepDone = new EventEmitter<string>()
|
@Output() firstStepDone = new EventEmitter<string>()
|
||||||
@Output() firstStepError = new EventEmitter<void>()
|
@Output() firstStepError = new EventEmitter<void>()
|
||||||
|
|
||||||
|
@ -41,7 +41,8 @@ export class VideoGoLiveComponent extends VideoSend implements OnInit, CanCompon
|
||||||
protected videoService: VideoService,
|
protected videoService: VideoService,
|
||||||
protected videoCaptionService: VideoCaptionService,
|
protected videoCaptionService: VideoCaptionService,
|
||||||
private liveVideoService: LiveVideoService,
|
private liveVideoService: LiveVideoService,
|
||||||
private router: Router
|
private router: Router,
|
||||||
|
private hooks: HooksService
|
||||||
) {
|
) {
|
||||||
super()
|
super()
|
||||||
}
|
}
|
||||||
|
@ -50,6 +51,10 @@ export class VideoGoLiveComponent extends VideoSend implements OnInit, CanCompon
|
||||||
super.ngOnInit()
|
super.ngOnInit()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngAfterViewInit () {
|
||||||
|
this.hooks.runAction('action:go-live.init', 'video-edit')
|
||||||
|
}
|
||||||
|
|
||||||
canDeactivate () {
|
canDeactivate () {
|
||||||
return { canDeactivate: true }
|
return { canDeactivate: true }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Component, ElementRef, EventEmitter, OnInit, Output, ViewChild } from '@angular/core'
|
import { AfterViewInit, Component, ElementRef, EventEmitter, OnInit, Output, ViewChild } from '@angular/core'
|
||||||
import { Router } from '@angular/router'
|
import { Router } from '@angular/router'
|
||||||
import { AuthService, CanComponentDeactivate, Notifier, ServerService } from '@app/core'
|
import { AuthService, CanComponentDeactivate, HooksService, Notifier, ServerService } from '@app/core'
|
||||||
import { scrollToTop } from '@app/helpers'
|
import { scrollToTop } from '@app/helpers'
|
||||||
import { FormValidatorService } from '@app/shared/shared-forms'
|
import { FormValidatorService } from '@app/shared/shared-forms'
|
||||||
import { VideoCaptionService, VideoEdit, VideoImportService, VideoService } from '@app/shared/shared-main'
|
import { VideoCaptionService, VideoEdit, VideoImportService, VideoService } from '@app/shared/shared-main'
|
||||||
|
@ -18,7 +18,7 @@ import { VideoSend } from './video-send'
|
||||||
'./video-send.scss'
|
'./video-send.scss'
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class VideoImportTorrentComponent extends VideoSend implements OnInit, CanComponentDeactivate {
|
export class VideoImportTorrentComponent extends VideoSend implements OnInit, AfterViewInit, CanComponentDeactivate {
|
||||||
@Output() firstStepDone = new EventEmitter<string>()
|
@Output() firstStepDone = new EventEmitter<string>()
|
||||||
@Output() firstStepError = new EventEmitter<void>()
|
@Output() firstStepError = new EventEmitter<void>()
|
||||||
@ViewChild('torrentfileInput') torrentfileInput: ElementRef<HTMLInputElement>
|
@ViewChild('torrentfileInput') torrentfileInput: ElementRef<HTMLInputElement>
|
||||||
|
@ -43,7 +43,8 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Ca
|
||||||
protected videoService: VideoService,
|
protected videoService: VideoService,
|
||||||
protected videoCaptionService: VideoCaptionService,
|
protected videoCaptionService: VideoCaptionService,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private videoImportService: VideoImportService
|
private videoImportService: VideoImportService,
|
||||||
|
private hooks: HooksService
|
||||||
) {
|
) {
|
||||||
super()
|
super()
|
||||||
}
|
}
|
||||||
|
@ -52,6 +53,10 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Ca
|
||||||
super.ngOnInit()
|
super.ngOnInit()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngAfterViewInit () {
|
||||||
|
this.hooks.runAction('action:video-torrent-import.init', 'video-edit')
|
||||||
|
}
|
||||||
|
|
||||||
canDeactivate () {
|
canDeactivate () {
|
||||||
return { canDeactivate: true }
|
return { canDeactivate: true }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { map, switchMap } from 'rxjs/operators'
|
import { map, switchMap } from 'rxjs/operators'
|
||||||
import { Component, EventEmitter, OnInit, Output } from '@angular/core'
|
import { AfterViewInit, Component, EventEmitter, OnInit, Output } from '@angular/core'
|
||||||
import { Router } from '@angular/router'
|
import { Router } from '@angular/router'
|
||||||
import { AuthService, CanComponentDeactivate, Notifier, ServerService } from '@app/core'
|
import { AuthService, CanComponentDeactivate, HooksService, Notifier, ServerService } from '@app/core'
|
||||||
import { getAbsoluteAPIUrl, scrollToTop } from '@app/helpers'
|
import { getAbsoluteAPIUrl, scrollToTop } from '@app/helpers'
|
||||||
import { FormValidatorService } from '@app/shared/shared-forms'
|
import { FormValidatorService } from '@app/shared/shared-forms'
|
||||||
import { VideoCaptionService, VideoEdit, VideoImportService, VideoService } from '@app/shared/shared-main'
|
import { VideoCaptionService, VideoEdit, VideoImportService, VideoService } from '@app/shared/shared-main'
|
||||||
|
@ -18,7 +18,7 @@ import { VideoSend } from './video-send'
|
||||||
'./video-send.scss'
|
'./video-send.scss'
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class VideoImportUrlComponent extends VideoSend implements OnInit, CanComponentDeactivate {
|
export class VideoImportUrlComponent extends VideoSend implements OnInit, AfterViewInit, CanComponentDeactivate {
|
||||||
@Output() firstStepDone = new EventEmitter<string>()
|
@Output() firstStepDone = new EventEmitter<string>()
|
||||||
@Output() firstStepError = new EventEmitter<void>()
|
@Output() firstStepError = new EventEmitter<void>()
|
||||||
|
|
||||||
|
@ -42,8 +42,9 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, CanCom
|
||||||
protected videoService: VideoService,
|
protected videoService: VideoService,
|
||||||
protected videoCaptionService: VideoCaptionService,
|
protected videoCaptionService: VideoCaptionService,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private videoImportService: VideoImportService
|
private videoImportService: VideoImportService,
|
||||||
) {
|
private hooks: HooksService
|
||||||
|
) {
|
||||||
super()
|
super()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,6 +52,10 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, CanCom
|
||||||
super.ngOnInit()
|
super.ngOnInit()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngAfterViewInit () {
|
||||||
|
this.hooks.runAction('action:video-url-import.init', 'video-edit')
|
||||||
|
}
|
||||||
|
|
||||||
canDeactivate () {
|
canDeactivate () {
|
||||||
return { canDeactivate: true }
|
return { canDeactivate: true }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
import { Subscription } from 'rxjs'
|
import { Subscription } from 'rxjs'
|
||||||
import { HttpErrorResponse, HttpEventType, HttpResponse } from '@angular/common/http'
|
import { HttpErrorResponse, HttpEventType, HttpResponse } from '@angular/common/http'
|
||||||
import { Component, ElementRef, EventEmitter, OnDestroy, OnInit, Output, ViewChild } from '@angular/core'
|
import { AfterViewInit, Component, ElementRef, EventEmitter, OnDestroy, OnInit, Output, ViewChild } from '@angular/core'
|
||||||
import { Router } from '@angular/router'
|
import { Router } from '@angular/router'
|
||||||
import { AuthService, CanComponentDeactivate, Notifier, ServerService, UserService } from '@app/core'
|
import { AuthService, CanComponentDeactivate, HooksService, Notifier, ServerService, UserService } from '@app/core'
|
||||||
import { scrollToTop, uploadErrorHandler } from '@app/helpers'
|
import { scrollToTop, uploadErrorHandler } from '@app/helpers'
|
||||||
import { FormValidatorService } from '@app/shared/shared-forms'
|
import { FormValidatorService } from '@app/shared/shared-forms'
|
||||||
import { BytesPipe, VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main'
|
import { BytesPipe, VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main'
|
||||||
import { LoadingBarService } from '@ngx-loading-bar/core'
|
import { LoadingBarService } from '@ngx-loading-bar/core'
|
||||||
|
import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes'
|
||||||
import { VideoPrivacy } from '@shared/models'
|
import { VideoPrivacy } from '@shared/models'
|
||||||
import { VideoSend } from './video-send'
|
import { VideoSend } from './video-send'
|
||||||
import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes'
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-video-upload',
|
selector: 'my-video-upload',
|
||||||
|
@ -20,7 +20,7 @@ import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes'
|
||||||
'./video-send.scss'
|
'./video-send.scss'
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy, CanComponentDeactivate {
|
export class VideoUploadComponent extends VideoSend implements OnInit, AfterViewInit, OnDestroy, CanComponentDeactivate {
|
||||||
@Output() firstStepDone = new EventEmitter<string>()
|
@Output() firstStepDone = new EventEmitter<string>()
|
||||||
@Output() firstStepError = new EventEmitter<void>()
|
@Output() firstStepError = new EventEmitter<void>()
|
||||||
@ViewChild('videofileInput') videofileInput: ElementRef<HTMLInputElement>
|
@ViewChild('videofileInput') videofileInput: ElementRef<HTMLInputElement>
|
||||||
|
@ -60,7 +60,8 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy
|
||||||
protected videoService: VideoService,
|
protected videoService: VideoService,
|
||||||
protected videoCaptionService: VideoCaptionService,
|
protected videoCaptionService: VideoCaptionService,
|
||||||
private userService: UserService,
|
private userService: UserService,
|
||||||
private router: Router
|
private router: Router,
|
||||||
|
private hooks: HooksService
|
||||||
) {
|
) {
|
||||||
super()
|
super()
|
||||||
}
|
}
|
||||||
|
@ -79,6 +80,10 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngAfterViewInit () {
|
||||||
|
this.hooks.runAction('action:video-upload.init', 'video-edit')
|
||||||
|
}
|
||||||
|
|
||||||
ngOnDestroy () {
|
ngOnDestroy () {
|
||||||
if (this.videoUploadObservable) this.videoUploadObservable.unsubscribe()
|
if (this.videoUploadObservable) this.videoUploadObservable.unsubscribe()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Component, forwardRef, Input } from '@angular/core'
|
import { Component, forwardRef, HostListener, Input } from '@angular/core'
|
||||||
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'
|
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'
|
||||||
import { SelectOptionsItem } from '../../../../types/select-options-item.model'
|
import { SelectOptionsItem } from '../../../../types/select-options-item.model'
|
||||||
|
|
||||||
|
@ -26,6 +26,13 @@ export class SelectOptionsComponent implements ControlValueAccessor {
|
||||||
|
|
||||||
propagateChange = (_: any) => { /* empty */ }
|
propagateChange = (_: any) => { /* empty */ }
|
||||||
|
|
||||||
|
// Allow plugins to update our value
|
||||||
|
@HostListener('change', [ '$event.target' ])
|
||||||
|
handleChange (event: any) {
|
||||||
|
this.writeValue(event.value)
|
||||||
|
this.onModelChange()
|
||||||
|
}
|
||||||
|
|
||||||
writeValue (id: number | string) {
|
writeValue (id: number | string) {
|
||||||
this.selectedId = id
|
this.selectedId = id
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
import 'mocha'
|
import 'mocha'
|
||||||
import * as chai from 'chai'
|
import * as chai from 'chai'
|
||||||
|
import { advancedVideoChannelSearch } from '@shared/extra-utils/search/video-channels'
|
||||||
import { ServerConfig } from '@shared/models'
|
import { ServerConfig } from '@shared/models'
|
||||||
import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
|
import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
|
||||||
import {
|
import {
|
||||||
|
@ -26,7 +27,6 @@ import {
|
||||||
installPlugin,
|
installPlugin,
|
||||||
makeRawRequest,
|
makeRawRequest,
|
||||||
registerUser,
|
registerUser,
|
||||||
searchVideo,
|
|
||||||
setAccessTokensToServers,
|
setAccessTokensToServers,
|
||||||
setDefaultVideoChannel,
|
setDefaultVideoChannel,
|
||||||
updateCustomSubConfig,
|
updateCustomSubConfig,
|
||||||
|
@ -46,7 +46,6 @@ import {
|
||||||
VideoPrivacy
|
VideoPrivacy
|
||||||
} from '../../../shared/models/videos'
|
} from '../../../shared/models/videos'
|
||||||
import { VideoCommentThreadTree } from '../../../shared/models/videos/video-comment.model'
|
import { VideoCommentThreadTree } from '../../../shared/models/videos/video-comment.model'
|
||||||
import { advancedVideoChannelSearch } from '@shared/extra-utils/search/video-channels'
|
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
|
|
|
@ -85,6 +85,15 @@ export const clientActionHookObject = {
|
||||||
// Fired when the registration page is being initialized
|
// Fired when the registration page is being initialized
|
||||||
'action:signup.register.init': true,
|
'action:signup.register.init': true,
|
||||||
|
|
||||||
|
// Fired when the video upload page is being initalized
|
||||||
|
'action:video-upload.init': true,
|
||||||
|
// Fired when the video import by URL page is being initalized
|
||||||
|
'action:video-url-import.init': true,
|
||||||
|
// Fired when the video import by torrent/magnet URI page is being initalized
|
||||||
|
'action:video-torrent-import.init': true,
|
||||||
|
// Fired when the "Go Live" page is being initalized
|
||||||
|
'action:go-live.init': true,
|
||||||
|
|
||||||
// Fired when the modal to download a video/caption is shown
|
// Fired when the modal to download a video/caption is shown
|
||||||
'action:modal.video-download.shown': true,
|
'action:modal.video-download.shown': true,
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue