Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: scroll the result panel in the admin mode (#18900)

ecmadaode23452b5ed9
diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/VirtualDataTable.vue b/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/VirtualDataTable.vue
index 271e48aa66..db08b18b7f 100644
--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/VirtualDataTable.vue
+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/VirtualDataTable.vue
@@ -3,7 +3,7 @@
ref="containerRef"
class="relative w-full flex-1 overflow-auto flex flex-col rounded-sm border dark:border-zinc-500"
>
- <div class="inline-block">
+ <div class="inline-block shrink-0">
<table
ref="tableRef"
class="relative border-collapse -mx-px"
diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vue b/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vue
index 0a66e4f0d2..637d276ffc 100644
--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vue
+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vue
@@ -92,7 +92,10 @@
<SelectionCopyTooltips />
</div>
- <div class="flex-1 w-full flex flex-col overflow-y-auto relative">
+ <div
+ class="w-full flex flex-col relative"
+ :class="dark ? 'h-80 overflow-hidden' : 'flex-1 overflow-y-auto'"
+ >
<VirtualDataBlock
v-if="state.vertical"
ref="dataTableRef"
@@ -121,7 +124,7 @@
/>
<div class="absolute bottom-2 right-4 flex items-end gap-x-2">
- <div v-if="state.searchCandidateRowIndexs.length > 0" class="flex flex-row gap-x-2 border shadow rounded bg-white py-1 px-2">
+ <div v-if="state.searchCandidateRowIndexs.length > 0" class="flex flex-row gap-x-2 border shadow rounded bg-white dark:bg-gray-800 dark:border-gray-600 py-1 px-2">
<NButton
quaternary
size="small"
@@ -154,31 +157,35 @@
<div class="flex flex-col gap-y-2">
<NTooltip>
<template #trigger>
- <NButton
- circle
- size="medium"
- class="shadow"
- @click="() => scrollToRow(0)"
- >
- <template #icon>
- <ArrowUpIcon class="x-4" />
- </template>
- </NButton>
+ <div class="rounded-full shadow bg-white dark:bg-gray-800">
+ <NButton
+ circle
+ size="medium"
+ quaternary
+ @click="() => scrollToRow(0)"
+ >
+ <template #icon>
+ <ArrowUpIcon class="x-4" />
+ </template>
+ </NButton>
+ </div>
</template>
{{ $t("sql-editor.scroll-to-top") }}
</NTooltip>
<NTooltip>
<template #trigger>
- <NButton
- circle
- size="medium"
- class="shadow"
- @click="() => scrollToRow(rows.length - 1)"
- >
- <template #icon>
- <ArrowDownIcon class="x-4" />
- </template>
- </NButton>
+ <div class="rounded-full shadow bg-white dark:bg-gray-800">
+ <NButton
+ circle
+ size="medium"
+ quaternary
+ @click="() => scrollToRow(rows.length - 1)"
+ >
+ <template #icon>
+ <ArrowDownIcon class="x-4" />
+ </template>
+ </NButton>
+ </div>
</template>
{{ $t("sql-editor.scroll-to-bottom") }}
</NTooltip>
diff --git a/frontend/src/views/sql-editor/EditorPanel/TerminalPanel/CompactSQLEditor.vue b/frontend/src/views/sql-editor/EditorPanel/TerminalPanel/CompactSQLEditor.vue
index 41400ab840..4e4b4bde09 100644
--- a/frontend/src/views/sql-editor/EditorPanel/TerminalPanel/CompactSQLEditor.vue
+++ b/frontend/src/views/sql-editor/EditorPanel/TerminalPanel/CompactSQLEditor.vue
@@ -127,6 +127,8 @@ const execute = (explain = false) => {
};
const handleEditorReady = (_: MonacoModule, editor: IStandaloneCodeEditor) => {
+ // Mark this as a terminal editor to scope keybindings
+ useEditorContextKey(editor, "isTerminalEditor", true);
useEditorContextKey(editor, "readonly", toRef(props, "readonly"));
editor.addAction({
@@ -249,7 +251,7 @@ const handleEditorReady = (_: MonacoModule, editor: IStandaloneCodeEditor) => {
},
// Tell the editor this should be only
// triggered when both of the two conditions are satisfied.
- "!readonly && !content && editorTextFocus && !suggestWidgetVisible && !renameInputVisible && !inSnippetMode && !quickFixWidgetVisible"
+ "isTerminalEditor && !readonly && !content && editorTextFocus && !suggestWidgetVisible && !renameInputVisible && !inSnippetMode && !quickFixWidgetVisible"
);
editor.addCommand(
monaco.KeyCode.DownArrow,
@@ -262,7 +264,7 @@ const handleEditorReady = (_: MonacoModule, editor: IStandaloneCodeEditor) => {
},
// Tell the editor this should be only
// triggered when both of the two conditions are satisfied.
- "!readonly && cursorAtLastLine && editorTextFocus && !suggestWidgetVisible && !renameInputVisible && !inSnippetMode && !quickFixWidgetVisible"
+ "isTerminalEditor && !readonly && cursorAtLastLine && editorTextFocus && !suggestWidgetVisible && !renameInputVisible && !inSnippetMode && !quickFixWidgetVisible"
);
watch(
diff --git a/frontend/src/views/sql-editor/EditorPanel/TerminalPanel/TerminalPanel.vue b/frontend/src/views/sql-editor/EditorPanel/TerminalPanel/TerminalPanel.vue
index c01e1f6ce3..ef2a738e90 100644
--- a/frontend/src/views/sql-editor/EditorPanel/TerminalPanel/TerminalPanel.vue
+++ b/frontend/src/views/sql-editor/EditorPanel/TerminalPanel/TerminalPanel.vue
@@ -39,7 +39,7 @@
</Suspense>
<ResultViewV1
v-if="query.params && query.resultSet"
- class="flex-1 flex flex-col overflow-hidden max-h-80 p-2"
+ class="p-2"
:execute-params="query.params"
:result-set="query.resultSet"
:database="