Add validation to config screen

This commit is contained in:
Mel O'Hagan 2022-10-24 10:39:39 +01:00
parent 2bfeb85013
commit 46761749bf
1 changed files with 6 additions and 2 deletions

View File

@ -23,7 +23,8 @@
let importQueriesModal let importQueriesModal
let changed let changed,
isValid = true
let integration, baseDatasource, datasource let integration, baseDatasource, datasource
let queryList let queryList
const querySchema = { const querySchema = {
@ -101,12 +102,15 @@
<Divider /> <Divider />
<div class="config-header"> <div class="config-header">
<Heading size="S">Configuration</Heading> <Heading size="S">Configuration</Heading>
<Button disabled={!changed} cta on:click={saveDatasource}>Save</Button> <Button disabled={!changed || !isValid} cta on:click={saveDatasource}
>Save</Button
>
</div> </div>
<IntegrationConfigForm <IntegrationConfigForm
on:change={hasChanged} on:change={hasChanged}
schema={integration.datasource} schema={integration.datasource}
bind:datasource bind:datasource
on:valid={e => (isValid = e.detail)}
/> />
{#if datasource.plus} {#if datasource.plus}
<PlusConfigForm bind:datasource save={saveDatasource} /> <PlusConfigForm bind:datasource save={saveDatasource} />