Add loading when saving datasource
This commit is contained in:
parent
4f02a92e37
commit
fa835e65ef
|
@ -33,6 +33,7 @@
|
||||||
let isValid = true
|
let isValid = true
|
||||||
let integration, baseDatasource, datasource
|
let integration, baseDatasource, datasource
|
||||||
let queryList
|
let queryList
|
||||||
|
let loading = false
|
||||||
|
|
||||||
$: baseDatasource = $datasources.selected
|
$: baseDatasource = $datasources.selected
|
||||||
$: queryList = $queries.list.filter(
|
$: queryList = $queries.list.filter(
|
||||||
|
@ -65,9 +66,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
const saveDatasource = async () => {
|
const saveDatasource = async () => {
|
||||||
|
loading = true
|
||||||
if (integration.features[DatasourceFeature.CONNECTION_CHECKING]) {
|
if (integration.features[DatasourceFeature.CONNECTION_CHECKING]) {
|
||||||
const valid = await validateConfig()
|
const valid = await validateConfig()
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
|
loading = false
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,6 +85,8 @@
|
||||||
baseDatasource = cloneDeep(datasource)
|
baseDatasource = cloneDeep(datasource)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
notifications.error(`Error saving datasource: ${err}`)
|
notifications.error(`Error saving datasource: ${err}`)
|
||||||
|
} finally {
|
||||||
|
loading = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +124,11 @@
|
||||||
<Divider />
|
<Divider />
|
||||||
<div class="config-header">
|
<div class="config-header">
|
||||||
<Heading size="S">Configuration</Heading>
|
<Heading size="S">Configuration</Heading>
|
||||||
<Button disabled={!changed || !isValid} cta on:click={saveDatasource}>
|
<Button
|
||||||
|
disabled={!changed || !isValid || loading}
|
||||||
|
cta
|
||||||
|
on:click={saveDatasource}
|
||||||
|
>
|
||||||
Save
|
Save
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue