diff options
author | Felix Ableitner <me@nutomic.com> | 2018-08-28 02:01:35 -0500 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-08-28 09:01:35 +0200 |
commit | bee0abffff73804d816b90c7fd599e0a51c09d61 (patch) | |
tree | fae6d58637f9c63a3800090277f8e130b43442dd /client/src/app/+admin/config/edit-custom-config | |
parent | c907c2fa3fd7c0a741117a0204d0ebca675124bd (diff) | |
download | PeerTube-bee0abffff73804d816b90c7fd599e0a51c09d61.tar.gz PeerTube-bee0abffff73804d816b90c7fd599e0a51c09d61.tar.zst PeerTube-bee0abffff73804d816b90c7fd599e0a51c09d61.zip |
Implement daily upload limit (#956)
* Implement daily upload limit (ref #652)
* remove duplicate code
* review fixes
* fix tests?
* whitespace fixes, finish leftover todo
* fix tests
* added some new tests
* use different config value for tests
* remove todo
Diffstat (limited to 'client/src/app/+admin/config/edit-custom-config')
-rw-r--r-- | client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html | 14 | ||||
-rw-r--r-- | client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts | 24 |
2 files changed, 33 insertions, 5 deletions
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html index 49b89cef4..ca7890d84 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html | |||
@@ -142,6 +142,20 @@ | |||
142 | {{ formErrors.userVideoQuota }} | 142 | {{ formErrors.userVideoQuota }} |
143 | </div> | 143 | </div> |
144 | </div> | 144 | </div> |
145 | |||
146 | <div class="form-group"> | ||
147 | <label i18n for="userVideoQuotaDaily">User default daily upload limit</label> | ||
148 | <div class="peertube-select-container"> | ||
149 | <select id="userVideoQuotaDaily" formControlName="userVideoQuotaDaily"> | ||
150 | <option *ngFor="let videoQuotaDailyOption of videoQuotaDailyOptions" [value]="videoQuotaDailyOption.value"> | ||
151 | {{ videoQuotaDailyOption.label }} | ||
152 | </option> | ||
153 | </select> | ||
154 | </div> | ||
155 | <div *ngIf="formErrors.userVideoQuotaDaily" class="form-error"> | ||
156 | {{ formErrors.userVideoQuotaDaily }} | ||
157 | </div> | ||
158 | </div> | ||
145 | </ng-template> | 159 | </ng-template> |
146 | </ngb-tab> | 160 | </ngb-tab> |
147 | 161 | ||
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts index fd6784415..3b6dabcb9 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts | |||
@@ -15,10 +15,7 @@ import { BuildFormDefaultValues, FormValidatorService } from '@app/shared/forms/ | |||
15 | styleUrls: [ './edit-custom-config.component.scss' ] | 15 | styleUrls: [ './edit-custom-config.component.scss' ] |
16 | }) | 16 | }) |
17 | export class EditCustomConfigComponent extends FormReactive implements OnInit { | 17 | export class EditCustomConfigComponent extends FormReactive implements OnInit { |
18 | customConfig: CustomConfig | 18 | static videoQuotaOptions = [ |
19 | resolutions = [ '240p', '360p', '480p', '720p', '1080p' ] | ||
20 | |||
21 | videoQuotaOptions = [ | ||
22 | { value: -1, label: 'Unlimited' }, | 19 | { value: -1, label: 'Unlimited' }, |
23 | { value: 0, label: '0' }, | 20 | { value: 0, label: '0' }, |
24 | { value: 100 * 1024 * 1024, label: '100MB' }, | 21 | { value: 100 * 1024 * 1024, label: '100MB' }, |
@@ -28,6 +25,20 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { | |||
28 | { value: 20 * 1024 * 1024 * 1024, label: '20GB' }, | 25 | { value: 20 * 1024 * 1024 * 1024, label: '20GB' }, |
29 | { value: 50 * 1024 * 1024 * 1024, label: '50GB' } | 26 | { value: 50 * 1024 * 1024 * 1024, label: '50GB' } |
30 | ] | 27 | ] |
28 | static videoQuotaDailyOptions = [ | ||
29 | { value: -1, label: 'Unlimited' }, | ||
30 | { value: 0, label: '0' }, | ||
31 | { value: 10 * 1024 * 1024, label: '10MB' }, | ||
32 | { value: 50 * 1024 * 1024, label: '50MB' }, | ||
33 | { value: 100 * 1024 * 1024, label: '100MB' }, | ||
34 | { value: 500 * 1024 * 1024, label: '500MB' }, | ||
35 | { value: 2 * 1024 * 1024 * 1024, label: '2GB' }, | ||
36 | { value: 5 * 1024 * 1024 * 1024, label: '5GB' } | ||
37 | ] | ||
38 | |||
39 | customConfig: CustomConfig | ||
40 | resolutions = [ '240p', '360p', '480p', '720p', '1080p' ] | ||
41 | |||
31 | transcodingThreadOptions = [ | 42 | transcodingThreadOptions = [ |
32 | { value: 0, label: 'Auto (via ffmpeg)' }, | 43 | { value: 0, label: 'Auto (via ffmpeg)' }, |
33 | { value: 1, label: '1' }, | 44 | { value: 1, label: '1' }, |
@@ -75,6 +86,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { | |||
75 | importVideosTorrentEnabled: null, | 86 | importVideosTorrentEnabled: null, |
76 | adminEmail: this.customConfigValidatorsService.ADMIN_EMAIL, | 87 | adminEmail: this.customConfigValidatorsService.ADMIN_EMAIL, |
77 | userVideoQuota: this.userValidatorsService.USER_VIDEO_QUOTA, | 88 | userVideoQuota: this.userValidatorsService.USER_VIDEO_QUOTA, |
89 | userVideoQuotaDaily: this.userValidatorsService.USER_VIDEO_QUOTA_DAILY, | ||
78 | transcodingThreads: this.customConfigValidatorsService.TRANSCODING_THREADS, | 90 | transcodingThreads: this.customConfigValidatorsService.TRANSCODING_THREADS, |
79 | transcodingEnabled: null, | 91 | transcodingEnabled: null, |
80 | customizationJavascript: null, | 92 | customizationJavascript: null, |
@@ -173,7 +185,8 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { | |||
173 | email: this.form.value['adminEmail'] | 185 | email: this.form.value['adminEmail'] |
174 | }, | 186 | }, |
175 | user: { | 187 | user: { |
176 | videoQuota: this.form.value['userVideoQuota'] | 188 | videoQuota: this.form.value['userVideoQuota'], |
189 | videoQuotaDaily: this.form.value['userVideoQuotaDaily'] | ||
177 | }, | 190 | }, |
178 | transcoding: { | 191 | transcoding: { |
179 | enabled: this.form.value['transcodingEnabled'], | 192 | enabled: this.form.value['transcodingEnabled'], |
@@ -231,6 +244,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { | |||
231 | signupLimit: this.customConfig.signup.limit, | 244 | signupLimit: this.customConfig.signup.limit, |
232 | adminEmail: this.customConfig.admin.email, | 245 | adminEmail: this.customConfig.admin.email, |
233 | userVideoQuota: this.customConfig.user.videoQuota, | 246 | userVideoQuota: this.customConfig.user.videoQuota, |
247 | userVideoQuotaDaily: this.customConfig.user.videoQuotaDaily, | ||
234 | transcodingThreads: this.customConfig.transcoding.threads, | 248 | transcodingThreads: this.customConfig.transcoding.threads, |
235 | transcodingEnabled: this.customConfig.transcoding.enabled, | 249 | transcodingEnabled: this.customConfig.transcoding.enabled, |
236 | customizationJavascript: this.customConfig.instance.customizations.javascript, | 250 | customizationJavascript: this.customConfig.instance.customizations.javascript, |