Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: fix auto height when zoomed (#14180)
Liu Ji84e01873a873
diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTableLite/DataTableLite.vue b/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTableLite/DataTableLite.vueindex d2d056f23e..eccdf5ec7f 100644--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTableLite/DataTableLite.vue+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTableLite/DataTableLite.vue@@ -19,7 +19,7 @@:virtual-scroll-x="true":virtual-scroll-header="true":header-height="HEADER_HEIGHT"- :max-height="maxTableHeight"+ :max-height="tableBodyHeight":min-row-height="ROW_HEIGHT":height-for-row="() => ROW_HEIGHT":scroll-x="tableResize.getTableScrollWidth()"@@ -41,7 +41,7 @@<script lang="ts" setup>import type { Header, Row, Table } from "@tanstack/vue-table";-import { useElementSize } from "@vueuse/core";+import { pausableWatch, useElementSize } from "@vueuse/core";import { type DataTableColumn, type DataTableInst, NDataTable } from "naive-ui";import { computed, h, nextTick, ref, toRef, watch } from "vue";import { QueryRow, type RowValue } from "@/types/proto/v1/sql_service";@@ -57,6 +57,7 @@ const COLUMN_WIDTH = {MAX: 640, // 40rem};const HEADER_HEIGHT = 33;+const GAP_AND_BORDER_HEIGHT = 2;const ROW_HEIGHT = 28;const props = defineProps<{@@ -65,6 +66,7 @@ const props = defineProps<{offset: number;isSensitiveColumn: (index: number) => boolean;isColumnMissingSensitive: (index: number) => boolean;+ maxHeight?: number;}>();const { keyword } = useSQLResultViewContext();@@ -89,10 +91,30 @@ const { height: containerHeight, width: containerWidth } =useElementSize(containerRef);usePreventBackAndForward(scrollerRef);-const maxTableHeight = computed(() => {- const GAP_AND_BORDER_HEIGHT = 2;- return containerHeight.value - HEADER_HEIGHT - GAP_AND_BORDER_HEIGHT;-});+const tableBodyHeight = ref(0);+const { pause: pauseWatch, resume: resumeWatch } = pausableWatch(+ [() => props.table.getRowCount(), containerHeight],+ async () => {+ if (containerHeight.value === 0) return;+ if (!props.maxHeight) {+ // The table height is always limited by the container height+ // and need not to be adjusted automatically+ const experimentalMaxBodyHeight =+ containerHeight.value - HEADER_HEIGHT - GAP_AND_BORDER_HEIGHT;++ tableBodyHeight.value = Math.max(0, experimentalMaxBodyHeight);+ return;+ }++ pauseWatch();+ const experimentalMaxBodyHeight =+ props.maxHeight - HEADER_HEIGHT - GAP_AND_BORDER_HEIGHT;+ tableBodyHeight.value = Math.max(0, experimentalMaxBodyHeight);+ await nextAnimationFrame();+ resumeWatch();+ },+ { immediate: true }+);const queryTableHeaderElement = () => {return containerRef.value?.querySelector(diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/ResultViewV1.vue b/frontend/src/views/sql-editor/EditorCommon/ResultView/ResultViewV1.vueindex bd45b864ab..e1e055403f 100644--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/ResultViewV1.vue+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/ResultViewV1.vue@@ -12,6 +12,7 @@:sql-result-set="resultSet":result="resultSet.results[0]":set-index="0"+ :max-data-table-height="maxDataTableHeight"/></template><template v-else-if="viewMode === 'MULTI-RESULT'">@@ -150,6 +151,10 @@ const props = defineProps({type: Boolean,default: false,},+ maxDataTableHeight: {+ type: Number,+ default: undefined,+ },});const { t } = useI18n();diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vue b/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vueindex 91acd264f1..831d1e7ada 100644--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vue+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vue@@ -132,6 +132,7 @@:offset="pageIndex * pageSize":is-sensitive-column="isSensitiveColumn":is-column-missing-sensitive="isColumnMissingSensitive"+ :max-height="maxDataTableHeight"/></div>@@ -253,6 +254,7 @@ const props = defineProps<{sqlResultSet: SQLResultSetV1;result: QueryResult;setIndex: number;+ maxDataTableHeight?: number;}>();const state = reactive<LocalState>({diff --git a/frontend/src/views/sql-editor/EditorPanel/TerminalPanel/TerminalPanel.vue b/frontend/src/views/sql-editor/EditorPanel/TerminalPanel/TerminalPanel.vueindex dc30a2c9dc..81007ea3e0 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><ResultViewV1v-if="query.params && query.resultSet"- class="max-h-[20rem] flex-1 flex flex-col overflow-hidden"+ class="flex-1 flex flex-col overflow-hidden":execute-params="query.params":result-set="query.resultSet":database="@@ -47,6 +47,7 @@":loading="query.status === 'RUNNING'":dark="true"+ :max-data-table-height="320"/><div