Skip to content

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

chore(sql-editor): minor fixes (#7560)

Liu Ji1ef5dc1bb5bb
diff --git a/frontend/src/views/sql-editor/SQLEditorPage.vue b/frontend/src/views/sql-editor/SQLEditorPage.vue
index 571e836c24..7f6818d934 100644
--- a/frontend/src/views/sql-editor/SQLEditorPage.vue
+++ b/frontend/src/views/sql-editor/SQLEditorPage.vue
@@ -95,6 +95,12 @@
<Quickstart />
+ <Drawer v-model:show="showSheetPanel">
+ <DrawerContent :title="$t('sql-editor.sheet.self')">
+ <SheetPanel @close="showSheetPanel = false" />
+ </DrawerContent>
+ </Drawer>
+
<SchemaEditorModal
v-if="alterSchemaState.showModal"
:database-id-list="alterSchemaState.databaseIdList.map((id) => `${id}`)"
@@ -112,7 +118,7 @@ import { stringify } from "qs";
import { Splitpanes, Pane } from "splitpanes";
import { computed, reactive } from "vue";
import SchemaEditorModal from "@/components/AlterSchemaPrepForm/SchemaEditorModal.vue";
-import { InstanceV1Name } from "@/components/v2";
+import { Drawer, DrawerContent, InstanceV1Name } from "@/components/v2";
import {
useCurrentUserV1,
useDatabaseV1Store,
@@ -131,6 +137,7 @@ import AdminModeButton from "./EditorCommon/AdminModeButton.vue";
import EditorPanel from "./EditorPanel/EditorPanel.vue";
import ResultPanel from "./ResultPanel";
import { provideSheetContext } from "./Sheet";
+import SheetPanel from "./SheetPanel";
import TabList from "./TabList";
import TerminalPanelV1 from "./TerminalPanel/TerminalPanelV1.vue";
@@ -151,6 +158,8 @@ const tabStore = useTabStore();
const databaseStore = useDatabaseV1Store();
const sqlEditorStore = useSQLEditorStore();
const currentUserV1 = useCurrentUserV1();
+// provide context for sheets
+const { showPanel: showSheetPanel } = provideSheetContext();
const isDisconnected = computed(() => tabStore.isDisconnected);
const isFetchingSheet = computed(() => sqlEditorStore.isFetchingSheet);
@@ -216,9 +225,6 @@ const handleAlterSchema = async (params: {
window.open(url, "_blank");
}
};
-
-// provide context for sheets
-provideSheetContext();
</script>
<style>
diff --git a/frontend/src/views/sql-editor/Sheet/context.ts b/frontend/src/views/sql-editor/Sheet/context.ts
index f8f21b4b75..72ac2b5846 100644
--- a/frontend/src/views/sql-editor/Sheet/context.ts
+++ b/frontend/src/views/sql-editor/Sheet/context.ts
@@ -99,6 +99,8 @@ export const provideSheetContext = () => {
});
provide(KEY, context);
+
+ return context;
};
export const openSheet = async (sheet: Sheet, forceNewTab = false) => {
diff --git a/frontend/src/views/sql-editor/SheetPanel/SheetPanel.vue b/frontend/src/views/sql-editor/SheetPanel/SheetPanel.vue
index 8f90a4a2aa..ab2225e39a 100644
--- a/frontend/src/views/sql-editor/SheetPanel/SheetPanel.vue
+++ b/frontend/src/views/sql-editor/SheetPanel/SheetPanel.vue
@@ -1,5 +1,5 @@
<template>
- <div class="w-[40vw] max-w-[calc(100vw-2rem)]">
+ <div class="w-[75vw] max-w-[calc(100vw-2rem)]">
<NTabs v-model:value="view">
<NTabPane name="my" :tab="$t('sheet.my-sheets')">
<SheetTable view="my" @select-sheet="handleSelectSheet" />
diff --git a/frontend/src/views/sql-editor/SheetPanel/SheetTable/SheetTable.vue b/frontend/src/views/sql-editor/SheetPanel/SheetTable/SheetTable.vue
index 629a1370af..7350725187 100644
--- a/frontend/src/views/sql-editor/SheetPanel/SheetTable/SheetTable.vue
+++ b/frontend/src/views/sql-editor/SheetPanel/SheetTable/SheetTable.vue
@@ -1,7 +1,7 @@
<template>
<BBGrid
:column-list="columns"
- :data-source="sheetList"
+ :data-source="sortedSheetList"
:show-placeholder="true"
:ready="!isLoading"
row-key="name"
@@ -31,6 +31,7 @@
</template>
<script lang="ts" setup>
+import { orderBy } from "lodash-es";
import { computed, onMounted } from "vue";
import { useI18n } from "vue-i18n";
import { BBGrid, BBGridRow, BBGridColumn } from "@/bbkit";
@@ -97,6 +98,10 @@ const columns = computed(() => {
return columns;
});
+const sortedSheetList = computed(() => {
+ return orderBy<Sheet>(sheetList.value, [(sheet) => sheet.title], ["asc"]);
+});
+
const projectForSheet = (sheet: Sheet) => {
const project = extractProjectResourceName(sheet.name);
return projectStore.getProjectByName(`projects/${project}`);
diff --git a/frontend/src/views/sql-editor/TabList/TabList.vue b/frontend/src/views/sql-editor/TabList/TabList.vue
index 3e884a93e2..0d3d6a4488 100644
--- a/frontend/src/views/sql-editor/TabList/TabList.vue
+++ b/frontend/src/views/sql-editor/TabList/TabList.vue
@@ -44,12 +44,6 @@
{{ $t("sql-editor.sheet.choose-sheet") }}
</NButton>
</div>
-
- <Drawer v-model:show="showSheetPanel">
- <DrawerContent :title="$t('sql-editor.sheet.self')">
- <SheetPanel @close="showSheetPanel = false" />
- </DrawerContent>
- </Drawer>
</div>
</template>
@@ -60,12 +54,10 @@ import scrollIntoView from "scroll-into-view-if-needed";
import { ref, reactive, nextTick, computed, onMounted, watch } from "vue";
import { useI18n } from "vue-i18n";
import Draggable from "vuedraggable";
-import { Drawer, DrawerContent } from "@/components/v2";
import { useTabStore } from "@/store";
import type { TabInfo } from "@/types";
import { TabMode } from "@/types";
import { useSheetContext } from "../Sheet";
-import SheetPanel from "../SheetPanel";
import TabItem from "./TabItem";
type LocalState = {