Save before leaving
This commit is contained in:
parent
b1af71c31a
commit
7be33806ce
|
@ -209,11 +209,14 @@
|
||||||
originalQuery = null
|
originalQuery = null
|
||||||
|
|
||||||
queryNameLabel.disableEditingState()
|
queryNameLabel.disableEditingState()
|
||||||
|
return { ok: true }
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
notifications.error(`Error saving query`)
|
notifications.error(`Error saving query`)
|
||||||
} finally {
|
} finally {
|
||||||
saving = false
|
saving = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return { ok: false }
|
||||||
}
|
}
|
||||||
|
|
||||||
const validateQuery = async () => {
|
const validateQuery = async () => {
|
||||||
|
@ -482,7 +485,7 @@
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Promise(resolve => {
|
const shouldSave = await new Promise(resolve => {
|
||||||
const dialog = new ConfirmDialog({
|
const dialog = new ConfirmDialog({
|
||||||
target: document.body,
|
target: document.body,
|
||||||
props: {
|
props: {
|
||||||
|
@ -503,6 +506,19 @@
|
||||||
})
|
})
|
||||||
dialog.show()
|
dialog.show()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (!shouldSave) {
|
||||||
|
// Leave without saving anything
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
const saveResult = await saveQuery()
|
||||||
|
if (!saveResult.ok) {
|
||||||
|
// We can't leave as the query was not properly saved
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue