video-import -> video-import-url

This commit is contained in:
Chocobozzz 2018-08-06 15:18:35 +02:00
parent 43620009d5
commit 047559af6e
6 changed files with 12 additions and 12 deletions

View File

@ -11,7 +11,7 @@
</tab> </tab>
<tab *ngIf="isVideoImportEnabled()" i18n-heading heading="Import with URL"> <tab *ngIf="isVideoImportEnabled()" i18n-heading heading="Import with URL">
<my-video-import #videoImport (firstStepDone)="onFirstStepDone('import', $event)"></my-video-import> <my-video-import-url #videoImportUrl (firstStepDone)="onFirstStepDone('import-url', $event)"></my-video-import-url>
</tab> </tab>
</tabset> </tabset>
</div> </div>

View File

@ -1,6 +1,6 @@
import { Component, ViewChild } from '@angular/core' import { Component, ViewChild } from '@angular/core'
import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard.service' import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard.service'
import { VideoImportComponent } from '@app/videos/+video-edit/video-import.component' import { VideoImportUrlComponent } from '@app/videos/+video-edit/video-import-url.component'
import { VideoUploadComponent } from '@app/videos/+video-edit/video-upload.component' import { VideoUploadComponent } from '@app/videos/+video-edit/video-upload.component'
import { ServerService } from '@app/core' import { ServerService } from '@app/core'
@ -11,23 +11,23 @@ import { ServerService } from '@app/core'
}) })
export class VideoAddComponent implements CanComponentDeactivate { export class VideoAddComponent implements CanComponentDeactivate {
@ViewChild('videoUpload') videoUpload: VideoUploadComponent @ViewChild('videoUpload') videoUpload: VideoUploadComponent
@ViewChild('videoImport') videoImport: VideoImportComponent @ViewChild('videoImportUrl') videoImportUrl: VideoImportUrlComponent
secondStepType: 'upload' | 'import' secondStepType: 'upload' | 'import-url'
videoName: string videoName: string
constructor ( constructor (
private serverService: ServerService private serverService: ServerService
) {} ) {}
onFirstStepDone (type: 'upload' | 'import', videoName: string) { onFirstStepDone (type: 'upload' | 'import-url', videoName: string) {
this.secondStepType = type this.secondStepType = type
this.videoName = videoName this.videoName = videoName
} }
canDeactivate () { canDeactivate () {
if (this.secondStepType === 'upload') return this.videoUpload.canDeactivate() if (this.secondStepType === 'upload') return this.videoUpload.canDeactivate()
if (this.secondStepType === 'import') return this.videoImport.canDeactivate() if (this.secondStepType === 'import-url') return this.videoImportUrl.canDeactivate()
return { canDeactivate: true } return { canDeactivate: true }
} }

View File

@ -6,7 +6,7 @@ import { VideoAddRoutingModule } from './video-add-routing.module'
import { VideoAddComponent } from './video-add.component' import { VideoAddComponent } from './video-add.component'
import { CanDeactivateGuard } from '../../shared/guards/can-deactivate-guard.service' import { CanDeactivateGuard } from '../../shared/guards/can-deactivate-guard.service'
import { VideoUploadComponent } from '@app/videos/+video-edit/video-upload.component' import { VideoUploadComponent } from '@app/videos/+video-edit/video-upload.component'
import { VideoImportComponent } from '@app/videos/+video-edit/video-import.component' import { VideoImportUrlComponent } from '@app/videos/+video-edit/video-import-url.component'
@NgModule({ @NgModule({
imports: [ imports: [
@ -18,7 +18,7 @@ import { VideoImportComponent } from '@app/videos/+video-edit/video-import.compo
declarations: [ declarations: [
VideoAddComponent, VideoAddComponent,
VideoUploadComponent, VideoUploadComponent,
VideoImportComponent VideoImportUrlComponent
], ],
exports: [ exports: [
VideoAddComponent VideoAddComponent

View File

@ -14,14 +14,14 @@ import { VideoCaptionService } from '@app/shared/video-caption'
import { VideoSend } from '@app/videos/+video-edit/shared/video-send' import { VideoSend } from '@app/videos/+video-edit/shared/video-send'
@Component({ @Component({
selector: 'my-video-import', selector: 'my-video-import-url',
templateUrl: './video-import.component.html', templateUrl: './video-import-url.component.html',
styleUrls: [ styleUrls: [
'./shared/video-edit.component.scss', './shared/video-edit.component.scss',
'./video-import.component.scss' './video-import-url.component.scss'
] ]
}) })
export class VideoImportComponent extends VideoSend implements OnInit, CanComponentDeactivate { export class VideoImportUrlComponent extends VideoSend implements OnInit, CanComponentDeactivate {
@Output() firstStepDone = new EventEmitter<string>() @Output() firstStepDone = new EventEmitter<string>()
targetUrl = '' targetUrl = ''