Skip to content
Snippets Groups Projects
Commit 56c310b7 authored by Martin Weise's avatar Martin Weise
Browse files

disabled the other dbs for query-re execution feature

Former-commit-id: d046f638
parent b8d928ca
No related branches found
No related tags found
1 merge request!42Fixed the query service tests
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
</v-row> </v-row>
<v-row dense> <v-row dense>
<v-col> <v-col>
<v-btn color="primary" :to="`/databases/${$route.params.database_id}/tables/${item.id}`" disabled> <v-btn color="primary" :to="`/databases/${$route.params.database_id}/queries/${item.id}`">
<v-icon left>mdi-run</v-icon> Execute Again <v-icon left>mdi-run</v-icon> Execute Again
</v-btn> </v-btn>
</v-col> </v-col>
......
...@@ -89,7 +89,10 @@ export default { ...@@ -89,7 +89,10 @@ export default {
let res let res
try { try {
res = await this.$axios.get('/api/image/') res = await this.$axios.get('/api/image/')
this.engines = res.data this.engines = res.data.map((e) => {
e.disabled = (e.id !== 3)
return e
})
console.debug('engines', this.engines) console.debug('engines', this.engines)
} catch (err) { } catch (err) {
this.$toast.error('Failed to fetch supported engines. Try reload the page.') this.$toast.error('Failed to fetch supported engines. Try reload the page.')
......
...@@ -97,7 +97,7 @@ export default { ...@@ -97,7 +97,7 @@ export default {
}, },
methods: { methods: {
async execute () { async execute () {
const query = this.query.sql.replaceAll('"', '') const query = this.query.sql.replaceAll('`', '')
this.loading = true this.loading = true
try { try {
const res = await this.$axios.put(`/api/database/${this.$route.params.database_id}/query`, { const res = await this.$axios.put(`/api/database/${this.$route.params.database_id}/query`, {
......
<template>
<div>
<v-card>
<v-card-title v-if="!loading">
Result of Query #{{ id }}
</v-card-title>
<v-card-subtitle v-if="!loading">
<code v-if="hash">{{ hash }}</code>
</v-card-subtitle>
<v-data-table
:headers="headers"
:items="rows"
:loading="loading"
:items-per-page="30"
class="elevation-1" />
</v-card>
</div>
</template>
<script>
export default {
name: 'QueryShow',
components: {
},
data () {
return {
id: this.$route.params.query_id,
hash: null,
loading: true,
table: null,
headers: [],
rows: []
}
},
mounted () {
this.loadData()
},
methods: {
async loadData () {
try {
const res = await this.$axios.get(`/api/database/${this.$route.params.database_id}/query/${this.$route.params.query_id}`)
this.headers = Object.keys(res.data.result[0]).map((c) => {
return { text: c, value: c }
})
this.rows = res.data.result
console.debug('query data', res.data)
} catch (err) {
this.$toast.error('Could not load table data.')
}
this.loading = false
}
}
}
</script>
<style>
</style>
const { format } = require('sql-formatter') const { format } = require('sql-formatter')
const knex = require('knex')({ client: 'pg' }) const knex = require('knex')({ client: 'mysql' })
export function buildQuery ({ table, select, clauses }) { export function buildQuery ({ table, select, clauses }) {
const builder = knex(table) const builder = knex(table)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment