Fix setting max channel sync in config
Signed-off-by: Chocobozzz <me@florianbigard.com>
This commit is contained in:
parent
d6eb99edb2
commit
a253a8088a
|
@ -321,6 +321,20 @@
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</my-peertube-checkbox>
|
</my-peertube-checkbox>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label i18n for="videoChannelSynchronizationMaxPerUser">Max channel synchronization per user</label>
|
||||||
|
|
||||||
|
<div class="number-with-unit">
|
||||||
|
<input
|
||||||
|
type="number" min="1" id="videoChannelSynchronizationMaxPerUser" class="form-control"
|
||||||
|
formControlName="maxPerUser" [ngClass]="{ 'input-error': formErrors['import']['videoChannelSynchronization']['maxPerUser'] }"
|
||||||
|
>
|
||||||
|
<span i18n>{form.value['import']['videoChannelSynchronization']['maxPerUser'], plural, =1 {sync} other {syncs}}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div *ngIf="formErrors.import.videoChannelSynchronization.maxPerUser" class="form-error" role="alert">{{ formErrors.import.videoChannelSynchronization.maxPerUser }}</div>
|
||||||
|
</div>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
|
@ -16,6 +16,7 @@ import {
|
||||||
INSTANCE_SHORT_DESCRIPTION_VALIDATOR,
|
INSTANCE_SHORT_DESCRIPTION_VALIDATOR,
|
||||||
MAX_INSTANCE_LIVES_VALIDATOR,
|
MAX_INSTANCE_LIVES_VALIDATOR,
|
||||||
MAX_LIVE_DURATION_VALIDATOR,
|
MAX_LIVE_DURATION_VALIDATOR,
|
||||||
|
MAX_SYNC_PER_USER,
|
||||||
MAX_USER_LIVES_VALIDATOR,
|
MAX_USER_LIVES_VALIDATOR,
|
||||||
MAX_VIDEO_CHANNELS_PER_USER_VALIDATOR,
|
MAX_VIDEO_CHANNELS_PER_USER_VALIDATOR,
|
||||||
SEARCH_INDEX_URL_VALIDATOR,
|
SEARCH_INDEX_URL_VALIDATOR,
|
||||||
|
@ -182,7 +183,9 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
videoChannelSynchronization: {
|
videoChannelSynchronization: {
|
||||||
enabled: null
|
enabled: null,
|
||||||
|
maxPerUser: MAX_SYNC_PER_USER
|
||||||
|
|
||||||
},
|
},
|
||||||
users: {
|
users: {
|
||||||
enabled: null
|
enabled: null
|
||||||
|
|
|
@ -77,6 +77,7 @@ export class RestExtractor {
|
||||||
}
|
}
|
||||||
|
|
||||||
private buildErrorMessage (err: any) {
|
private buildErrorMessage (err: any) {
|
||||||
|
console.log(err)
|
||||||
if (err.error instanceof Error) {
|
if (err.error instanceof Error) {
|
||||||
// A client-side or network error occurred. Handle it accordingly.
|
// A client-side or network error occurred. Handle it accordingly.
|
||||||
const errorMessage = err.error.detail || err.error.title
|
const errorMessage = err.error.detail || err.error.title
|
||||||
|
@ -115,10 +116,6 @@ export class RestExtractor {
|
||||||
.join('. ')
|
.join('. ')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (err.error?.error) {
|
|
||||||
return err.error.error
|
|
||||||
}
|
|
||||||
|
|
||||||
if (err.status === HttpStatusCode.PAYLOAD_TOO_LARGE_413) {
|
if (err.status === HttpStatusCode.PAYLOAD_TOO_LARGE_413) {
|
||||||
return $localize`Media is too large for the server. Please contact you administrator if you want to increase the limit size.`
|
return $localize`Media is too large for the server. Please contact you administrator if you want to increase the limit size.`
|
||||||
}
|
}
|
||||||
|
@ -142,6 +139,6 @@ export class RestExtractor {
|
||||||
return $localize`Server is unavailable. Please retry later.`
|
return $localize`Server is unavailable. Please retry later.`
|
||||||
}
|
}
|
||||||
|
|
||||||
return $localize`Unknown server error`
|
return err.error?.error || err.error?.detail || err.error?.title || $localize`Unknown server error`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,6 +106,15 @@ export const MAX_VIDEO_CHANNELS_PER_USER_VALIDATOR: BuildFormValidator = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const MAX_SYNC_PER_USER: BuildFormValidator = {
|
||||||
|
VALIDATORS: [ Validators.required, Validators.min(1), Validators.pattern('[0-9]+') ],
|
||||||
|
MESSAGES: {
|
||||||
|
required: $localize`Max synchronizations per user is required.`,
|
||||||
|
min: $localize`Max synchronizations per user must be greater or equal to 1.`,
|
||||||
|
pattern: $localize`Max synchronizations per user must be a number.`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export const CONCURRENCY_VALIDATOR: BuildFormValidator = {
|
export const CONCURRENCY_VALIDATOR: BuildFormValidator = {
|
||||||
VALIDATORS: [ Validators.required, Validators.min(1) ],
|
VALIDATORS: [ Validators.required, Validators.min(1) ],
|
||||||
MESSAGES: {
|
MESSAGES: {
|
||||||
|
|
Loading…
Reference in New Issue