mirror of
https://github.com/lana-k/sqliteviz.git
synced 2025-12-07 02:28:54 +08:00
duplicate feature
This commit is contained in:
@@ -37,7 +37,7 @@
|
|||||||
<div class="date-container">{{ query.createdAt | date }}</div>
|
<div class="date-container">{{ query.createdAt | date }}</div>
|
||||||
<div class="icons-container">
|
<div class="icons-container">
|
||||||
<rename-icon @click="showRenameDialog(index)" />
|
<rename-icon @click="showRenameDialog(index)" />
|
||||||
<copy-icon />
|
<copy-icon @click="duplicateQuery(index)"/>
|
||||||
<export-icon />
|
<export-icon />
|
||||||
<delete-icon />
|
<delete-icon />
|
||||||
</div>
|
</div>
|
||||||
@@ -151,6 +151,14 @@ export default {
|
|||||||
this.$store.commit('updateTabName', { index: tabIndex, newName: this.newName })
|
this.$store.commit('updateTabName', { index: tabIndex, newName: this.newName })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
duplicateQuery (index) {
|
||||||
|
const newQuery = JSON.parse(JSON.stringify(this.queries[index]))
|
||||||
|
newQuery.name = newQuery.name + ' Copy'
|
||||||
|
newQuery.id = Number(new Date())
|
||||||
|
newQuery.createdAt = new Date()
|
||||||
|
this.queries.push(newQuery)
|
||||||
|
this.saveQueriesInLocalStorage()
|
||||||
|
},
|
||||||
saveQueriesInLocalStorage () {
|
saveQueriesInLocalStorage () {
|
||||||
localStorage.setItem('myQueries', JSON.stringify(this.queries))
|
localStorage.setItem('myQueries', JSON.stringify(this.queries))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user