@@ -8,12 +8,13 @@ a-card.editor-card(:bordered="false")
88 :disabled ="isButtonDisabled || explainQueryRunning"
99 @click ="runPartQuery()"
1010 )
11- a-popover( position ="bl" content-class ="code-tooltip" : content= "currentStatement" )
12- a-space( :size ="4" )
13- icon-loading( v-if ="secondaryCodeRunning" spin )
14- icon-play-arrow( v-else )
15- div {{ $t('dashboard.runQuery') + (queryType === 'sql' && currentQueryNumber ? ' #' + currentQueryNumber : '') }}
16- icon-close-circle-fill.icon-16 ( v-if ="secondaryCodeRunning" )
11+ a-tooltip( position ="left" content ="Ctrl + Enter" )
12+ a-popover( position ="bl" content-class ="code-tooltip" : content= "currentStatement" )
13+ a-space( :size ="4" )
14+ icon-loading( v-if ="secondaryCodeRunning" spin )
15+ icon-play-arrow( v-else )
16+ div {{ $t('dashboard.runQuery') + (queryType === 'sql' && currentQueryNumber ? ' #' + currentQueryNumber : '') }}
17+ icon-close-circle-fill.icon-16 ( v-if ="secondaryCodeRunning" )
1718 template( #icon )
1819 icon-down
1920 template( #content )
@@ -47,17 +48,24 @@ a-card.editor-card(:bordered="false")
4748 template( #icon )
4849 icon-import
4950 | {{ $t('dashboard.importExplain') }}
50- a-button (
51+ a-tooltip (
5152 v-if ="queryType === 'sql'"
52- type = "outline "
53- :disabled = "isButtonDisabled "
54- @click = "runQueryAll()"
53+ position = "br "
54+ content = "Alt + Enter "
55+ mini
5556 )
56- a-space( :size ="4" )
57- icon-loading( v-if ="primaryCodeRunning" spin )
58- icon-play-arrow( v-else )
59- | {{ $t('dashboard.runAll') }}
60- icon-close-circle-fill.icon-16 ( v-if ="primaryCodeRunning" )
57+ a-button( type ="outline" : disabled= "isButtonDisabled" @click ="runQueryAll()" )
58+ a-space( :size ="4" )
59+ icon-loading( v-if ="primaryCodeRunning" spin )
60+ icon-play-arrow( v-else )
61+ | {{ $t('dashboard.runAll') }}
62+ icon-close-circle-fill.icon-16 ( v-if ="primaryCodeRunning" )
63+ a-tooltip( mini position ="right" : content= "$t('dashboard.timeAssistance')" )
64+ a-button( type ="secondary" @click ="openTimeAssistance" )
65+ template( #icon )
66+ svg.icon-18
67+ use( href ="#time-index" )
68+ TimeAssistance( ref ="tsRef" : cm= "currentView" )
6169 .query-select
6270 a-space( size ="medium" )
6371 a-tooltip( v-if ="queryType === 'sql'" mini :content ="$t('dashboard.format')" )
@@ -154,7 +162,7 @@ a-card.editor-card(:bordered="false")
154162 import { acceptCompletion } from ' @codemirror/autocomplete'
155163 import type { PromForm } from ' @/store/modules/code-run/types'
156164 import { useStorage } from ' @vueuse/core'
157- import { sqlFormatter , parseSqlStatements , findStatementAtPosition , debounce } from ' @/utils/sql'
165+ import { sqlFormatter , parseSqlStatements , findStatementAtPosition } from ' @/utils/sql'
158166 import { Message } from ' @arco-design/web-vue'
159167 import fileDownload from ' js-file-download'
160168
@@ -173,6 +181,8 @@ a-card.editor-card(:bordered="false")
173181 tabSize: 2 ,
174182 })
175183
184+ const tsRef = ref <InstanceType <typeof import (' ./time-assistance.vue' ).default > | null >(null )
185+
176186 const {
177187 codes,
178188 queryType,
@@ -185,9 +195,12 @@ a-card.editor-card(:bordered="false")
185195 clearCode,
186196 } = useQueryCode ()
187197
198+ // Get current active CodeMirror view based on query type
199+ const currentView = computed (() => {
200+ return queryType .value === ' sql' ? sqlView .value : promqlView .value
201+ })
202+
188203 const currentSqlPreview = ref (' ' )
189- const triggerVisible = ref (false )
190- const rangePickerVisible = ref (false )
191204 const promForm = reactive <PromForm >({
192205 time: 5 ,
193206 step: ' 30s' ,
@@ -206,6 +219,11 @@ a-card.editor-card(:bordered="false")
206219
207220 const emit = defineEmits ([' selectExplainTab' ])
208221
222+ const openTimeAssistance = () => {
223+ if (tsRef .value ) {
224+ tsRef .value ?.open ()
225+ }
226+ }
209227 // Show the import explain modal
210228 const showImportExplainModal = () => {
211229 importExplainModalVisible .value = true
@@ -417,28 +435,36 @@ a-card.editor-card(:bordered="false")
417435 label: ` Last ${value } minutes ` ,
418436 }))
419437
420- // TODO: fix this
421- const defaultKeymap = [
438+ const myKeymap = keymap .of ([
422439 {
423- key: ' alt-Enter' ,
440+ key: ` Ctrl-Enter ` ,
441+ run : () => {
442+ runPartQuery ()
443+ return true
444+ },
445+ },
446+ {
447+ key: ' Alt-Enter' , // Run All
424448 run : () => {
425449 runQueryAll ()
450+ return true
426451 },
427452 },
428453 {
429- key: ' ctrl-Enter ' ,
454+ key: ' Ctrl-Shift-; ' , // Time Assistant(Cmd/Ctrl+Shift+;)
430455 run : () => {
431- runPartQuery ()
456+ openTimeAssistance ()
457+ return true
432458 },
433459 },
434460 {
435461 key: ' Tab' ,
436462 run: acceptCompletion ,
437463 },
438- ]
464+ ])
439465
440- const extensionsForSql = [... extensions .value .sql , keymap . of ( defaultKeymap as any ) ]
441- const extensionsForPromql = [... extensions .value .promql , keymap . of ( defaultKeymap as any ) ]
466+ const extensionsForSql = [myKeymap , ... extensions .value .sql ]
467+ const extensionsForPromql = [myKeymap , ... extensions .value .promql ]
442468 const placeholder = ` Paste response from explain analyze format json here. Example format:
443469 {
444470 "output": [
0 commit comments