aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app
diff options
context:
space:
mode:
authorFlorian CUNY <poslovitch@bentobox.world>2021-10-26 16:42:10 +0200
committerGitHub <noreply@github.com>2021-10-26 16:42:10 +0200
commit754b6f5f41bdc40aaaeefdb3c351666c305abe20 (patch)
treed36c8081f3137f1e2c9763879f71d41aa9a3efc1 /client/src/app
parent615836dbd4f48fc563551446529fa9d3b14dc329 (diff)
downloadPeerTube-754b6f5f41bdc40aaaeefdb3c351666c305abe20.tar.gz
PeerTube-754b6f5f41bdc40aaaeefdb3c351666c305abe20.tar.zst
PeerTube-754b6f5f41bdc40aaaeefdb3c351666c305abe20.zip
Made the video channels limit (per user) server-wide configurable (#4491)
* Made the video channels limit (per user) server-wide configurable Implements https://github.com/Chocobozzz/PeerTube/issues/3092 Also added a "quota bar" in the account's settings page * Fixed lint errors * Another pass at fixing lint errors * Applied code suggestions * Removed 'video channels quota'
Diffstat (limited to 'client/src/app')
-rw-r--r--client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.html22
-rw-r--r--client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts6
-rw-r--r--client/src/app/shared/form-validators/custom-config-validators.ts9
-rw-r--r--client/src/app/shared/shared-main/shared-main.module.ts7
4 files changed, 42 insertions, 2 deletions
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.html b/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.html
index 537e06d4d..318c8e2c2 100644
--- a/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.html
+++ b/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.html
@@ -272,6 +272,28 @@
272 </div> 272 </div>
273 </div> 273 </div>
274 274
275 <div class="form-row mt-4"> <!-- video channels grid -->
276 <div class="form-group col-12 col-lg-4 col-xl-3">
277 <div i18n class="inner-form-title">VIDEO CHANNELS</div>
278 </div>
279
280 <div class="form-group form-group-right col-12 col-lg-8 col-xl-9">
281 <div class="form-group" formGroupName="videoChannels">
282 <label i18n for="videoChannelsMaxPerUser">Max video channels per user</label>
283
284 <div class="number-with-unit">
285 <input
286 type="number" min="1" id="videoChannelsMaxPerUser" class="form-control"
287 formControlName="maxPerUser" [ngClass]="{ 'input-error': formErrors['videoChannels.maxPerUser'] }"
288 >
289 <span i18n>{form.value['videoChannels']['maxPerUser'], plural, =1 {channel} other {channels}}</span>
290 </div>
291
292 <div *ngIf="formErrors.videoChannels.maxPerUser" class="form-error">{{ formErrors.videoChannels.maxPerUser }}</div>
293 </div>
294 </div>
295 </div>
296
275 <div class="form-row mt-4"> <!-- search grid --> 297 <div class="form-row mt-4"> <!-- search grid -->
276 <div class="form-group col-12 col-lg-4 col-xl-3"> 298 <div class="form-group col-12 col-lg-4 col-xl-3">
277 <div i18n class="inner-form-title">SEARCH</div> 299 <div i18n class="inner-form-title">SEARCH</div>
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 96c67fac7..fdb0a7532 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
@@ -22,7 +22,8 @@ import {
22 SERVICES_TWITTER_USERNAME_VALIDATOR, 22 SERVICES_TWITTER_USERNAME_VALIDATOR,
23 SIGNUP_LIMIT_VALIDATOR, 23 SIGNUP_LIMIT_VALIDATOR,
24 SIGNUP_MINIMUM_AGE_VALIDATOR, 24 SIGNUP_MINIMUM_AGE_VALIDATOR,
25 TRANSCODING_THREADS_VALIDATOR 25 TRANSCODING_THREADS_VALIDATOR,
26 MAX_VIDEO_CHANNELS_PER_USER_VALIDATOR
26} from '@app/shared/form-validators/custom-config-validators' 27} from '@app/shared/form-validators/custom-config-validators'
27import { USER_VIDEO_QUOTA_DAILY_VALIDATOR, USER_VIDEO_QUOTA_VALIDATOR } from '@app/shared/form-validators/user-validators' 28import { USER_VIDEO_QUOTA_DAILY_VALIDATOR, USER_VIDEO_QUOTA_VALIDATOR } from '@app/shared/form-validators/user-validators'
28import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' 29import { FormReactive, FormValidatorService } from '@app/shared/shared-forms'
@@ -151,6 +152,9 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
151 videoQuota: USER_VIDEO_QUOTA_VALIDATOR, 152 videoQuota: USER_VIDEO_QUOTA_VALIDATOR,
152 videoQuotaDaily: USER_VIDEO_QUOTA_DAILY_VALIDATOR 153 videoQuotaDaily: USER_VIDEO_QUOTA_DAILY_VALIDATOR
153 }, 154 },
155 videoChannels: {
156 maxPerUser: MAX_VIDEO_CHANNELS_PER_USER_VALIDATOR
157 },
154 transcoding: { 158 transcoding: {
155 enabled: null, 159 enabled: null,
156 threads: TRANSCODING_THREADS_VALIDATOR, 160 threads: TRANSCODING_THREADS_VALIDATOR,
diff --git a/client/src/app/shared/form-validators/custom-config-validators.ts b/client/src/app/shared/form-validators/custom-config-validators.ts
index fbf423d08..ba8512e95 100644
--- a/client/src/app/shared/form-validators/custom-config-validators.ts
+++ b/client/src/app/shared/form-validators/custom-config-validators.ts
@@ -98,6 +98,15 @@ export const MAX_USER_LIVES_VALIDATOR: BuildFormValidator = {
98 } 98 }
99} 99}
100 100
101export const MAX_VIDEO_CHANNELS_PER_USER_VALIDATOR: BuildFormValidator = {
102 VALIDATORS: [ Validators.required, Validators.min(1), Validators.pattern('[0-9]+') ],
103 MESSAGES: {
104 required: $localize`Max video channels per user is required.`,
105 min: $localize`Max video channels per user must be greater or equal to 1.`,
106 pattern: $localize`Max video channels per user must be a number.`
107 }
108}
109
101export const CONCURRENCY_VALIDATOR: BuildFormValidator = { 110export const CONCURRENCY_VALIDATOR: BuildFormValidator = {
102 VALIDATORS: [ Validators.required, Validators.min(1) ], 111 VALIDATORS: [ Validators.required, Validators.min(1) ],
103 MESSAGES: { 112 MESSAGES: {
diff --git a/client/src/app/shared/shared-main/shared-main.module.ts b/client/src/app/shared/shared-main/shared-main.module.ts
index 80d0a84f3..93989780d 100644
--- a/client/src/app/shared/shared-main/shared-main.module.ts
+++ b/client/src/app/shared/shared-main/shared-main.module.ts
@@ -43,7 +43,12 @@ import {
43} from './misc' 43} from './misc'
44import { PluginPlaceholderComponent } from './plugins' 44import { PluginPlaceholderComponent } from './plugins'
45import { ActorRedirectGuard } from './router' 45import { ActorRedirectGuard } from './router'
46import { UserHistoryService, UserNotificationsComponent, UserNotificationService, UserQuotaComponent } from './users' 46import {
47 UserHistoryService,
48 UserNotificationsComponent,
49 UserNotificationService,
50 UserQuotaComponent
51} from './users'
47import { RedundancyService, VideoImportService, VideoOwnershipService, VideoService } from './video' 52import { RedundancyService, VideoImportService, VideoOwnershipService, VideoService } from './video'
48import { VideoCaptionService } from './video-caption' 53import { VideoCaptionService } from './video-caption'
49import { VideoChannelService } from './video-channel' 54import { VideoChannelService } from './video-channel'