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

add ctrl+b on /my-queries page

This commit is contained in:
lana-k
2021-03-03 22:32:28 +01:00
parent 7bd8388fd6
commit 6118a12672

View File

@@ -6,6 +6,7 @@
</div> </div>
<div> <div>
<button <button
id="run-btn"
v-if="currentQuery && $route.path === '/editor'" v-if="currentQuery && $route.path === '/editor'"
class="primary" class="primary"
:disabled="runDisabled" :disabled="runDisabled"
@@ -14,6 +15,7 @@
Run Run
</button> </button>
<button <button
id="save-btn"
v-show="currentQuery && $route.path === '/editor'" v-show="currentQuery && $route.path === '/editor'"
class="primary" class="primary"
:disabled="!isUnsaved" :disabled="!isUnsaved"
@@ -21,7 +23,13 @@
> >
Save Save
</button> </button>
<button class="primary" @click="createNewQuery">Create</button> <button
id="create-btn"
class="primary"
@click="createNewQuery"
>
Create
</button>
</div> </div>
<!--Save Query dialog --> <!--Save Query dialog -->
@@ -103,6 +111,9 @@ export default {
createNewQuery () { createNewQuery () {
this.$store.dispatch('addTab').then(id => { this.$store.dispatch('addTab').then(id => {
this.$store.commit('setCurrentTabId', id) this.$store.commit('setCurrentTabId', id)
if (this.$route.path !== '/editor') {
this.$router.push('/editor')
}
}) })
}, },
cancelSave () { cancelSave () {
@@ -165,6 +176,7 @@ export default {
if (!this.runDisabled) { if (!this.runDisabled) {
this.currentQuery.execute() this.currentQuery.execute()
} }
return
} }
// Save query Ctrl+S // Save query Ctrl+S
@@ -173,13 +185,13 @@ export default {
if (this.isUnsaved) { if (this.isUnsaved) {
this.checkQueryBeforeSave() this.checkQueryBeforeSave()
} }
return
} }
}
// New (blank) query Ctrl+B // New (blank) query Ctrl+B
if (e.key === 'b' && (e.ctrlKey || e.metaKey)) { if (e.key === 'b' && (e.ctrlKey || e.metaKey)) {
e.preventDefault() e.preventDefault()
this.createNewQuery() this.createNewQuery()
}
} }
} }
} }