1
0
mirror of https://github.com/lana-k/sqliteviz.git synced 2025-12-07 02:28:54 +08:00

Add Warn about unsaved tab(s) #23

This commit is contained in:
lana-k
2020-12-24 14:31:45 +01:00
parent c1504dc2b3
commit 07cc00671f
2 changed files with 71 additions and 3 deletions

View File

@@ -28,7 +28,7 @@
<modal name="save" classes="dialog" height="auto">
<div class="dialog-header">
Save query
<close-icon @click="$modal.hide('save')"/>
<close-icon @click="cancelSave"/>
</div>
<div class="dialog-body">
<div v-show="isPredefined" id="save-note">
@@ -44,7 +44,7 @@
/>
</div>
<div class="dialog-buttons-container">
<button class="secondary" @click="$modal.hide('save')">Cancel</button>
<button class="secondary" @click="cancelSave">Cancel</button>
<button class="primary" @click="saveQuery">Save</button>
</div>
</modal>
@@ -82,6 +82,7 @@ export default {
},
created () {
this.$root.$on('createNewQuery', this.createNewQuery)
this.$root.$on('saveQuery', this.checkQueryBeforeSave)
},
methods: {
createNewQuery () {
@@ -96,6 +97,10 @@ export default {
this.$store.commit('addTab', tab)
this.$store.commit('setCurrentTabId', tab.id)
},
cancelSave () {
this.$modal.hide('save')
this.$root.$off('querySaved')
},
checkQueryBeforeSave () {
this.errorMsg = null
const isFromScratch = !this.currentQuery.initName
@@ -159,6 +164,9 @@ export default {
// Hide dialog
this.$modal.hide('save')
// Signal about saving
this.$root.$emit('querySaved')
}
}
}