diff --git a/frontend/src/lib/components/InstanceSettings.svelte b/frontend/src/lib/components/InstanceSettings.svelte index a68b4dba8e..709ce62b78 100644 --- a/frontend/src/lib/components/InstanceSettings.svelte +++ b/frontend/src/lib/components/InstanceSettings.svelte @@ -27,7 +27,9 @@ key: 'base_url', fieldType: 'text', placeholder: 'https://windmill.com', - storage: 'setting' + storage: 'setting', + isValid: (value: string | undefined) => + value ? value?.startsWith('http') && !value?.endsWith('/') : true }, { label: 'Request Size Limit In MB', @@ -288,11 +290,15 @@ {setting.tooltip} {/if} {#if values} + {@const hasError = setting.isValid && !setting.isValid(values[setting.key])} {#if setting.fieldType == 'text'} {:else if setting.fieldType == 'textarea'} @@ -353,6 +359,13 @@ {/if} + + {#if hasError} + + Base url must start with http:// or https:// and must not end with a + trailing slash. + + {/if} {:else} {/if} @@ -491,6 +504,8 @@ on:click={async () => { await saveSettings() sendUserToast('Settings updated') - }}>Save + Save +
diff --git a/frontend/src/lib/components/SuperadminSettings.svelte b/frontend/src/lib/components/SuperadminSettings.svelte index 20d646e56a..7742cf1dad 100644 --- a/frontend/src/lib/components/SuperadminSettings.svelte +++ b/frontend/src/lib/components/SuperadminSettings.svelte @@ -139,7 +139,7 @@
-
+
diff --git a/frontend/src/lib/components/instanceSettings.ts b/frontend/src/lib/components/instanceSettings.ts index 4dae6f3c82..02857bf316 100644 --- a/frontend/src/lib/components/instanceSettings.ts +++ b/frontend/src/lib/components/instanceSettings.ts @@ -17,6 +17,7 @@ export interface Setting { | 'email' | 'license_key' storage: SettingStorage + isValid?: (value: any) => boolean } export type SettingStorage = 'setting' | 'config'