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

Merge branch 'master' of github.com:lana-k/sqliteviz into migrate_to_vue3

This commit is contained in:
lana-k
2025-01-13 22:19:00 +01:00
14 changed files with 588 additions and 423 deletions

View File

@@ -36,40 +36,6 @@ export default {
return inquiryTab.isPredefined || !inquiryTab.name
},
save (inquiryTab, newName) {
const value = {
id: inquiryTab.isPredefined ? nanoid() : inquiryTab.id,
query: inquiryTab.query,
viewType: inquiryTab.dataView.mode,
viewOptions: inquiryTab.dataView.getOptionsForSave(),
name: newName || inquiryTab.name
}
// Get inquiries from local storage
const myInquiries = this.getStoredInquiries()
let inquiryIndex
// Set createdAt
if (newName) {
value.createdAt = new Date()
} else {
inquiryIndex = myInquiries
.findIndex(oldInquiry => oldInquiry.id === inquiryTab.id)
value.createdAt = myInquiries[inquiryIndex].createdAt
}
// Insert in inquiries list
if (newName) {
myInquiries.push(value)
} else {
myInquiries[inquiryIndex] = value
}
// Save to local storage
this.updateStorage(myInquiries)
return value
},
updateStorage (inquiries) {
localStorage.setItem('myInquiries', JSON.stringify({ version: this.version, inquiries }))
},