+
+
+ Are you sure you want to delete
+ "{{ queries[currentQueryIndex].name }}"?
+
+
+
+
+
+
@@ -146,7 +170,7 @@ export default {
this.$set(this.queries, this.currentQueryIndex, currentQuery)
this.$modal.hide('rename')
this.saveQueriesInLocalStorage()
- const tabIndex = this.$store.state.tabs.findIndex(tab => tab.id === currentQuery.id)
+ const tabIndex = this.findTabIndex(currentQuery.id)
if (tabIndex >= 0) {
this.$store.commit('updateTabName', { index: tabIndex, newName: this.newName })
}
@@ -159,6 +183,23 @@ export default {
this.queries.push(newQuery)
this.saveQueriesInLocalStorage()
},
+ showDeleteDialog (index) {
+ this.currentQueryIndex = index
+ this.$modal.show('delete')
+ },
+ deleteQuery () {
+ this.$modal.hide('delete')
+ const id = this.queries[this.currentQueryIndex].id
+ this.queries.splice(this.currentQueryIndex, 1)
+ this.saveQueriesInLocalStorage()
+ const tabIndex = this.findTabIndex(id)
+ if (tabIndex >= 0) {
+ this.$store.commit('deleteTab', tabIndex)
+ }
+ },
+ findTabIndex (id) {
+ return this.$store.state.tabs.findIndex(tab => tab.id === id)
+ },
saveQueriesInLocalStorage () {
localStorage.setItem('myQueries', JSON.stringify(this.queries))
}