Skip to content

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

feat: add connection column to sheet panel (#7717)

Liu Jiff2c1ae0d2da
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 5b63799c8e..b059681af6 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -1871,7 +1871,8 @@
"connection-lost": "Connection lost. Will try to reconnect when executing next query.",
"sheet": {
"choose-sheet": "Choose Sheet",
- "self": "Sheet"
+ "self": "Sheet",
+ "connection": "Connection"
},
"tab": {
"unsaved": "Unsaved"
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index e71a51d63b..4ad4be5516 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -1865,7 +1865,8 @@
"connection-lost": "Conexión perdida. \nIntentará volver a conectarse al ejecutar la siguiente consulta.",
"sheet": {
"choose-sheet": "Elegir hoja",
- "self": "Hoja"
+ "self": "Hoja",
+ "connection": "Conexión"
},
"tab": {
"unsaved": "No guardado"
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index b3c1a7f11a..79b78423fd 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -1865,7 +1865,8 @@
"connection-lost": "连接丢失。下一次执行查询时将尝试重新连接。",
"sheet": {
"choose-sheet": "选择工作表",
- "self": "工作表"
+ "self": "工作表",
+ "connection": "连接"
},
"tab": {
"unsaved": "未保存"
diff --git a/frontend/src/views/sql-editor/SheetPanel/SheetTable/SheetConnection.vue b/frontend/src/views/sql-editor/SheetPanel/SheetTable/SheetConnection.vue
new file mode 100644
index 0000000000..82a14ffa9a
--- /dev/null
+++ b/frontend/src/views/sql-editor/SheetPanel/SheetTable/SheetConnection.vue
@@ -0,0 +1,58 @@
+<template>
+ <div v-if="database" class="flex items-center flex-wrap gap-1">
+ <InstanceV1Name :instance="database.instanceEntity" :link="false">
+ <template #prefix>
+ <EnvironmentV1Name
+ :environment="database.instanceEntity.environmentEntity"
+ :link="false"
+ :show-icon="false"
+ text-class=" text-control-light"
+ />
+ </template>
+ </InstanceV1Name>
+
+ <div class="flex items-center gap-x-1">
+ <heroicons-outline:database />
+
+ <EnvironmentV1Name
+ v-if="
+ database.instanceEntity.environment !== database.effectiveEnvironment
+ "
+ :environment="database.effectiveEnvironmentEntity"
+ :link="false"
+ :show-icon="false"
+ text-class=" text-control-light"
+ />
+
+ <DatabaseV1Name :database="database" :link="false" />
+ </div>
+ </div>
+</template>
+
+<script lang="ts" setup>
+import { computed } from "vue";
+import {
+ DatabaseV1Name,
+ InstanceV1Name,
+ EnvironmentV1Name,
+} from "@/components/v2";
+import { useDatabaseV1Store } from "@/store";
+import { UNKNOWN_ID } from "@/types";
+import { Sheet } from "@/types/proto/v1/sheet_service";
+import { extractDatabaseResourceName } from "@/utils";
+
+const props = defineProps<{
+ sheet: Sheet;
+}>();
+const databaseStore = useDatabaseV1Store();
+
+const database = computed(() => {
+ const { sheet } = props;
+ if (!props.sheet.database) return undefined;
+ const db = databaseStore.getDatabaseByUID(
+ extractDatabaseResourceName(sheet.database).database
+ );
+ if (db.uid === String(UNKNOWN_ID)) return undefined;
+ return db;
+});
+</script>
diff --git a/frontend/src/views/sql-editor/SheetPanel/SheetTable/SheetTable.vue b/frontend/src/views/sql-editor/SheetPanel/SheetTable/SheetTable.vue
index 7350725187..2e4fee6488 100644
--- a/frontend/src/views/sql-editor/SheetPanel/SheetTable/SheetTable.vue
+++ b/frontend/src/views/sql-editor/SheetPanel/SheetTable/SheetTable.vue
@@ -11,6 +11,9 @@
<div class="bb-grid-cell">
{{ sheet.title }}
</div>
+ <div class="bb-grid-cell">
+ <SheetConnection :sheet="sheet" />
+ </div>
<div class="bb-grid-cell">
<ProjectV1Name :project="projectForSheet(sheet)" :link="false" />
</div>
@@ -42,6 +45,7 @@ import { Sheet } from "@/types/proto/v1/sheet_service";
import { Sheet_Visibility } from "@/types/proto/v1/sheet_service";
import { extractProjectResourceName } from "@/utils";
import { SheetViewMode, useSheetContextByView, Dropdown } from "../../Sheet";
+import SheetConnection from "./SheetConnection.vue";
const props = defineProps<{
view: SheetViewMode;
@@ -70,13 +74,17 @@ const columns = computed(() => {
title: t("common.name"),
width: "2fr",
};
+ const CONNECTION: BBGridColumn = {
+ title: t("sql-editor.sheet.connection"),
+ width: "minmax(auto, 2fr)",
+ };
const PROJECT: BBGridColumn = {
title: t("common.project"),
width: "minmax(auto, 1fr)",
};
const VISIBILITY: BBGridColumn = {
title: t("common.visibility"),
- width: "minmax(auto, 1fr)",
+ width: "minmax(auto, 8rem)",
};
const CREATOR: BBGridColumn = {
title: t("common.creator"),
@@ -84,13 +92,13 @@ const columns = computed(() => {
};
const UPDATED: BBGridColumn = {
title: t("common.updated-at"),
- width: "minmax(auto, 1fr)",
+ width: "minmax(auto, 10rem)",
};
const OPERATION: BBGridColumn = {
title: "",
width: "auto",
};
- const columns = [NAME, PROJECT, VISIBILITY];
+ const columns = [NAME, CONNECTION, PROJECT, VISIBILITY];
if (showCreator.value) {
columns.push(CREATOR);
}