Skip to content

Commit 95a6a6c

Browse files
committed
feat: using code editor instead of input for sql editing
1 parent a6aaa98 commit 95a6a6c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

console/atest-ui/src/views/DataManager.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const columns = ref([] as string[])
2525
const queryTip = ref('')
2626
const loadingStores = ref(true)
2727
const showOverflowTooltip = ref(true)
28+
const complexEditor = ref(false)
2829
const dataFormat = ref('table')
2930
const dataFormatOptions = ['table', 'json']
3031
const queryDataMeta = ref({} as QueryDataMeta)
@@ -48,8 +49,10 @@ watch(store, (s) => {
4849
case 'atest-store-elasticsearch':
4950
case 'atest-store-etcd':
5051
sqlQuery.value = '*'
52+
complexEditor.value = false
5153
break
5254
default:
55+
complexEditor.value = true
5356
queryDataMeta.value.currentDatabase = ''
5457
sqlQuery.value = ''
5558
}
@@ -296,7 +299,7 @@ watch(largeContent, (e) => {
296299
</el-form-item>
297300
</el-col>
298301
<el-col :span="16">
299-
<el-form-item>
302+
<el-form-item v-if="!complexEditor">
300303
<HistoryInput :placeholder="queryTip" :callback="executeQuery" v-model="sqlQuery" />
301304
</el-form-item>
302305
</el-col>
@@ -328,6 +331,7 @@ watch(largeContent, (e) => {
328331
</el-col>
329332
</el-row>
330333
</el-form>
334+
<Codemirror v-model="sqlQuery" v-if="complexEditor" style="height: 180px"/>
331335
</el-header>
332336
<el-main>
333337
<div style="display: flex; gap: 8px;">
@@ -336,7 +340,7 @@ watch(largeContent, (e) => {
336340
<el-tag type="primary" v-for="label in queryDataMeta.labels">{{ label.value }}</el-tag>
337341
<el-check-tag type="primary" :checked="showOverflowTooltip" @change="overflowChange" v-if="queryResult.length > 0">overflow</el-check-tag>
338342
</div>
339-
<el-table :data="queryResult" stripe v-if="dataFormat === 'table'" height="calc(100vh - 200px)" @cell-dblclick="tryShowPrettyJSON">
343+
<el-table :data="queryResult" stripe v-if="dataFormat === 'table'" height="calc(100vh - 380px)" @cell-dblclick="tryShowPrettyJSON">
340344
<el-table-column v-for="col in columns" :key="col" :prop="col" :label="col" sortable :show-overflow-tooltip="showOverflowTooltip" />
341345
</el-table>
342346
<Codemirror v-else-if="dataFormat === 'json'" v-model="queryResultAsJSON" />

0 commit comments

Comments
 (0)