From 45ba09fef3b970fb916ffb1b0ac7509db7bbdde6 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 10 Feb 2021 12:06:26 +0100 Subject: Improve edit config submit error --- .../edit-custom-config.component.html | 13 +++++++++---- .../edit-custom-config.component.ts | 19 +++++++++++++++++++ .../edit-live-configuration.component.html | 6 ++++++ 3 files changed, 34 insertions(+), 4 deletions(-) (limited to 'client/src/app/+admin') 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 4596a130e..b6365614d 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 @@ -54,11 +54,16 @@
- - It seems like the configuration is invalid. Please search for potential errors in the different tabs. - {{ formErrors }} - +
+ There are errors in the form: + +
    +
  • + {{ error }} +
  • +
+
You cannot allow live replay if you don't enable transcoding. 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 bbdf1bfbe..2c7a10937 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 @@ -290,6 +290,25 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { this.router.navigate([], { fragment: this.activeNav }) } + grabAllErrors (errorObjectArg?: any) { + const errorObject = errorObjectArg || this.formErrors + + let acc: string[] = [] + + for (const key of Object.keys(errorObject)) { + const value = errorObject[key] + if (!value) continue + + if (typeof value === 'string') { + acc.push(value) + } else { + acc = acc.concat(this.grabAllErrors(value)) + } + } + + return acc + } + private updateForm () { this.form.patchValue(this.customConfig) } diff --git a/client/src/app/+admin/config/edit-custom-config/edit-live-configuration.component.html b/client/src/app/+admin/config/edit-custom-config/edit-live-configuration.component.html index 65fc31412..5d826fbe9 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-live-configuration.component.html +++ b/client/src/app/+admin/config/edit-custom-config/edit-live-configuration.component.html @@ -45,6 +45,8 @@ {form.value['live']['maxInstanceLives'], plural, =1 {live} other {lives}}
+ +
{{ formErrors.live.maxInstanceLives }}
@@ -56,6 +58,8 @@ {form.value['live']['maxUserLives'], plural, =1 {live} other {lives}}
+ +
{{ formErrors.live.maxUserLives }}
@@ -65,6 +69,8 @@ labelForId="liveMaxDuration" [items]="liveMaxDurationOptions" formControlName="maxDuration" bindLabel="label" bindValue="value" [clearable]="false" [searchable]="true" > + +
{{ formErrors.live.maxDuration }}
-- cgit v1.2.3