aboutsummaryrefslogtreecommitdiffhomepage
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/src/app/+admin/users/user-edit/user-add.component.ts5
-rw-r--r--client/src/app/+admin/users/user-edit/user-edit.component.html5
-rw-r--r--client/src/app/+admin/users/user-edit/user-edit.component.scss4
-rw-r--r--client/src/app/+admin/users/user-edit/user-edit.ts24
-rw-r--r--client/src/app/+admin/users/user-edit/user-update.component.ts7
-rw-r--r--client/src/app/core/server/server.service.ts3
6 files changed, 44 insertions, 4 deletions
diff --git a/client/src/app/+admin/users/user-edit/user-add.component.ts b/client/src/app/+admin/users/user-edit/user-add.component.ts
index 5dc069104..6d8151b42 100644
--- a/client/src/app/+admin/users/user-edit/user-add.component.ts
+++ b/client/src/app/+admin/users/user-edit/user-add.component.ts
@@ -11,12 +11,14 @@ import {
11 USER_PASSWORD, 11 USER_PASSWORD,
12 USER_VIDEO_QUOTA 12 USER_VIDEO_QUOTA
13} from '../../../shared' 13} from '../../../shared'
14import { ServerService } from '../../../core'
14import { UserCreate } from '../../../../../../shared' 15import { UserCreate } from '../../../../../../shared'
15import { UserEdit } from './user-edit' 16import { UserEdit } from './user-edit'
16 17
17@Component({ 18@Component({
18 selector: 'my-user-add', 19 selector: 'my-user-add',
19 templateUrl: './user-edit.component.html' 20 templateUrl: './user-edit.component.html',
21 styleUrls: [ './user-edit.component.scss' ]
20}) 22})
21export class UserAddComponent extends UserEdit implements OnInit { 23export class UserAddComponent extends UserEdit implements OnInit {
22 error: string 24 error: string
@@ -36,6 +38,7 @@ export class UserAddComponent extends UserEdit implements OnInit {
36 } 38 }
37 39
38 constructor ( 40 constructor (
41 protected serverService: ServerService,
39 private formBuilder: FormBuilder, 42 private formBuilder: FormBuilder,
40 private router: Router, 43 private router: Router,
41 private notificationsService: NotificationsService, 44 private notificationsService: NotificationsService,
diff --git a/client/src/app/+admin/users/user-edit/user-edit.component.html b/client/src/app/+admin/users/user-edit/user-edit.component.html
index 0e23cb731..6988071ce 100644
--- a/client/src/app/+admin/users/user-edit/user-edit.component.html
+++ b/client/src/app/+admin/users/user-edit/user-edit.component.html
@@ -47,6 +47,11 @@
47 {{ videoQuotaOption.label }} 47 {{ videoQuotaOption.label }}
48 </option> 48 </option>
49 </select> 49 </select>
50
51 <div class="transcoding-information" *ngIf="isTranscodingInformationDisplayed()">
52 Transcoding is enabled on server. The video quota only take in account <strong>original</strong> video. <br />
53 In maximum, this user could use ~ {{ computeQuotaWithTranscoding() | bytes }}.
54 </div>
50 </div> 55 </div>
51 56
52 <input type="submit" value="{{ getFormButtonTitle() }}" class="btn btn-default" [disabled]="!form.valid"> 57 <input type="submit" value="{{ getFormButtonTitle() }}" class="btn btn-default" [disabled]="!form.valid">
diff --git a/client/src/app/+admin/users/user-edit/user-edit.component.scss b/client/src/app/+admin/users/user-edit/user-edit.component.scss
new file mode 100644
index 000000000..401caa0c6
--- /dev/null
+++ b/client/src/app/+admin/users/user-edit/user-edit.component.scss
@@ -0,0 +1,4 @@
1.transcoding-information {
2 margin-top: 5px;
3 font-size: 11px;
4}
diff --git a/client/src/app/+admin/users/user-edit/user-edit.ts b/client/src/app/+admin/users/user-edit/user-edit.ts
index 657c0f1c0..76497c9b6 100644
--- a/client/src/app/+admin/users/user-edit/user-edit.ts
+++ b/client/src/app/+admin/users/user-edit/user-edit.ts
@@ -1,17 +1,39 @@
1import { ServerService } from '../../../core'
1import { FormReactive } from '../../../shared' 2import { FormReactive } from '../../../shared'
3import { VideoResolution } from '../../../../../../shared/models/videos/video-resolution.enum'
2 4
3export abstract class UserEdit extends FormReactive { 5export abstract class UserEdit extends FormReactive {
4 videoQuotaOptions = [ 6 videoQuotaOptions = [
5 { value: -1, label: 'Unlimited' }, 7 { value: -1, label: 'Unlimited' },
6 { value: 0, label: '0'}, 8 { value: 0, label: '0'},
7 { value: 100 * 1024 * 1024, label: '100MB' }, 9 { value: 100 * 1024 * 1024, label: '100MB' },
8 { value: 5 * 1024 * 1024, label: '500MB' }, 10 { value: 500 * 1024 * 1024, label: '500MB' },
9 { value: 1024 * 1024 * 1024, label: '1GB' }, 11 { value: 1024 * 1024 * 1024, label: '1GB' },
10 { value: 5 * 1024 * 1024 * 1024, label: '5GB' }, 12 { value: 5 * 1024 * 1024 * 1024, label: '5GB' },
11 { value: 20 * 1024 * 1024 * 1024, label: '20GB' }, 13 { value: 20 * 1024 * 1024 * 1024, label: '20GB' },
12 { value: 50 * 1024 * 1024 * 1024, label: '50GB' } 14 { value: 50 * 1024 * 1024 * 1024, label: '50GB' }
13 ] 15 ]
14 16
17 protected abstract serverService: ServerService
15 abstract isCreation (): boolean 18 abstract isCreation (): boolean
16 abstract getFormButtonTitle (): string 19 abstract getFormButtonTitle (): string
20
21 isTranscodingInformationDisplayed () {
22 const formVideoQuota = parseInt(this.form.value['videoQuota'], 10)
23
24 return this.serverService.getConfig().transcoding.enabledResolutions.length !== 0 &&
25 formVideoQuota > 0
26 }
27
28 computeQuotaWithTranscoding () {
29 const resolutions = this.serverService.getConfig().transcoding.enabledResolutions
30 const higherResolution = VideoResolution.H_1080P
31 let multiplier = 0
32
33 for (const resolution of resolutions) {
34 multiplier += resolution / higherResolution
35 }
36
37 return multiplier * parseInt(this.form.value['videoQuota'], 10)
38 }
17} 39}
diff --git a/client/src/app/+admin/users/user-edit/user-update.component.ts b/client/src/app/+admin/users/user-edit/user-update.component.ts
index 0966981c0..bd901e655 100644
--- a/client/src/app/+admin/users/user-edit/user-update.component.ts
+++ b/client/src/app/+admin/users/user-edit/user-update.component.ts
@@ -7,13 +7,15 @@ import { NotificationsService } from 'angular2-notifications'
7 7
8import { UserService } from '../shared' 8import { UserService } from '../shared'
9import { USER_EMAIL, USER_VIDEO_QUOTA } from '../../../shared' 9import { USER_EMAIL, USER_VIDEO_QUOTA } from '../../../shared'
10import { ServerService } from '../../../core'
10import { UserUpdate } from '../../../../../../shared/models/users/user-update.model' 11import { UserUpdate } from '../../../../../../shared/models/users/user-update.model'
11import { User } from '../../../shared/users/user.model' 12import { User } from '../../../shared/users/user.model'
12import { UserEdit } from './user-edit' 13import { UserEdit } from './user-edit'
13 14
14@Component({ 15@Component({
15 selector: 'my-user-update', 16 selector: 'my-user-update',
16 templateUrl: './user-edit.component.html' 17 templateUrl: './user-edit.component.html',
18 styleUrls: [ './user-edit.component.scss' ]
17}) 19})
18export class UserUpdateComponent extends UserEdit implements OnInit, OnDestroy { 20export class UserUpdateComponent extends UserEdit implements OnInit, OnDestroy {
19 error: string 21 error: string
@@ -33,10 +35,11 @@ export class UserUpdateComponent extends UserEdit implements OnInit, OnDestroy {
33 private paramsSub: Subscription 35 private paramsSub: Subscription
34 36
35 constructor ( 37 constructor (
36 private formBuilder: FormBuilder, 38 protected serverService: ServerService,
37 private route: ActivatedRoute, 39 private route: ActivatedRoute,
38 private router: Router, 40 private router: Router,
39 private notificationsService: NotificationsService, 41 private notificationsService: NotificationsService,
42 private formBuilder: FormBuilder,
40 private userService: UserService 43 private userService: UserService
41 ) { 44 ) {
42 super() 45 super()
diff --git a/client/src/app/core/server/server.service.ts b/client/src/app/core/server/server.service.ts
index f24df5a89..ae507afce 100644
--- a/client/src/app/core/server/server.service.ts
+++ b/client/src/app/core/server/server.service.ts
@@ -11,6 +11,9 @@ export class ServerService {
11 private config: ServerConfig = { 11 private config: ServerConfig = {
12 signup: { 12 signup: {
13 allowed: false 13 allowed: false
14 },
15 transcoding: {
16 enabledResolutions: []
14 } 17 }
15 } 18 }
16 private videoCategories: Array<{ id: number, label: string }> = [] 19 private videoCategories: Array<{ id: number, label: string }> = []