Skip to content

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

feat(sql-editor): improve the connection path bar and production environment banner (#4652)

Liu Ji32c662001d59
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index d13b21ff74..80c06786eb 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -1454,7 +1454,7 @@
"sql-review-result": "SQL review result",
"alter-table": "Alter table",
"visualize-explain": "Visualize Explain",
- "sql-execute-in-production-environment": "The SQL statement below will be executed in a production environment.",
+ "sql-execute-in-production-environment": "Be careful, you are accessing a database in a production environment.",
"rows-upper-limit": "reached the limit of query results",
"tab-mode": {
"readonly": "Read-only",
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 3019787837..413f300b0d 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -1454,7 +1454,7 @@
"sql-review-result": "SQL 检查结果",
"alter-table": "修改表结构",
"visualize-explain": "可视化 Explain",
- "sql-execute-in-production-environment": "下面的 SQL 语句将会在生产环境中执行。",
+ "sql-execute-in-production-environment": "小心,你正在操作生产环境下的数据库。",
"rows-upper-limit": "到达查询结果条数上限",
"tab-mode": {
"readonly": "只读",
diff --git a/frontend/src/views/sql-editor/EditorCommon/ConnectionPathBar.vue b/frontend/src/views/sql-editor/EditorCommon/ConnectionPathBar.vue
index 0ef4128d0a..437159ce1c 100644
--- a/frontend/src/views/sql-editor/EditorCommon/ConnectionPathBar.vue
+++ b/frontend/src/views/sql-editor/EditorCommon/ConnectionPathBar.vue
@@ -1,10 +1,9 @@
<template>
<div
v-if="!tabStore.isDisconnected"
- class="w-full py-1 px-4 flex justify-between items-center border-b"
- :class="[isProductionEnvironment && 'bg-yellow-50']"
+ class="w-full flex justify-between items-start"
>
- <div class="flex justify-start items-center">
+ <div class="flex justify-start items-center h-8 px-4 rounded-br bg-white">
<NPopover v-if="showReadonlyDatasourceWarning" trigger="hover">
<template #trigger>
<heroicons-outline:exclamation
@@ -64,10 +63,11 @@
</label>
</div>
- <div :class="[isProductionEnvironment ? 'text-yellow-700' : 'text-main']">
- <template v-if="isProductionEnvironment">
- {{ $t("sql-editor.sql-execute-in-production-environment") }}
- </template>
+ <div
+ v-if="isProductionEnvironment"
+ class="flex justify-start items-center h-8 px-4 rounded-bl text-white bg-error"
+ >
+ {{ $t("sql-editor.sql-execute-in-production-environment") }}
</div>
</div>
</template>
@@ -89,14 +89,20 @@ const connection = computed(() => tabStore.currentTab.connection);
const selectedInstance = useInstanceById(
computed(() => connection.value.instanceId)
);
+
const selectedDatabase = useDatabaseById(
computed(() => connection.value.databaseId)
);
+
const isProductionEnvironment = computed(() => {
const instance = selectedInstance.value;
return instance.environment.tier === "PROTECTED";
});
+const isAdminMode = computed(() => {
+ return tabStore.currentTab.mode === TabMode.Admin;
+});
+
const hasReadonlyDataSource = computed(() => {
for (const ds of selectedInstance.value.dataSourceList) {
if (ds.type === "RO") {
@@ -108,7 +114,7 @@ const hasReadonlyDataSource = computed(() => {
const showReadonlyDatasourceWarning = computed(() => {
return (
- tabStore.currentTab.mode === TabMode.ReadOnly &&
+ !isAdminMode.value &&
selectedInstance.value.id !== UNKNOWN_ID &&
!hasReadonlyDataSource.value
);
diff --git a/frontend/src/views/sql-editor/EditorCommon/EditorAction.vue b/frontend/src/views/sql-editor/EditorCommon/EditorAction.vue
index 4c635e04a3..8068bdfeff 100644
--- a/frontend/src/views/sql-editor/EditorCommon/EditorAction.vue
+++ b/frontend/src/views/sql-editor/EditorCommon/EditorAction.vue
@@ -1,5 +1,5 @@
<template>
- <div class="w-full flex justify-between items-center p-4 border-b">
+ <div class="w-full flex justify-between items-center p-4 border-b bg-white">
<div class="action-left space-x-2 flex items-center">
<NButton
type="primary"
diff --git a/frontend/src/views/sql-editor/TerminalPanel/TerminalPanel.vue b/frontend/src/views/sql-editor/TerminalPanel/TerminalPanel.vue
index 1291e47b4a..31d3dd8094 100644
--- a/frontend/src/views/sql-editor/TerminalPanel/TerminalPanel.vue
+++ b/frontend/src/views/sql-editor/TerminalPanel/TerminalPanel.vue
@@ -1,6 +1,6 @@
<template>
<div
- class="flex h-full w-full flex-col justify-start items-start overflow-hidden"
+ class="flex h-full w-full flex-col justify-start items-start overflow-hidden bg-dark-bg"
>
<EditorAction @execute="handleExecute" @clear-screen="handleClearScreen" />