Skip to content

Commit

Permalink
Merge branch 'main' into style-panel-overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
fatonramadani authored Oct 11, 2023
2 parents fd5e7c3 + c914ac6 commit 3e98b2f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
19 changes: 17 additions & 2 deletions frontend/src/lib/components/InstanceSettings.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -288,11 +290,15 @@
<Tooltip>{setting.tooltip}</Tooltip>
{/if}
{#if values}
{@const hasError = setting.isValid && !setting.isValid(values[setting.key])}
{#if setting.fieldType == 'text'}
<input
disabled={setting.ee_only != undefined && !$enterpriseLicense}
type="text"
placeholder={setting.placeholder}
class={hasError
? 'border !border-red-700 !border-opacity-30 !focus:border-red-700 !focus:border-opacity-30 !bg-red-100'
: ''}
bind:value={values[setting.key]}
/>
{:else if setting.fieldType == 'textarea'}
Expand Down Expand Up @@ -353,6 +359,13 @@
<SecondsInput bind:seconds={values[setting.key]} />
</div>
{/if}

{#if hasError}
<span class="text-red-500 text-xs">
Base url must start with http:// or https:// and must not end with a
trailing slash.
</span>
{/if}
{:else}
<input disabled placeholder="Loading..." />
{/if}
Expand Down Expand Up @@ -491,6 +504,8 @@
on:click={async () => {
await saveSettings()
sendUserToast('Settings updated')
}}>Save</Button
}}
>
Save
</Button>
<div class="pb-8" />
2 changes: 1 addition & 1 deletion frontend/src/lib/components/SuperadminSettings.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
</div>
</TabContent>
<TabContent value="settings">
<div class="h-full overflow-auto"> <InstanceSettings /> </div>
<div class="h-full"> <InstanceSettings /> </div>
</TabContent>
</svelte:fragment>
</Tabs>
Expand Down
1 change: 1 addition & 0 deletions frontend/src/lib/components/instanceSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export interface Setting {
| 'email'
| 'license_key'
storage: SettingStorage
isValid?: (value: any) => boolean
}

export type SettingStorage = 'setting' | 'config'

0 comments on commit 3e98b2f

Please sign in to comment.