diff options
Diffstat (limited to 'client/src/app/+admin/users')
4 files changed, 41 insertions, 34 deletions
diff --git a/client/src/app/+admin/users/user-edit/user-create.component.ts b/client/src/app/+admin/users/user-edit/user-create.component.ts index d0aac1cb9..da333240c 100644 --- a/client/src/app/+admin/users/user-edit/user-create.component.ts +++ b/client/src/app/+admin/users/user-edit/user-create.component.ts | |||
@@ -45,8 +45,8 @@ export class UserCreateComponent extends UserEdit implements OnInit { | |||
45 | 45 | ||
46 | const defaultValues = { | 46 | const defaultValues = { |
47 | role: UserRole.USER.toString(), | 47 | role: UserRole.USER.toString(), |
48 | videoQuota: '-1', | 48 | videoQuota: -1, |
49 | videoQuotaDaily: '-1' | 49 | videoQuotaDaily: -1 |
50 | } | 50 | } |
51 | 51 | ||
52 | this.buildForm({ | 52 | this.buildForm({ |
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 fb34d6b22..243c6556a 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 | |||
@@ -149,28 +149,38 @@ | |||
149 | 149 | ||
150 | <div class="form-group"> | 150 | <div class="form-group"> |
151 | <label i18n for="videoQuota">Video quota</label> | 151 | <label i18n for="videoQuota">Video quota</label> |
152 | <div class="peertube-select-container"> | 152 | |
153 | <select id="videoQuota" formControlName="videoQuota" class="form-control"> | 153 | <my-select-custom-value |
154 | <option *ngFor="let videoQuotaOption of videoQuotaOptions" [value]="videoQuotaOption.value" [disabled]="videoQuotaOption.disabled"> | 154 | id="videoQuota" |
155 | {{ videoQuotaOption.label }} | 155 | [items]="videoQuotaOptions" |
156 | </option> | 156 | formControlName="videoQuota" |
157 | </select> | 157 | i18n-inputSuffix inputSuffix="bytes" inputType="number" |
158 | </div> | 158 | [clearable]="false" |
159 | ></my-select-custom-value> | ||
159 | 160 | ||
160 | <div i18n class="transcoding-information" *ngIf="isTranscodingInformationDisplayed()"> | 161 | <div i18n class="transcoding-information" *ngIf="isTranscodingInformationDisplayed()"> |
161 | Transcoding is enabled. The video quota only takes into account <strong>original</strong> video size. <br /> | 162 | Transcoding is enabled. The video quota only takes into account <strong>original</strong> video size. <br /> |
162 | At most, this user could upload ~ {{ computeQuotaWithTranscoding() | bytes: 0 }}. | 163 | At most, this user could upload ~ {{ computeQuotaWithTranscoding() | bytes: 0 }}. |
163 | </div> | 164 | </div> |
165 | |||
166 | <div *ngIf="formErrors.videoQuota" class="form-error"> | ||
167 | {{ formErrors.videoQuota }} | ||
168 | </div> | ||
164 | </div> | 169 | </div> |
165 | 170 | ||
166 | <div class="form-group"> | 171 | <div class="form-group"> |
167 | <label i18n for="videoQuotaDaily">Daily video quota</label> | 172 | <label i18n for="videoQuotaDaily">Daily video quota</label> |
168 | <div class="peertube-select-container"> | 173 | |
169 | <select id="videoQuotaDaily" formControlName="videoQuotaDaily" class="form-control"> | 174 | <my-select-custom-value |
170 | <option *ngFor="let videoQuotaDailyOption of videoQuotaDailyOptions" [value]="videoQuotaDailyOption.value" [disabled]="videoQuotaDailyOption.disabled"> | 175 | id="videoQuotaDaily" |
171 | {{ videoQuotaDailyOption.label }} | 176 | [items]="videoQuotaDailyOptions" |
172 | </option> | 177 | formControlName="videoQuotaDaily" |
173 | </select> | 178 | i18n-inputSuffix inputSuffix="bytes" inputType="number" |
179 | [clearable]="false" | ||
180 | ></my-select-custom-value> | ||
181 | |||
182 | <div *ngIf="formErrors.videoQuotaDaily" class="form-error"> | ||
183 | {{ formErrors.videoQuotaDaily }} | ||
174 | </div> | 184 | </div> |
175 | </div> | 185 | </div> |
176 | 186 | ||
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 index 3b7715062..aa87b8d6d 100644 --- a/client/src/app/+admin/users/user-edit/user-edit.component.scss +++ b/client/src/app/+admin/users/user-edit/user-edit.component.scss | |||
@@ -1,6 +1,8 @@ | |||
1 | @import '_variables'; | 1 | @import '_variables'; |
2 | @import '_mixins'; | 2 | @import '_mixins'; |
3 | 3 | ||
4 | $form-base-input-width: 340px; | ||
5 | |||
4 | label { | 6 | label { |
5 | font-weight: $font-regular; | 7 | font-weight: $font-regular; |
6 | font-size: 100%; | 8 | font-size: 100%; |
@@ -15,18 +17,24 @@ label { | |||
15 | } | 17 | } |
16 | 18 | ||
17 | input:not([type=submit]) { | 19 | input:not([type=submit]) { |
18 | @include peertube-input-text(340px); | 20 | @include peertube-input-text($form-base-input-width); |
19 | display: block; | 21 | display: block; |
20 | } | 22 | } |
21 | 23 | ||
22 | my-input-toggle-hidden { | 24 | my-input-toggle-hidden { |
23 | @include responsive-width(340px); | 25 | @include responsive-width($form-base-input-width); |
24 | 26 | ||
25 | display: block; | 27 | display: block; |
26 | } | 28 | } |
27 | 29 | ||
28 | .peertube-select-container { | 30 | .peertube-select-container { |
29 | @include peertube-select-container(340px); | 31 | @include peertube-select-container($form-base-input-width); |
32 | } | ||
33 | |||
34 | my-select-custom-value { | ||
35 | @include responsive-width($form-base-input-width); | ||
36 | |||
37 | display: block; | ||
30 | } | 38 | } |
31 | 39 | ||
32 | input[type=submit], button { | 40 | input[type=submit], button { |
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 faa2f5ad8..2fc3c5d3b 100644 --- a/client/src/app/+admin/users/user-edit/user-edit.ts +++ b/client/src/app/+admin/users/user-edit/user-edit.ts | |||
@@ -4,12 +4,13 @@ import { AuthService, ScreenService, ServerService, User } from '@app/core' | |||
4 | import { FormReactive } from '@app/shared/shared-forms' | 4 | import { FormReactive } from '@app/shared/shared-forms' |
5 | import { USER_ROLE_LABELS } from '@shared/core-utils/users' | 5 | import { USER_ROLE_LABELS } from '@shared/core-utils/users' |
6 | import { ServerConfig, UserAdminFlag, UserRole, VideoResolution } from '@shared/models' | 6 | import { ServerConfig, UserAdminFlag, UserRole, VideoResolution } from '@shared/models' |
7 | import { SelectOptionsItem } from '../../../../types/select-options-item.model' | ||
7 | 8 | ||
8 | @Directive() | 9 | @Directive() |
9 | // tslint:disable-next-line: directive-class-suffix | 10 | // tslint:disable-next-line: directive-class-suffix |
10 | export abstract class UserEdit extends FormReactive implements OnInit { | 11 | export abstract class UserEdit extends FormReactive implements OnInit { |
11 | videoQuotaOptions: { value: string, label: string, disabled?: boolean }[] = [] | 12 | videoQuotaOptions: SelectOptionsItem[] = [] |
12 | videoQuotaDailyOptions: { value: string, label: string, disabled?: boolean }[] = [] | 13 | videoQuotaDailyOptions: SelectOptionsItem[] = [] |
13 | username: string | 14 | username: string |
14 | user: User | 15 | user: User |
15 | 16 | ||
@@ -97,19 +98,7 @@ export abstract class UserEdit extends FormReactive implements OnInit { | |||
97 | } | 98 | } |
98 | 99 | ||
99 | protected buildQuotaOptions () { | 100 | protected buildQuotaOptions () { |
100 | // These are used by a HTML select, so convert key into strings | 101 | this.videoQuotaOptions = this.configService.videoQuotaOptions |
101 | this.videoQuotaOptions = this.configService | 102 | this.videoQuotaDailyOptions = this.configService.videoQuotaDailyOptions |
102 | .videoQuotaOptions.map(q => ({ | ||
103 | value: q.value?.toString(), | ||
104 | label: q.label, | ||
105 | disabled: q.disabled | ||
106 | })) | ||
107 | |||
108 | this.videoQuotaDailyOptions = this.configService | ||
109 | .videoQuotaDailyOptions.map(q => ({ | ||
110 | value: q.value?.toString(), | ||
111 | label: q.label, | ||
112 | disabled: q.disabled | ||
113 | })) | ||
114 | } | 103 | } |
115 | } | 104 | } |