Saving state

This commit is contained in:
Adria Navarro 2025-03-14 10:32:08 +01:00
parent a196faf717
commit d9adad303f
1 changed files with 5 additions and 1 deletions

View File

@ -63,6 +63,7 @@
let dynamicVariables, addVariableModal, varBinding, globalDynamicBindings let dynamicVariables, addVariableModal, varBinding, globalDynamicBindings
let restBindings = getRestBindings() let restBindings = getRestBindings()
let nestedSchemaFields = {} let nestedSchemaFields = {}
let saving
$: staticVariables = datasource?.config?.staticVariables || {} $: staticVariables = datasource?.config?.staticVariables || {}
@ -178,6 +179,7 @@
async function saveQuery() { async function saveQuery() {
const toSave = builtQuery const toSave = builtQuery
saving = true
try { try {
const isNew = !query._rev const isNew = !query._rev
const { _id } = await queries.save(toSave.datasourceId, toSave) const { _id } = await queries.save(toSave.datasourceId, toSave)
@ -207,6 +209,8 @@
} }
} catch (err) { } catch (err) {
notifications.error(`Error saving query`) notifications.error(`Error saving query`)
} finally {
saving = false
} }
} }
@ -544,7 +548,7 @@
</div> </div>
<Button primary disabled={!url} on:click={runQuery}>Send</Button> <Button primary disabled={!url} on:click={runQuery}>Send</Button>
<Button <Button
disabled={!isModified} disabled={!isModified || saving}
cta cta
on:click={saveQuery} on:click={saveQuery}
tooltip={!hasSchema tooltip={!hasSchema