Skip to content

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

chore: optimize the query results (#16108)

ecmadaoae60463a7e54
diff --git a/frontend/src/views/sql-editor/EditorPanel/ResultPanel/BatchQuerySelect.vue b/frontend/src/views/sql-editor/EditorPanel/ResultPanel/BatchQuerySelect.vue
index 439a041ff9..2050c7603a 100644
--- a/frontend/src/views/sql-editor/EditorPanel/ResultPanel/BatchQuerySelect.vue
+++ b/frontend/src/views/sql-editor/EditorPanel/ResultPanel/BatchQuerySelect.vue
@@ -1,7 +1,7 @@
<template>
<div
v-if="queriedDatabaseNames.length > 1"
- class="w-full flex flex-row justify-start items-center p-2 pb-0 gap-2 shrink-0 overflow-x-auto hide-scrollbar"
+ class="w-full flex flex-row justify-start items-center p-2 pb-0 gap-2 shrink-0"
>
<NTooltip v-if="showEmptySwitch">
<template #trigger>
@@ -21,35 +21,39 @@
</template>
</NTooltip>
- <NButton
- v-for="item in filteredItems"
- :key="item.database.name"
- secondary
- strong
- size="small"
- :type="'default'"
- :style="{
- ...getBackgroundColorRgb(item.database),
- borderTop: selectedDatabase === item.database ? '3px solid' : '',
- }"
- @click="$emit('update:selected-database', item.database)"
- >
- <RichDatabaseName :database="item.database" />
- <InfoIcon
- v-if="isDatabaseQueryFailed(item)"
- class="ml-1 text-yellow-600 w-4 h-auto"
- />
- <span
- v-if="isEmptyQueryItem(item)"
- class="text-control-placeholder italic ml-1"
- >
- ({{ $t("common.empty") }})
- </span>
- <XIcon
- class="ml-1 text-gray-400 w-4 h-auto hover:text-gray-600"
- @click.stop="handleCloseSingleResultView(item.database)"
- />
- </NButton>
+ <NScrollbar x-scrollable content-class="pb-2">
+ <div class="flex flex-row justify-start items-center gap-2">
+ <NButton
+ v-for="item in filteredItems"
+ :key="item.database.name"
+ secondary
+ strong
+ size="small"
+ :type="'default'"
+ :style="{
+ ...getBackgroundColorRgb(item.database),
+ borderTop: selectedDatabase === item.database ? '3px solid' : '',
+ }"
+ @click="$emit('update:selected-database', item.database)"
+ >
+ <RichDatabaseName :database="item.database" />
+ <InfoIcon
+ v-if="isDatabaseQueryFailed(item)"
+ class="ml-1 text-yellow-600 w-4 h-auto"
+ />
+ <span
+ v-if="isEmptyQueryItem(item)"
+ class="text-control-placeholder italic ml-1"
+ >
+ ({{ $t("common.empty") }})
+ </span>
+ <XIcon
+ class="ml-1 text-gray-400 w-4 h-auto hover:text-gray-600"
+ @click.stop="handleCloseSingleResultView(item.database)"
+ />
+ </NButton>
+ </div>
+ </NScrollbar>
</div>
</template>
@@ -57,7 +61,7 @@
import { useLocalStorage } from "@vueuse/core";
import { head, last } from "lodash-es";
import { EyeIcon, EyeOffIcon, InfoIcon, XIcon } from "lucide-vue-next";
-import { NButton, NTooltip } from "naive-ui";
+import { NButton, NTooltip, NScrollbar } from "naive-ui";
import { storeToRefs } from "pinia";
import { computed, watch } from "vue";
import { RichDatabaseName } from "@/components/v2";
diff --git a/frontend/src/views/sql-editor/EditorPanel/ResultPanel/ResultPanel.vue b/frontend/src/views/sql-editor/EditorPanel/ResultPanel/ResultPanel.vue
index 9ee043e6e9..16a3f71be7 100644
--- a/frontend/src/views/sql-editor/EditorPanel/ResultPanel/ResultPanel.vue
+++ b/frontend/src/views/sql-editor/EditorPanel/ResultPanel/ResultPanel.vue
@@ -65,7 +65,7 @@
<script lang="ts" setup>
import { useTimestamp } from "@vueuse/core";
import dayjs from "dayjs";
-import { last } from "lodash-es";
+import { head } from "lodash-es";
import { Info } from "lucide-vue-next";
import { NButton, NTabs, NTabPane } from "naive-ui";
import { computed, ref, watch } from "vue";
@@ -81,9 +81,10 @@ const selectedTab = ref<number>();
const selectedResults = computed(() => {
return (
- tabStore.currentTab?.queryContext?.results.get(
- selectedDatabase.value?.name || ""
- ) ?? []
+ tabStore.currentTab?.queryContext?.results
+ .get(selectedDatabase.value?.name || "")
+ ?.slice()
+ .reverse() ?? []
);
});
@@ -94,7 +95,7 @@ const tabName = (beginTimestampMS: number) => {
watch(
() => selectedResults.value,
(results) => {
- selectedTab.value = last(results)?.beginTimestampMS;
+ selectedTab.value = head(results)?.beginTimestampMS;
},
{ deep: true }
);