diff options
Diffstat (limited to 'client/src/app/+admin/users/user-add/user-add.component.ts')
-rw-r--r-- | client/src/app/+admin/users/user-add/user-add.component.ts | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/client/src/app/+admin/users/user-add/user-add.component.ts b/client/src/app/+admin/users/user-add/user-add.component.ts index 0dd99eccd..91377a933 100644 --- a/client/src/app/+admin/users/user-add/user-add.component.ts +++ b/client/src/app/+admin/users/user-add/user-add.component.ts | |||
@@ -9,7 +9,8 @@ import { | |||
9 | FormReactive, | 9 | FormReactive, |
10 | USER_USERNAME, | 10 | USER_USERNAME, |
11 | USER_EMAIL, | 11 | USER_EMAIL, |
12 | USER_PASSWORD | 12 | USER_PASSWORD, |
13 | USER_VIDEO_QUOTA | ||
13 | } from '../../../shared' | 14 | } from '../../../shared' |
14 | import { UserCreate } from '../../../../../../shared' | 15 | import { UserCreate } from '../../../../../../shared' |
15 | 16 | ||
@@ -24,12 +25,14 @@ export class UserAddComponent extends FormReactive implements OnInit { | |||
24 | formErrors = { | 25 | formErrors = { |
25 | 'username': '', | 26 | 'username': '', |
26 | 'email': '', | 27 | 'email': '', |
27 | 'password': '' | 28 | 'password': '', |
29 | 'videoQuota': '' | ||
28 | } | 30 | } |
29 | validationMessages = { | 31 | validationMessages = { |
30 | 'username': USER_USERNAME.MESSAGES, | 32 | 'username': USER_USERNAME.MESSAGES, |
31 | 'email': USER_EMAIL.MESSAGES, | 33 | 'email': USER_EMAIL.MESSAGES, |
32 | 'password': USER_PASSWORD.MESSAGES | 34 | 'password': USER_PASSWORD.MESSAGES, |
35 | 'videoQuota': USER_VIDEO_QUOTA.MESSAGES | ||
33 | } | 36 | } |
34 | 37 | ||
35 | constructor ( | 38 | constructor ( |
@@ -45,7 +48,8 @@ export class UserAddComponent extends FormReactive implements OnInit { | |||
45 | this.form = this.formBuilder.group({ | 48 | this.form = this.formBuilder.group({ |
46 | username: [ '', USER_USERNAME.VALIDATORS ], | 49 | username: [ '', USER_USERNAME.VALIDATORS ], |
47 | email: [ '', USER_EMAIL.VALIDATORS ], | 50 | email: [ '', USER_EMAIL.VALIDATORS ], |
48 | password: [ '', USER_PASSWORD.VALIDATORS ] | 51 | password: [ '', USER_PASSWORD.VALIDATORS ], |
52 | videoQuota: [ '-1', USER_VIDEO_QUOTA.VALIDATORS ] | ||
49 | }) | 53 | }) |
50 | 54 | ||
51 | this.form.valueChanges.subscribe(data => this.onValueChanged(data)) | 55 | this.form.valueChanges.subscribe(data => this.onValueChanged(data)) |
@@ -60,6 +64,9 @@ export class UserAddComponent extends FormReactive implements OnInit { | |||
60 | 64 | ||
61 | const userCreate: UserCreate = this.form.value | 65 | const userCreate: UserCreate = this.form.value |
62 | 66 | ||
67 | // A select in HTML is always mapped as a string, we convert it to number | ||
68 | userCreate.videoQuota = parseInt(this.form.value['videoQuota'], 10) | ||
69 | |||
63 | this.userService.addUser(userCreate).subscribe( | 70 | this.userService.addUser(userCreate).subscribe( |
64 | () => { | 71 | () => { |
65 | this.notificationsService.success('Success', `User ${userCreate.username} created.`) | 72 | this.notificationsService.success('Success', `User ${userCreate.username} created.`) |