Skip to content

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

feat: optimize SQL Editor tab and toolbar button (#7262)

Tianzhou (天舟)2f94898351c1
diff --git a/frontend/src/views/sql-editor/EditorCommon/AdminModeButton.vue b/frontend/src/views/sql-editor/EditorCommon/AdminModeButton.vue
index 65b8dcf446..aa3ba46066 100644
--- a/frontend/src/views/sql-editor/EditorCommon/AdminModeButton.vue
+++ b/frontend/src/views/sql-editor/EditorCommon/AdminModeButton.vue
@@ -1,6 +1,7 @@
<template>
<NButton
v-if="showButton"
+ :size="props.size"
type="warning"
:disabled="tabStore.isDisconnected"
@click="enterAdminMode"
@@ -25,6 +26,13 @@ const emit = defineEmits<{
(e: "enter"): void;
}>();
+const props = defineProps({
+ size: {
+ type: String,
+ default: "medium",
+ },
+});
+
const currentUserV1 = useCurrentUserV1();
const allowAdmin = computed(() =>
diff --git a/frontend/src/views/sql-editor/EditorCommon/EditorAction.vue b/frontend/src/views/sql-editor/EditorCommon/EditorAction.vue
index db06feb9c5..01998a2ce9 100644
--- a/frontend/src/views/sql-editor/EditorCommon/EditorAction.vue
+++ b/frontend/src/views/sql-editor/EditorCommon/EditorAction.vue
@@ -1,11 +1,16 @@
<template>
<div
- class="w-full flex flex-wrap gap-y-2 justify-between sm:items-center p-4 border-b bg-white"
+ class="w-full flex flex-wrap gap-y-2 justify-between sm:items-center p-2 border-b bg-white"
>
<div
class="action-left gap-x-2 flex overflow-x-auto sm:overflow-x-hidden items-center"
>
- <NButton type="primary" :disabled="!allowQuery" @click="handleRunQuery">
+ <NButton
+ type="primary"
+ size="small"
+ :disabled="!allowQuery"
+ @click="handleRunQuery"
+ >
<mdi:play class="h-5 w-5 -ml-1.5" />
<span>
{{
@@ -17,14 +22,14 @@
({{ keyboardShortcutStr("cmd_or_ctrl+⏎") }})
</span>
</NButton>
- <NButton :disabled="!allowQuery" @click="handleExplainQuery">
+ <NButton size="small" :disabled="!allowQuery" @click="handleExplainQuery">
<mdi:play class="h-5 w-5 -ml-1.5" />
<span>Explain</span>
<span class="hidden sm:inline ml-1">
({{ keyboardShortcutStr("cmd_or_ctrl+E") }})
</span>
</NButton>
- <NButton :disabled="!allowQuery" @click="handleFormatSQL">
+ <NButton size="small" :disabled="!allowQuery" @click="handleFormatSQL">
<span>{{ $t("sql-editor.format") }}</span>
<span class="hidden sm:inline ml-1">
({{ keyboardShortcutStr("shift+opt_or_alt+F") }})
@@ -32,6 +37,7 @@
</NButton>
<NButton
v-if="showClearScreen"
+ size="small"
:disabled="queryList.length <= 1 || isExecutingSQL"
@click="handleClearScreen"
>
@@ -44,13 +50,14 @@
<div
class="action-right gap-x-2 flex overflow-x-auto sm:overflow-x-hidden sm:justify-end items-center"
>
- <AdminModeButton />
+ <AdminModeButton :size="'small'" />
<template v-if="showSheetsFeature">
<NButton
secondary
strong
type="primary"
+ size="small"
:disabled="!allowSave"
@click="() => emit('save-sheet')"
>
@@ -68,6 +75,7 @@
>
<template #trigger>
<NButton
+ size="small"
:disabled="
isEmptyStatement ||
tabStore.isDisconnected ||
diff --git a/frontend/src/views/sql-editor/SQLEditorPage.vue b/frontend/src/views/sql-editor/SQLEditorPage.vue
index 074f404ae5..5c76216209 100644
--- a/frontend/src/views/sql-editor/SQLEditorPage.vue
+++ b/frontend/src/views/sql-editor/SQLEditorPage.vue
@@ -259,6 +259,6 @@ provideSheetPanelContext();
--color-branding: #4f46e5;
--border-color: rgba(200, 200, 200, 0.2);
- @apply flex-1 overflow-hidden flex flex-col;
+ @apply flex-1 overflow-hidden flex flex-col pt-2;
}
</style>
diff --git a/frontend/src/views/sql-editor/TabList/TabItem/TabItem.vue b/frontend/src/views/sql-editor/TabList/TabItem/TabItem.vue
index 0672086eea..a2adba6509 100644
--- a/frontend/src/views/sql-editor/TabList/TabItem/TabItem.vue
+++ b/frontend/src/views/sql-editor/TabList/TabItem/TabItem.vue
@@ -75,10 +75,10 @@ const isCurrentTab = computed(() => props.tab.id === currentTabId.value);
}
.body {
- @apply flex items-center justify-between gap-x-1 pl-2 pr-1 py-1 border-t-2 border-t-transparent;
+ @apply flex items-center justify-between gap-x-1 pl-2 pr-1 py-1 border-t;
}
.current .body {
- @apply relative bg-white text-accent border-t-accent;
+ @apply relative bg-white text-accent border-t-accent border-t-2;
}
.tab-item.admin .body {
diff --git a/frontend/src/views/sql-editor/TabList/TabList.vue b/frontend/src/views/sql-editor/TabList/TabList.vue
index 9e2f653b5c..f49db74399 100644
--- a/frontend/src/views/sql-editor/TabList/TabList.vue
+++ b/frontend/src/views/sql-editor/TabList/TabList.vue
@@ -1,6 +1,6 @@
<template>
<div
- class="flex justify-between items-center box-border text-gray-500 text-sm border-b pr-1"
+ class="flex justify-between items-center box-border text-gray-500 text-sm border-b pr-2"
>
<div class="relative flex flex-1 flex-nowrap overflow-hidden">
<Draggable
@@ -39,9 +39,11 @@
</button>
</div>
- <NButton size="tiny" @click="showSheetPanel = true">
- {{ $t("sql-editor.sheet.choose-sheet") }}
- </NButton>
+ <div class="pb-1">
+ <NButton size="small" @click="showSheetPanel = true">
+ {{ $t("sql-editor.sheet.choose-sheet") }}
+ </NButton>
+ </div>
<Drawer v-model:show="showSheetPanel">
<DrawerContent :title="$t('sql-editor.sheet.self')">