Skip to content
Snippets Groups Projects
Commit 88101730 authored by Kirill Stytsenko's avatar Kirill Stytsenko
Browse files

Display QueryResults on query details page

Former-commit-id: d6ffc274
parent 0b2d91e3
No related branches found
No related tags found
No related merge requests found
...@@ -130,6 +130,7 @@ export default { ...@@ -130,6 +130,7 @@ export default {
} }
this.$toast.success('Query persisted.') this.$toast.success('Query persisted.')
this.$emit('close') this.$emit('close')
this.loading = false
}, },
async loadUser () { async loadUser () {
this.loading = true this.loading = true
...@@ -143,6 +144,7 @@ export default { ...@@ -143,6 +144,7 @@ export default {
this.$toast.error('Failed load user data') this.$toast.error('Failed load user data')
console.error('load user data failed', err) console.error('load user data failed', err)
} }
this.loading = false
} }
} }
} }
......
...@@ -98,6 +98,13 @@ ${this.parent.queryId ? `/${this.parent.queryId}` : ''} ...@@ -98,6 +98,13 @@ ${this.parent.queryId ? `/${this.parent.queryId}` : ''}
this.loading = false this.loading = false
} }
}, },
buildHeaders (firstLine) {
return Object.keys(firstLine).map(k => ({
text: k,
value: k,
sortable: false
}))
},
async execute () { async execute () {
this.loading = true this.loading = true
try { try {
...@@ -110,10 +117,9 @@ ${this.$route.params.container_id}/database/${this.$route.params.database_id}/qu ...@@ -110,10 +117,9 @@ ${this.$route.params.container_id}/database/${this.$route.params.database_id}/qu
headers: this.headers headers: this.headers
}) })
this.loading = false this.loading = false
// Can't display headers yet if (res.data.result.length) {
// this.result.headers = this.parent.select.map((s) => { this.result.headers = this.buildHeaders(res.data.result[0])
// return { text: s.name, value: s.name, sortable: false } }
// })
this.result.rows = res.data.result this.result.rows = res.data.result
this.total = res.data.resultNumber this.total = res.data.resultNumber
} catch (err) { } catch (err) {
......
...@@ -7,12 +7,12 @@ ...@@ -7,12 +7,12 @@
<v-btn color="blue-grey white--text" class="mr-2" :disabled="!query.execution || identifier.id || !token" @click.stop="persistQueryDialog = true"> <v-btn color="blue-grey white--text" class="mr-2" :disabled="!query.execution || identifier.id || !token" @click.stop="persistQueryDialog = true">
<v-icon left>mdi-fingerprint</v-icon> Persist <v-icon left>mdi-fingerprint</v-icon> Persist
</v-btn> </v-btn>
<v-btn color="primary" :disabled="!token" @click.stop="reExecute"> <v-btn v-if="false" color="primary" :disabled="!token" @click.stop="reExecute">
<v-icon left>mdi-run</v-icon> Re-Execute <v-icon left>mdi-run</v-icon> Re-Execute
</v-btn> </v-btn>
</v-toolbar-title> </v-toolbar-title>
</v-toolbar> </v-toolbar>
<v-card v-if="!loading" flat> <v-card v-if="!loading" class="pb-2" flat>
<v-card-title> <v-card-title>
Query Information Query Information
</v-card-title> </v-card-title>
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
Username: <code v-if="query.username">{{ query.username }}</code><span v-if="!query.username">(empty)</span> Username: <code v-if="query.username">{{ query.username }}</code><span v-if="!query.username">(empty)</span>
</p> </p>
</v-card-text> </v-card-text>
<QueryResults v-if="false" ref="queryResults" v-model="query.id" /> <QueryResults ref="queryResults" v-model="query.id" class="ml-2 mr-2 mt-0" />
</v-card> </v-card>
<v-breadcrumbs :items="items" class="pa-0 mt-2" /> <v-breadcrumbs :items="items" class="pa-0 mt-2" />
<v-dialog <v-dialog
...@@ -168,7 +168,7 @@ export default { ...@@ -168,7 +168,7 @@ export default {
// refresh QueryResults table // refresh QueryResults table
setTimeout(() => { setTimeout(() => {
// this.$refs.queryResults.execute() this.$refs.queryResults.execute()
}, 200) }, 200)
}, },
async reExecute () { async reExecute () {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment