Skip to content

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

feat(frontend): show sql execute in protected environment banner (#2383)

Liu Ji0cd110dc4b53
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index c3451616af..5e939b77dc 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -1261,7 +1261,8 @@
"sql-review-result": "SQL review result",
"alter-table": "Alter table",
"open-connection": "Open connection",
- "visualize-explain": "Visualize Explain"
+ "visualize-explain": "Visualize Explain",
+ "sql-execute-in-protected-environment": "The SQL statement below will be executed in a protected environment."
},
"label": {
"empty-label-value": "<Empty Value>",
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 6026c05f1a..aea2b6870f 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -1262,7 +1262,8 @@
"sql-review-result": "SQL 检查结果",
"alter-table": "修改表结构",
"open-connection": "打开连接",
- "visualize-explain": "可视化 Explain"
+ "visualize-explain": "可视化 Explain",
+ "sql-execute-in-protected-environment": "下面的 SQL 语句将会在受保护的环境中执行。"
},
"label": {
"empty-label-value": "<空值>",
diff --git a/frontend/src/views/sql-editor/EditorPanel/EditorPanel.vue b/frontend/src/views/sql-editor/EditorPanel/EditorPanel.vue
index 3f8af8ea0e..3136164db1 100644
--- a/frontend/src/views/sql-editor/EditorPanel/EditorPanel.vue
+++ b/frontend/src/views/sql-editor/EditorPanel/EditorPanel.vue
@@ -2,6 +2,13 @@
<div class="flex h-full w-full flex-col justify-start items-start">
<EditorAction @save-sheet="handleSaveSheet" />
+ <div
+ v-if="isProtectedEnvironment"
+ class="w-full py-1 px-4 bg-warning text-white"
+ >
+ {{ $t("sql-editor.sql-execute-in-protected-environment") }}
+ </div>
+
<template v-if="!sqlEditorStore.isDisconnected">
<SQLEditor @save-sheet="handleSaveSheet" />
</template>
@@ -27,9 +34,14 @@
</template>
<script lang="ts" setup>
-import { ref } from "vue";
+import { computed, ref } from "vue";
-import { useTabStore, useSQLEditorStore, useSheetStore } from "@/store";
+import {
+ useTabStore,
+ useSQLEditorStore,
+ useSheetStore,
+ useInstanceStore,
+} from "@/store";
import { defaultTabName } from "@/utils/tab";
import EditorAction from "./EditorAction.vue";
import SQLEditor from "./SQLEditor.vue";
@@ -40,9 +52,16 @@ import SaveSheetModal from "./SaveSheetModal.vue";
const tabStore = useTabStore();
const sqlEditorStore = useSQLEditorStore();
const sheetStore = useSheetStore();
+const instanceStore = useInstanceStore();
const isShowSaveSheetModal = ref(false);
+const isProtectedEnvironment = computed(() => {
+ const { instanceId } = sqlEditorStore.connectionContext;
+ const instance = instanceStore.getInstanceById(instanceId);
+ return instance.environment.tier === "PROTECTED";
+});
+
const handleClose = () => {
sqlEditorStore.setSQLEditorState({
isShowExecutingHint: false,