diff options
Diffstat (limited to 'client/src/app/videos/+video-edit')
4 files changed, 32 insertions, 35 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 77e984855..eab0a898e 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 | |||
@@ -3,7 +3,6 @@ import { FormBuilder, FormControl, FormGroup } from '@angular/forms' | |||
3 | import { ActivatedRoute, Router } from '@angular/router' | 3 | import { ActivatedRoute, Router } from '@angular/router' |
4 | import { VIDEO_IMAGE, VIDEO_SUPPORT } from '@app/shared' | 4 | import { VIDEO_IMAGE, VIDEO_SUPPORT } from '@app/shared' |
5 | import { NotificationsService } from 'angular2-notifications' | 5 | import { NotificationsService } from 'angular2-notifications' |
6 | import 'rxjs/add/observable/forkJoin' | ||
7 | import { ServerService } from '../../../core/server' | 6 | import { ServerService } from '../../../core/server' |
8 | import { VIDEO_CHANNEL } from '../../../shared/forms/form-validators' | 7 | import { VIDEO_CHANNEL } from '../../../shared/forms/form-validators' |
9 | import { ValidatorMessage } from '../../../shared/forms/form-validators/validator-message' | 8 | import { ValidatorMessage } from '../../../shared/forms/form-validators/validator-message' |
diff --git a/client/src/app/videos/+video-edit/shared/video-image.component.ts b/client/src/app/videos/+video-edit/shared/video-image.component.ts index 3f5705a92..df6565857 100644 --- a/client/src/app/videos/+video-edit/shared/video-image.component.ts +++ b/client/src/app/videos/+video-edit/shared/video-image.component.ts | |||
@@ -2,7 +2,6 @@ import { Component, forwardRef, Input } from '@angular/core' | |||
2 | import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' | 2 | import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' |
3 | import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser' | 3 | import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser' |
4 | import { ServerService } from '@app/core' | 4 | import { ServerService } from '@app/core' |
5 | import 'rxjs/add/observable/forkJoin' | ||
6 | 5 | ||
7 | @Component({ | 6 | @Component({ |
8 | selector: 'my-video-image', | 7 | selector: 'my-video-image', |
@@ -16,7 +15,6 @@ import 'rxjs/add/observable/forkJoin' | |||
16 | } | 15 | } |
17 | ] | 16 | ] |
18 | }) | 17 | }) |
19 | |||
20 | export class VideoImageComponent implements ControlValueAccessor { | 18 | export class VideoImageComponent implements ControlValueAccessor { |
21 | @Input() inputLabel: string | 19 | @Input() inputLabel: string |
22 | @Input() inputName: string | 20 | @Input() inputName: string |
diff --git a/client/src/app/videos/+video-edit/video-add.component.ts b/client/src/app/videos/+video-edit/video-add.component.ts index fa967018d..41d14573c 100644 --- a/client/src/app/videos/+video-edit/video-add.component.ts +++ b/client/src/app/videos/+video-edit/video-add.component.ts | |||
@@ -7,7 +7,7 @@ import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard. | |||
7 | import { LoadingBarService } from '@ngx-loading-bar/core' | 7 | import { LoadingBarService } from '@ngx-loading-bar/core' |
8 | import { NotificationsService } from 'angular2-notifications' | 8 | import { NotificationsService } from 'angular2-notifications' |
9 | import { BytesPipe } from 'ngx-pipes' | 9 | import { BytesPipe } from 'ngx-pipes' |
10 | import { Subscription } from 'rxjs/Subscription' | 10 | import { Subscription } from 'rxjs' |
11 | import { VideoPrivacy } from '../../../../../shared/models/videos' | 11 | import { VideoPrivacy } from '../../../../../shared/models/videos' |
12 | import { AuthService, ServerService } from '../../core' | 12 | import { AuthService, ServerService } from '../../core' |
13 | import { FormReactive } from '../../shared' | 13 | import { FormReactive } from '../../shared' |
@@ -24,7 +24,6 @@ import { VideoService } from '../../shared/video/video.service' | |||
24 | './video-add.component.scss' | 24 | './video-add.component.scss' |
25 | ] | 25 | ] |
26 | }) | 26 | }) |
27 | |||
28 | export class VideoAddComponent extends FormReactive implements OnInit, OnDestroy, CanComponentDeactivate { | 27 | export class VideoAddComponent extends FormReactive implements OnInit, OnDestroy, CanComponentDeactivate { |
29 | @ViewChild('videofileInput') videofileInput | 28 | @ViewChild('videofileInput') videofileInput |
30 | 29 | ||
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 73e2764c6..b1d80bcaa 100644 --- a/client/src/app/videos/+video-edit/video-update.component.ts +++ b/client/src/app/videos/+video-edit/video-update.component.ts | |||
@@ -1,9 +1,9 @@ | |||
1 | import { map, switchMap } from 'rxjs/operators' | ||
1 | import { Component, OnInit } from '@angular/core' | 2 | import { Component, OnInit } from '@angular/core' |
2 | import { FormBuilder, FormGroup } from '@angular/forms' | 3 | import { FormBuilder, FormGroup } from '@angular/forms' |
3 | import { ActivatedRoute, Router } from '@angular/router' | 4 | import { ActivatedRoute, Router } from '@angular/router' |
4 | import { LoadingBarService } from '@ngx-loading-bar/core' | 5 | import { LoadingBarService } from '@ngx-loading-bar/core' |
5 | import { NotificationsService } from 'angular2-notifications' | 6 | import { NotificationsService } from 'angular2-notifications' |
6 | import 'rxjs/add/observable/forkJoin' | ||
7 | import { VideoPrivacy } from '../../../../../shared/models/videos' | 7 | import { VideoPrivacy } from '../../../../../shared/models/videos' |
8 | import { ServerService } from '../../core' | 8 | import { ServerService } from '../../core' |
9 | import { AuthService } from '../../core/auth' | 9 | import { AuthService } from '../../core/auth' |
@@ -18,7 +18,6 @@ import { populateAsyncUserVideoChannels } from '@app/shared/misc/utils' | |||
18 | styleUrls: [ './shared/video-edit.component.scss' ], | 18 | styleUrls: [ './shared/video-edit.component.scss' ], |
19 | templateUrl: './video-update.component.html' | 19 | templateUrl: './video-update.component.html' |
20 | }) | 20 | }) |
21 | |||
22 | export class VideoUpdateComponent extends FormReactive implements OnInit { | 21 | export class VideoUpdateComponent extends FormReactive implements OnInit { |
23 | video: VideoEdit | 22 | video: VideoEdit |
24 | 23 | ||
@@ -53,38 +52,40 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { | |||
53 | this.serverService.videoPrivaciesLoaded | 52 | this.serverService.videoPrivaciesLoaded |
54 | .subscribe(() => this.videoPrivacies = this.serverService.getVideoPrivacies()) | 53 | .subscribe(() => this.videoPrivacies = this.serverService.getVideoPrivacies()) |
55 | 54 | ||
56 | const uuid: string = this.route.snapshot.params['uuid'] | 55 | const uuid: string = this.route.snapshot.params[ 'uuid' ] |
57 | this.videoService.getVideo(uuid) | 56 | this.videoService.getVideo(uuid) |
58 | .switchMap(video => { | 57 | .pipe( |
59 | return this.videoService | 58 | switchMap(video => { |
60 | .loadCompleteDescription(video.descriptionPath) | 59 | return this.videoService |
61 | .map(description => Object.assign(video, { description })) | 60 | .loadCompleteDescription(video.descriptionPath) |
62 | }) | 61 | .pipe(map(description => Object.assign(video, { description }))) |
63 | .subscribe( | 62 | }) |
64 | video => { | 63 | ) |
65 | this.video = new VideoEdit(video) | 64 | .subscribe( |
66 | 65 | video => { | |
67 | populateAsyncUserVideoChannels(this.authService, this.userVideoChannels) | 66 | this.video = new VideoEdit(video) |
68 | .catch(err => console.error(err)) | 67 | |
69 | 68 | populateAsyncUserVideoChannels(this.authService, this.userVideoChannels) | |
70 | // We cannot set private a video that was not private | 69 | .catch(err => console.error(err)) |
71 | if (video.privacy.id !== VideoPrivacy.PRIVATE) { | 70 | |
72 | const newVideoPrivacies = [] | 71 | // We cannot set private a video that was not private |
73 | for (const p of this.videoPrivacies) { | 72 | if (video.privacy.id !== VideoPrivacy.PRIVATE) { |
74 | if (p.id !== VideoPrivacy.PRIVATE) newVideoPrivacies.push(p) | 73 | const newVideoPrivacies = [] |
74 | for (const p of this.videoPrivacies) { | ||
75 | if (p.id !== VideoPrivacy.PRIVATE) newVideoPrivacies.push(p) | ||
76 | } | ||
77 | |||
78 | this.videoPrivacies = newVideoPrivacies | ||
75 | } | 79 | } |
76 | 80 | ||
77 | this.videoPrivacies = newVideoPrivacies | 81 | this.hydrateFormFromVideo() |
78 | } | 82 | }, |
79 | 83 | ||
80 | this.hydrateFormFromVideo() | 84 | err => { |
81 | }, | 85 | console.error(err) |
82 | 86 | this.notificationsService.error('Error', err.message) | |
83 | err => { | 87 | } |
84 | console.error(err) | 88 | ) |
85 | this.notificationsService.error('Error', err.message) | ||
86 | } | ||
87 | ) | ||
88 | } | 89 | } |
89 | 90 | ||
90 | checkForm () { | 91 | checkForm () { |