@@ -7,6 +7,7 @@ import { ElMessage } from 'element-plus'
77import { Codemirror } from ' vue-codemirror'
88import HistoryInput from ' ../components/HistoryInput.vue'
99import type { Ref } from ' vue'
10+ import { Refresh , Document } from ' @element-plus/icons-vue'
1011
1112const stores: Ref <Store []> = ref ([])
1213const kind = ref (' ' )
@@ -57,6 +58,10 @@ const queryDataFromTable = (data: QueryData) => {
5758 sqlQuery .value = ` @selectTableLImit100_${data .label } `
5859 executeQuery ()
5960}
61+ const describeTable = (data : QueryData ) => {
62+ sqlQuery .value = ` @describeTable_${data .label } `
63+ executeQuery ()
64+ }
6065const queryTables = () => {
6166 sqlQuery .value = ` `
6267 executeQuery ()
@@ -138,6 +143,9 @@ const keyValueDataHandler = (data: QueryData) => {
138143}
139144
140145const executeQuery = async () => {
146+ return executeWithQuery (sqlQuery .value )
147+ }
148+ const executeWithQuery = async (sql : string ) => {
141149 switch (kind .value ) {
142150 case ' atest-store-etcd' :
143151 sqlQuery .value = ' *'
@@ -146,7 +154,7 @@ const executeQuery = async () => {
146154
147155 let success = false
148156 try {
149- const data = await API .DataQueryAsync (store .value , kind .value , queryDataMeta .value .currentDatabase , sqlQuery . value );
157+ const data = await API .DataQueryAsync (store .value , kind .value , queryDataMeta .value .currentDatabase , sql );
150158 switch (kind .value ) {
151159 case ' atest-store-orm' :
152160 case ' atest-store-iotdb' :
@@ -184,11 +192,21 @@ const executeQuery = async () => {
184192 <el-scrollbar >
185193 <el-select v-model =" queryDataMeta.currentDatabase" placeholder =" Select database"
186194 @change =" queryTables" filterable >
195+ <template #header >
196+ <el-button type =" primary" :icon =" Refresh" @click =" executeWithQuery('')" ></el-button >
197+ </template >
187198 <el-option v-for =" item in queryDataMeta.databases" :key =" item" :label =" item"
188199 :value =" item" ></el-option >
189200 </el-select >
190- <el-tree :data =" tablesTree" node-key =" label" @node-click =" queryDataFromTable" highlight-current
191- draggable />
201+ <el-tree :data =" tablesTree" node-key =" label" highlight-current
202+ draggable >
203+ <template #default =" {node , data } " >
204+ <span @click =" queryDataFromTable(data)" >
205+ {{ node.label }}
206+ </span >
207+ <el-icon style =" margin-left : 6px ;" @click =" describeTable(data)" v-if =" kind === 'atest-store-orm'" ><Document /></el-icon >
208+ </template >
209+ </el-tree >
192210 </el-scrollbar >
193211 </el-aside >
194212 <el-container >
0 commit comments