Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: add feature type for batch query (#8574)
boojackce31ca1643bc
diff --git a/backend/legacyapi/plan.go b/backend/legacyapi/plan.goindex c9737841b6..85b0ed525f 100644--- a/backend/legacyapi/plan.go+++ b/backend/legacyapi/plan.go@@ -176,6 +176,11 @@ const (// approval chain definition.FeatureCustomApproval FeatureType = "bb.feature.custom-approval"+ // Efficiency.++ // FeatureBatchQuery enables batch query databases in SQL Editor.+ FeatureBatchQuery FeatureType = "bb.feature.batch-query"+// Collaboration.// FeatureSharedSQLScript enables sharing sql script.@@ -272,6 +277,9 @@ func (e FeatureType) Name() string {return "Access Control"case FeatureCustomApproval:return "Custom Approval"+ // Efficiency+ case FeatureBatchQuery:+ return "Batch query"// Collaborationcase FeatureSharedSQLScript:return "Shared SQL script"@@ -346,6 +354,8 @@ var FeatureMatrix = map[FeatureType][3]bool{FeatureSensitiveData: {false, false, true},FeatureAccessControl: {false, false, true},FeatureCustomApproval: {false, false, true},+ // Efficiency+ FeatureBatchQuery: {false, false, true},// CollaborationFeatureSharedSQLScript: {false, true, true},// Pluginsdiff --git a/frontend/src/composables/useExecuteSQL.ts b/frontend/src/composables/useExecuteSQL.tsindex 293be4594e..b715266ac4 100644--- a/frontend/src/composables/useExecuteSQL.ts+++ b/frontend/src/composables/useExecuteSQL.ts@@ -1,4 +1,4 @@-import { isEmpty } from "lodash-es";+import { cloneDeep, isEmpty } from "lodash-es";import { Status } from "nice-grpc-common";import { markRaw } from "vue";import { useI18n } from "vue-i18n";@@ -231,7 +231,7 @@ const useExecuteSQL = () => {// After all the queries are executed, we update the tab with the latest query result map.tabStore.updateTab(tab.id, {- databaseQueryResultMap: databaseQueryResultMap,+ databaseQueryResultMap: cloneDeep(databaseQueryResultMap),executeParams: {query,config,diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex 47d2c78e46..0bb716c607 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -2353,6 +2353,10 @@"title": "AI Augmentation","desc": "AI augmented SQL Editor and index advisor features powered by OpenAI."},+ "bb-feature-batch-query": {+ "title": "Batch query",+ "desc": "Batch query additional databases with the same label values in SQL Editor."+ },"bb-feature-shared-sql-script": {"title": "Shared SQL script","desc": "Share your SQL scripts with project teammates or make them public to all."diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex 9864146328..f357708626 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -2341,6 +2341,10 @@"title": "Aumento de AI","desc": "Editor de SQL aumentado con IA y características de asesoramiento de índice impulsadas por OpenAI."},+ "bb-feature-batch-query": {+ "title": "Consulta por lotes",+ "desc": "Consulta por lotes bases de datos adicionales con los mismos valores de etiqueta."+ },"bb-feature-shared-sql-script": {"title": "Script SQL compartido","desc": "Comparte tus scripts SQL con los compañeros de proyecto o hazlos públicos para todos."diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex 358cd3aff7..5ee18e238b 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -2344,6 +2344,10 @@"title": "AI 增强","desc": "AI 增强的 SQL 编辑器和索引建议功能,基于 OpenAI 技术驱动。"},+ "bb-feature-batch-query": {+ "title": "批量查询",+ "desc": "在 SQL Editor 中对同构数据库进行批量查询。"+ },"bb-feature-shared-sql-script": {"title": "共享 SQL 脚本","desc": "将 SQL 脚本分享给项目成员,或者公开给所有人。"diff --git a/frontend/src/types/plan.ts b/frontend/src/types/plan.tsindex 32474db562..8b81144f89 100644--- a/frontend/src/types/plan.ts+++ b/frontend/src/types/plan.ts@@ -52,6 +52,8 @@ export type FeatureType =| "bb.feature.sensitive-data"| "bb.feature.access-control"| "bb.feature.custom-approval"+ // Efficiency+ | "bb.feature.batch-query"// Collaboration| "bb.feature.shared-sql-script"// Pluginsdiff --git a/frontend/src/views/sql-editor/EditorCommon/AdminModeButton.vue b/frontend/src/views/sql-editor/EditorCommon/AdminModeButton.vueindex 84f735de74..4b9c0d6818 100644--- a/frontend/src/views/sql-editor/EditorCommon/AdminModeButton.vue+++ b/frontend/src/views/sql-editor/EditorCommon/AdminModeButton.vue@@ -63,7 +63,7 @@ const enterAdminMode = () => {});const queryItem = last(useWebTerminalV1Store().getQueryStateByTab(tabStore.currentTab)- .queryItemList.value+ .queryItemList.value || []);if (queryItem) {queryItem.sql = statement;diff --git a/frontend/src/views/sql-editor/EditorCommon/BatchQueryDatabasesSelector.vue b/frontend/src/views/sql-editor/EditorCommon/BatchQueryDatabasesSelector.vueindex cafdeec581..999bcf79ee 100644--- a/frontend/src/views/sql-editor/EditorCommon/BatchQueryDatabasesSelector.vue+++ b/frontend/src/views/sql-editor/EditorCommon/BatchQueryDatabasesSelector.vue@@ -1,15 +1,28 @@<template>- <NPopover placement="bottom" trigger="click">+ <NPopover+ placement="bottom"+ :disabled="!hasBatchQueryFeature"+ trigger="click"+ ><template #trigger><div- class="!ml-2 w-6 h-6 p-1 cursor-pointer rounded hover:opacity-80"- :class="- selectedLabelsValue.length > 0- ? 'text-accent bg-blue-50 shadow'- : 'text-gray-600'- "+ class="flex flex-row justify-start items-center gap-1"+ @click="handleTriggerClick">- <Layers class="w-4 h-auto" />+ <div+ class="!ml-2 min-w-[1.5rem] h-6 p-1 flex flex-row justify-center items-center gap-1 cursor-pointer rounded hover:opacity-80"+ :class="+ selectedLabelsValue.length > 0 && hasBatchQueryFeature+ ? 'text-accent bg-blue-50 shadow'+ : 'text-gray-600'+ "+ >+ <Layers class="w-4 h-auto" />+ <span v-if="selectedLabelsValue.length > 0"+ >({{ selectedLabelsValue.length }})</span+ >+ </div>+ <FeatureBadge feature="bb.feature.batch-query" /></div></template><div class="w-128">@@ -38,29 +51,45 @@</div></div></NPopover>++ <FeatureModal+ feature="bb.feature.batch-query"+ :open="state.showFeatureModal"+ @cancel="state.showFeatureModal = false"+ /></template><script lang="ts" setup>import { upperFirst } from "lodash-es";import { Layers } from "lucide-vue-next";import { NCheckboxGroup, NCheckbox, NPopover } from "naive-ui";-import { computed, ref, watch } from "vue";+import { computed, reactive, ref, watch } from "vue";import MatchedDatabaseView from "@/components/DatabaseGroup/MatchedDatabaseView.vue";import {+ hasFeature,useCurrentUserIamPolicy,useDatabaseV1ByUID,useDatabaseV1Store,useTabStore,} from "@/store/modules";+interface LocalState {+ showFeatureModal: boolean;+}+const databaseStore = useDatabaseV1Store();const tabStore = useTabStore();const currentUserIamPolicy = useCurrentUserIamPolicy();+const state = reactive<LocalState>({+ showFeatureModal: false,+});// Save the stringified label key-value pairs.const currentTab = computed(() => tabStore.currentTab);const connection = computed(() => currentTab.value.connection);const selectedLabelsValue = ref<string[]>([]);+const hasBatchQueryFeature = hasFeature("bb.feature.batch-query");+const { database: selectedDatabase } = useDatabaseV1ByUID(computed(() => String(connection.value.databaseId)));@@ -91,6 +120,12 @@ const labels = computed(() => {.flat();});+const handleTriggerClick = () => {+ if (!hasBatchQueryFeature) {+ state.showFeatureModal = true;+ }+};+const getFilteredDatabaseLabels = (labels: { [key: string]: string }) => {// Filter out the environment label.const keys = Object.keys(labels).filter((key) => {diff --git a/frontend/src/views/sql-editor/EditorCommon/EditorAction.vue b/frontend/src/views/sql-editor/EditorCommon/EditorAction.vueindex 4c7f1c6ee3..ba684fd15f 100644--- a/frontend/src/views/sql-editor/EditorCommon/EditorAction.vue+++ b/frontend/src/views/sql-editor/EditorCommon/EditorAction.vue@@ -206,8 +206,10 @@ const showClearScreen = computed(() => {});const queryList = computed(() => {- return webTerminalStore.getQueryStateByTab(tabStore.currentTab).queryItemList- .value;+ return (+ webTerminalStore.getQueryStateByTab(tabStore.currentTab).queryItemList+ .value || []+ );});const handleRunQuery = async () => {diff --git a/frontend/src/views/sql-editor/ResultPanel/ResultPanel.vue b/frontend/src/views/sql-editor/ResultPanel/ResultPanel.vueindex 39161affcb..e441077063 100644--- a/frontend/src/views/sql-editor/ResultPanel/ResultPanel.vue+++ b/frontend/src/views/sql-editor/ResultPanel/ResultPanel.vue@@ -19,6 +19,9 @@><template #trigger><NButton+ secondary+ strong+ size="small":type="selectedDatabase === database ? 'primary' : 'default'"@click="selectedDatabase = database">