diff options
Diffstat (limited to 'client/src/app/videos')
3 files changed, 25 insertions, 10 deletions
diff --git a/client/src/app/videos/+video-edit/video-add.component.html b/client/src/app/videos/+video-edit/video-add.component.html index 698152ff9..7946c0879 100644 --- a/client/src/app/videos/+video-edit/video-add.component.html +++ b/client/src/app/videos/+video-edit/video-add.component.html | |||
@@ -26,6 +26,18 @@ | |||
26 | </div> | 26 | </div> |
27 | 27 | ||
28 | <div class="form-group"> | 28 | <div class="form-group"> |
29 | <label for="category">Channel</label> | ||
30 | <select class="form-control" id="channelId" formControlName="channelId"> | ||
31 | <option></option> | ||
32 | <option *ngFor="let channel of userVideoChannels" [value]="channel.id">{{ channel.label }}</option> | ||
33 | </select> | ||
34 | |||
35 | <div *ngIf="formErrors.channelId" class="alert alert-danger"> | ||
36 | {{ formErrors.channelId }} | ||
37 | </div> | ||
38 | </div> | ||
39 | |||
40 | <div class="form-group"> | ||
29 | <label for="category">Category</label> | 41 | <label for="category">Category</label> |
30 | <select class="form-control" id="category" formControlName="category"> | 42 | <select class="form-control" id="category" formControlName="category"> |
31 | <option></option> | 43 | <option></option> |
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 8043bb41c..92b03e8c9 100644 --- a/client/src/app/videos/+video-edit/video-add.component.ts +++ b/client/src/app/videos/+video-edit/video-add.component.ts | |||
@@ -12,9 +12,10 @@ import { | |||
12 | VIDEO_LANGUAGE, | 12 | VIDEO_LANGUAGE, |
13 | VIDEO_DESCRIPTION, | 13 | VIDEO_DESCRIPTION, |
14 | VIDEO_TAGS, | 14 | VIDEO_TAGS, |
15 | VIDEO_CHANNEL, | ||
15 | VIDEO_FILE | 16 | VIDEO_FILE |
16 | } from '../../shared' | 17 | } from '../../shared' |
17 | import { ServerService } from '../../core' | 18 | import { AuthService, ServerService } from '../../core' |
18 | import { VideoService } from '../shared' | 19 | import { VideoService } from '../shared' |
19 | import { VideoCreate } from '../../../../../shared' | 20 | import { VideoCreate } from '../../../../../shared' |
20 | import { HttpEventType, HttpResponse } from '@angular/common/http' | 21 | import { HttpEventType, HttpResponse } from '@angular/common/http' |
@@ -33,6 +34,7 @@ export class VideoAddComponent extends FormReactive implements OnInit { | |||
33 | videoCategories = [] | 34 | videoCategories = [] |
34 | videoLicences = [] | 35 | videoLicences = [] |
35 | videoLanguages = [] | 36 | videoLanguages = [] |
37 | userVideoChannels = [] | ||
36 | 38 | ||
37 | tagValidators = VIDEO_TAGS.VALIDATORS | 39 | tagValidators = VIDEO_TAGS.VALIDATORS |
38 | tagValidatorsMessages = VIDEO_TAGS.MESSAGES | 40 | tagValidatorsMessages = VIDEO_TAGS.MESSAGES |
@@ -44,6 +46,7 @@ export class VideoAddComponent extends FormReactive implements OnInit { | |||
44 | category: '', | 46 | category: '', |
45 | licence: '', | 47 | licence: '', |
46 | language: '', | 48 | language: '', |
49 | channelId: '', | ||
47 | description: '', | 50 | description: '', |
48 | videofile: '' | 51 | videofile: '' |
49 | } | 52 | } |
@@ -52,6 +55,7 @@ export class VideoAddComponent extends FormReactive implements OnInit { | |||
52 | category: VIDEO_CATEGORY.MESSAGES, | 55 | category: VIDEO_CATEGORY.MESSAGES, |
53 | licence: VIDEO_LICENCE.MESSAGES, | 56 | licence: VIDEO_LICENCE.MESSAGES, |
54 | language: VIDEO_LANGUAGE.MESSAGES, | 57 | language: VIDEO_LANGUAGE.MESSAGES, |
58 | channelId: VIDEO_CHANNEL.MESSAGES, | ||
55 | description: VIDEO_DESCRIPTION.MESSAGES, | 59 | description: VIDEO_DESCRIPTION.MESSAGES, |
56 | videofile: VIDEO_FILE.MESSAGES | 60 | videofile: VIDEO_FILE.MESSAGES |
57 | } | 61 | } |
@@ -60,6 +64,7 @@ export class VideoAddComponent extends FormReactive implements OnInit { | |||
60 | private formBuilder: FormBuilder, | 64 | private formBuilder: FormBuilder, |
61 | private router: Router, | 65 | private router: Router, |
62 | private notificationsService: NotificationsService, | 66 | private notificationsService: NotificationsService, |
67 | private authService: AuthService, | ||
63 | private serverService: ServerService, | 68 | private serverService: ServerService, |
64 | private videoService: VideoService | 69 | private videoService: VideoService |
65 | ) { | 70 | ) { |
@@ -77,6 +82,7 @@ export class VideoAddComponent extends FormReactive implements OnInit { | |||
77 | category: [ '', VIDEO_CATEGORY.VALIDATORS ], | 82 | category: [ '', VIDEO_CATEGORY.VALIDATORS ], |
78 | licence: [ '', VIDEO_LICENCE.VALIDATORS ], | 83 | licence: [ '', VIDEO_LICENCE.VALIDATORS ], |
79 | language: [ '', VIDEO_LANGUAGE.VALIDATORS ], | 84 | language: [ '', VIDEO_LANGUAGE.VALIDATORS ], |
85 | channelId: [ this.userVideoChannels[0].id, VIDEO_CHANNEL.VALIDATORS ], | ||
80 | description: [ '', VIDEO_DESCRIPTION.VALIDATORS ], | 86 | description: [ '', VIDEO_DESCRIPTION.VALIDATORS ], |
81 | videofile: [ '', VIDEO_FILE.VALIDATORS ], | 87 | videofile: [ '', VIDEO_FILE.VALIDATORS ], |
82 | tags: [ '' ] | 88 | tags: [ '' ] |
@@ -90,6 +96,9 @@ export class VideoAddComponent extends FormReactive implements OnInit { | |||
90 | this.videoLicences = this.serverService.getVideoLicences() | 96 | this.videoLicences = this.serverService.getVideoLicences() |
91 | this.videoLanguages = this.serverService.getVideoLanguages() | 97 | this.videoLanguages = this.serverService.getVideoLanguages() |
92 | 98 | ||
99 | const user = this.authService.getUser() | ||
100 | this.userVideoChannels = user.videoChannels.map(v => ({ id: v.id, label: v.name })) | ||
101 | |||
93 | this.buildForm() | 102 | this.buildForm() |
94 | } | 103 | } |
95 | 104 | ||
@@ -122,6 +131,7 @@ export class VideoAddComponent extends FormReactive implements OnInit { | |||
122 | const category = formValue.category | 131 | const category = formValue.category |
123 | const licence = formValue.licence | 132 | const licence = formValue.licence |
124 | const language = formValue.language | 133 | const language = formValue.language |
134 | const channelId = formValue.channelId | ||
125 | const description = formValue.description | 135 | const description = formValue.description |
126 | const tags = formValue.tags | 136 | const tags = formValue.tags |
127 | const videofile = this.videofileInput.nativeElement.files[0] | 137 | const videofile = this.videofileInput.nativeElement.files[0] |
@@ -131,6 +141,7 @@ export class VideoAddComponent extends FormReactive implements OnInit { | |||
131 | formData.append('category', '' + category) | 141 | formData.append('category', '' + category) |
132 | formData.append('nsfw', '' + nsfw) | 142 | formData.append('nsfw', '' + nsfw) |
133 | formData.append('licence', '' + licence) | 143 | formData.append('licence', '' + licence) |
144 | formData.append('channelId', '' + channelId) | ||
134 | formData.append('videofile', videofile) | 145 | formData.append('videofile', videofile) |
135 | 146 | ||
136 | // Language is optional | 147 | // Language is optional |
diff --git a/client/src/app/videos/video-list/video-list.component.ts b/client/src/app/videos/video-list/video-list.component.ts index 4714ce01e..d2f0ae045 100644 --- a/client/src/app/videos/video-list/video-list.component.ts +++ b/client/src/app/videos/video-list/video-list.component.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { ChangeDetectorRef, Component, OnDestroy, OnInit } from '@angular/core' | 1 | import { Component, OnDestroy, OnInit } from '@angular/core' |
2 | import { ActivatedRoute, Router } from '@angular/router' | 2 | import { ActivatedRoute, Router } from '@angular/router' |
3 | import { Subscription } from 'rxjs/Subscription' | 3 | import { Subscription } from 'rxjs/Subscription' |
4 | import { BehaviorSubject } from 'rxjs/BehaviorSubject' | 4 | import { BehaviorSubject } from 'rxjs/BehaviorSubject' |
@@ -11,7 +11,6 @@ import { | |||
11 | VideoService, | 11 | VideoService, |
12 | VideoPagination | 12 | VideoPagination |
13 | } from '../shared' | 13 | } from '../shared' |
14 | import { AuthService, AuthUser } from '../../core' | ||
15 | import { Search, SearchField, SearchService } from '../../shared' | 14 | import { Search, SearchField, SearchService } from '../../shared' |
16 | 15 | ||
17 | @Component({ | 16 | @Component({ |
@@ -27,7 +26,6 @@ export class VideoListComponent implements OnInit, OnDestroy { | |||
27 | totalItems: null | 26 | totalItems: null |
28 | } | 27 | } |
29 | sort: SortField | 28 | sort: SortField |
30 | user: AuthUser = null | ||
31 | videos: Video[] = [] | 29 | videos: Video[] = [] |
32 | 30 | ||
33 | private search: Search | 31 | private search: Search |
@@ -36,8 +34,6 @@ export class VideoListComponent implements OnInit, OnDestroy { | |||
36 | 34 | ||
37 | constructor ( | 35 | constructor ( |
38 | private notificationsService: NotificationsService, | 36 | private notificationsService: NotificationsService, |
39 | private authService: AuthService, | ||
40 | private changeDetector: ChangeDetectorRef, | ||
41 | private router: Router, | 37 | private router: Router, |
42 | private route: ActivatedRoute, | 38 | private route: ActivatedRoute, |
43 | private videoService: VideoService, | 39 | private videoService: VideoService, |
@@ -45,10 +41,6 @@ export class VideoListComponent implements OnInit, OnDestroy { | |||
45 | ) {} | 41 | ) {} |
46 | 42 | ||
47 | ngOnInit () { | 43 | ngOnInit () { |
48 | if (this.authService.isLoggedIn()) { | ||
49 | this.user = AuthUser.load() | ||
50 | } | ||
51 | |||
52 | // Subscribe to route changes | 44 | // Subscribe to route changes |
53 | this.subActivatedRoute = this.route.params.subscribe(routeParams => { | 45 | this.subActivatedRoute = this.route.params.subscribe(routeParams => { |
54 | this.loadRouteParams(routeParams) | 46 | this.loadRouteParams(routeParams) |