1
0
mirror of https://github.com/lana-k/sqliteviz.git synced 2025-12-06 10:08:52 +08:00

add save as event

This commit is contained in:
lana-k
2025-10-05 14:27:50 +02:00
parent 6fbf75b601
commit 45530cc9d6

View File

@@ -147,13 +147,13 @@ export default {
events.send('inquiry.create', null, { auto: false }) events.send('inquiry.create', null, { auto: false })
}, },
cancelSave() { cancelSave() {
this.errorMsg = null
this.name = ''
this.$modal.hide('save') this.$modal.hide('save')
this.$modal.hide('inquiry-conflict') this.$modal.hide('inquiry-conflict')
eventBus.$off('inquirySaved') eventBus.$off('inquirySaved')
}, },
onSave(skipConcurrentEditingCheck = false) { onSave(skipConcurrentEditingCheck = false) {
this.errorMsg = null
this.name = ''
if (storedInquiries.isTabNeedName(this.currentInquiryTab)) { if (storedInquiries.isTabNeedName(this.currentInquiryTab)) {
this.openSaveModal() this.openSaveModal()
return return
@@ -175,11 +175,11 @@ export default {
this.saveInquiry() this.saveInquiry()
}, },
onSaveAs() { onSaveAs() {
this.errorMsg = null
this.name = ''
this.openSaveModal() this.openSaveModal()
}, },
openSaveModal() { openSaveModal() {
this.errorMsg = null
this.name = ''
this.$modal.show('save') this.$modal.show('save')
}, },
validateSaveFormAndSaveInquiry() { validateSaveFormAndSaveInquiry() {
@@ -192,6 +192,10 @@ export default {
async saveInquiry() { async saveInquiry() {
const dataSet = this.currentInquiryTab.result const dataSet = this.currentInquiryTab.result
const tabView = this.currentInquiryTab.view const tabView = this.currentInquiryTab.view
const eventName =
this.currentInquiryTab.name && this.name
? 'inquiry.saveAs'
: 'inquiry.save'
// Save inquiry // Save inquiry
const value = await this.$store.dispatch('saveInquiry', { const value = await this.$store.dispatch('saveInquiry', {
@@ -229,7 +233,7 @@ export default {
// Signal about saving // Signal about saving
eventBus.$emit('inquirySaved') eventBus.$emit('inquirySaved')
events.send('inquiry.save') events.send(eventName)
}, },
_keyListener(e) { _keyListener(e) {
if (this.$route.path === '/workspace') { if (this.$route.path === '/workspace') {