25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
fix(meilisearch): hide generic new-query entry for meilisearch
二丫讲梵86115971fa41
diff --git a/apps/desktop/src/App.vue b/apps/desktop/src/App.vueindex ac5fe323c8..42d96ecd88 100644--- a/apps/desktop/src/App.vue+++ b/apps/desktop/src/App.vue@@ -139,7 +139,7 @@ import { countActiveUpdateBlockingTasks } from "@/lib/app/appUpdateTaskGuard";import { initSavedSqlEditorPositions } from "@/lib/app/savedSqlEditorPosition";import { hasTreeNodeDatabaseContext } from "@/lib/sidebar/treeNodeContext";import { objectBrowserTablesToAiTreeNodes } from "@/lib/ai/objectBrowserToAiTargets";-import { isSchemaAware, isSingleDatabase, usesTreeSchemaMode } from "@/lib/database/databaseFeatureSupport";+import { isSchemaAware, isSingleDatabase, supportsConnectionQueryActions, usesTreeSchemaMode } from "@/lib/database/databaseFeatureSupport";import { codeMirrorSqlDialect, connectionUsesDatabaseObjectTreeMode, effectiveDatabaseTypeForConnection } from "@/lib/database/jdbcDialect";import { canFormatSqlForDatabaseType, formatSqlForEditing, sqlFormatDialectForDbType } from "@/lib/sql/sqlFormatter";import { formatSqlSnapshotForSave } from "@/lib/sql/sqlFormatOnSave";@@ -750,6 +750,17 @@ const activeConnection = computed(() => {return tab ? connectionStore.getConfig(tab.connectionId) : undefined;});+function supportsGenericNewQuery(connection: ConnectionConfig | undefined): boolean {+ if (!connection) return false;+ // Some specialized connections use the same entry to open their dedicated+ // workbench (for example MQ or Nacos), so those remain valid actions even+ // though they do not support a generic SQL editor.+ if (quickConnectionOpenTarget(connection).kind !== "query") return true;+ return supportsConnectionQueryActions(effectiveDatabaseTypeForConnection(connection) ?? connection.db_type);+}++const canCreateNewQuery = computed(() => connectionStore.connections.some((connection) => supportsGenericNewQuery(connection)));+// Oracle manual-mode indicator derived from the RESOLVED database type (an// Oracle connection uses the agent runtime but reports db_type "oracle"), so// the toolbar's Commit/Rollback visibility can apply the Oracle dirty-state rule@@ -2571,7 +2582,7 @@ function openConnectionSettings(connectionId: string, initialTab: ConfigTab = "c}async function newQuery() {- const target = resolveNewQueryTarget({+ let target = resolveNewQueryTarget({activeTab: activeTab.value,selectedTreeNode: findTreeNodeById(connectionStore.treeNodes, connectionStore.selectedTreeNodeId),activeConnectionId: connectionStore.activeConnectionId,@@ -2579,8 +2590,24 @@ async function newQuery() {preferredSource: newQueryContextSource.value,});if (!target) return;- const conn = connectionStore.getConfig(target.connectionId);+ let conn = connectionStore.getConfig(target.connectionId);if (!conn) return;++ // Specialized stores such as Meilisearch expose their own workspaces and+ // must not receive a generic query tab. If the current context is such a+ // store, fall back to the first connection with a supported query/workbench+ // action.+ if (!supportsGenericNewQuery(conn)) {+ const fallbackConnection = connectionStore.connections.find((connection) => supportsGenericNewQuery(connection));+ if (!fallbackConnection) return;+ target = resolveNewQueryTarget({+ activeConnectionId: fallbackConnection.id,+ connections: connectionStore.connections,+ });+ if (!target) return;+ conn = connectionStore.getConfig(target.connectionId);+ if (!conn) return;+ }connectionStore.activeConnectionId = target.connectionId;const connectionTarget = quickConnectionOpenTarget(conn);if (connectionTarget.kind !== "query") {@@ -3929,6 +3956,7 @@ onUnmounted(() => {:agent-driver-update-count="showDriverStoreUpdateBadge":has-mcp-update-available="showMcpSettingsUpdateBadge":has-connections="connectionStore.connections.length > 0"+ :can-new-query="canCreateNewQuery":has-sql-file-connections="hasSqlFileConnections"@new-connection="showConnectionDialog = true"@expand-sidebar="setSidebarOpen(true)"@@ -4197,7 +4225,7 @@ onUnmounted(() => {:recent-connections="recentConnections":saved-sql-history-items="savedSqlHistoryItems":app-version="appVersion"- :has-connections="connectionStore.connections.length > 0"+ :can-new-query="canCreateNewQuery"@open-connection-query="openConnectionQuery"@open-saved-sql="openSavedSqlFromWelcome"@new-connection="showConnectionDialog = true"diff --git a/apps/desktop/src/components/layout/AppToolbar.vue b/apps/desktop/src/components/layout/AppToolbar.vueindex 17b9de322c..c87b66f589 100644--- a/apps/desktop/src/components/layout/AppToolbar.vue+++ b/apps/desktop/src/components/layout/AppToolbar.vue@@ -50,6 +50,7 @@ const props = defineProps<{agentDriverUpdateCount: number;hasMcpUpdateAvailable: boolean;hasConnections: boolean;+ canNewQuery: boolean;hasSqlFileConnections: boolean;}>();@@ -562,7 +563,7 @@ const toolbarStyle = computed(() => {</span></Button>- <Button variant="ghost" size="sm" :class="toolbarTextButtonClass" @click="emit('new-query')" :disabled="!hasConnections">+ <Button v-if="canNewQuery" variant="ghost" size="sm" :class="toolbarTextButtonClass" @click="emit('new-query')"><FilePlus2 class="h-3.5 w-3.5" /><span :class="toolbarTextLabelClass">{{ t("toolbar.newQuery") }}</span></Button>diff --git a/apps/desktop/src/components/layout/WelcomeScreen.vue b/apps/desktop/src/components/layout/WelcomeScreen.vueindex 281de77791..368d479727 100644--- a/apps/desktop/src/components/layout/WelcomeScreen.vue+++ b/apps/desktop/src/components/layout/WelcomeScreen.vue@@ -20,7 +20,7 @@ defineProps<{recentConnections: ConnectionConfig[];savedSqlHistoryItems: WelcomeSavedSqlHistoryItem[];appVersion: string;- hasConnections: boolean;+ canNewQuery: boolean;}>();const emit = defineEmits<{@@ -94,7 +94,7 @@ function welcomeConnectionSubtitle(connection: ConnectionConfig): string {<button class="flex min-w-0 items-center gap-2 overflow-hidden rounded-md px-3 py-2 text-left text-sm hover:bg-muted/50" @click="emit('new-connection')"><Plus class="h-4 w-4 shrink-0" /> <span class="min-w-0 truncate">{{ t("toolbar.newConnection") }}</span></button>- <button class="flex min-w-0 items-center gap-2 overflow-hidden rounded-md px-3 py-2 text-left text-sm hover:bg-muted/50" :disabled="!hasConnections" @click="emit('new-query')">+ <button v-if="canNewQuery" class="flex min-w-0 items-center gap-2 overflow-hidden rounded-md px-3 py-2 text-left text-sm hover:bg-muted/50" @click="emit('new-query')"><FilePlus2 class="h-4 w-4 shrink-0" /> <span class="min-w-0 truncate">{{ t("toolbar.newQuery") }}</span></button><button class="flex min-w-0 items-center gap-2 overflow-hidden rounded-md px-3 py-2 text-left text-sm hover:bg-muted/50" @click="emit('show-history')">diff --git a/apps/desktop/src/components/sidebar/SidebarTreeRuntimeHost.vue b/apps/desktop/src/components/sidebar/SidebarTreeRuntimeHost.vueindex 4f1ec7322f..032785eef2 100644--- a/apps/desktop/src/components/sidebar/SidebarTreeRuntimeHost.vue+++ b/apps/desktop/src/components/sidebar/SidebarTreeRuntimeHost.vue@@ -6078,9 +6078,17 @@ function buildSpecialSidebarMenu(context: SidebarMenuFactoryContext): boolean {if (node.type === "elasticsearch-index" || node.type === "vector-collection") {items.push({ label: t("contextMenu.copyName"), action: copyName, icon: Copy, shortcut: shortcutCopyName.value });- items.push({ label: "", separator: true });- items.push({ label: t("contextMenu.viewData"), action: toggle, icon: TableProperties });- items.push({ label: t("contextMenu.newQuery"), action: newQuery, icon: TerminalSquare });+ // Meilisearch indexes open through their dedicated search workspace; the+ // generic data/query actions are not valid for this connection type.+ const isMeilisearchIndex = currentDatabaseType() === "meilisearch";+ const hasAdditionalIndexActions = canRenameMongoCollection.value || canManageElasticsearchIndex.value || canDropMilvusCollection.value;+ if (!isMeilisearchIndex || hasAdditionalIndexActions) {+ items.push({ label: "", separator: true });+ }+ if (!isMeilisearchIndex) {+ items.push({ label: t("contextMenu.viewData"), action: toggle, icon: TableProperties });+ items.push({ label: t("contextMenu.newQuery"), action: newQuery, icon: TerminalSquare });+ }if (canRenameMongoCollection.value) {items.push({ label: t("contextMenu.renameObject"), action: openRenameMongoCollectionDialog, icon: Pencil, shortcut: shortcutRename });}diff --git a/apps/desktop/src/lib/__tests__/database/databaseFeatureSupport.spec.ts b/apps/desktop/src/lib/__tests__/database/databaseFeatureSupport.spec.tsindex 107ae02d87..633ff84425 100644--- a/apps/desktop/src/lib/__tests__/database/databaseFeatureSupport.spec.ts+++ b/apps/desktop/src/lib/__tests__/database/databaseFeatureSupport.spec.ts@@ -119,6 +119,10 @@ describe("connection query actions", () => {expect(supportsConnectionQueryActions("mq")).toBe(false);expect(supportsConnectionQueryActions("mqtt")).toBe(false);});++ it("hides the sidebar new-query entry for Meilisearch", () => {+ expect(supportsConnectionQueryActions("meilisearch")).toBe(false);+ });});describe("message queue query capabilities", () => {diff --git a/apps/desktop/src/lib/database/databaseFeatureSupport.ts b/apps/desktop/src/lib/database/databaseFeatureSupport.tsindex 241c282f24..fb669bbd17 100644--- a/apps/desktop/src/lib/database/databaseFeatureSupport.ts+++ b/apps/desktop/src/lib/database/databaseFeatureSupport.ts@@ -122,9 +122,13 @@ export function supportsClearableQuerySchema(dbType?: DatabaseType): boolean {* `mqtt`) belong to the same group: brokers have no SQL engine, and their* workbench is the MQ/MQTT admin tab. The sidebar entry used to open a plain* SQL editor against a broker (issue #8415).+ *+ * Meilisearch exposes its own index search and management workspaces rather+ * than a general-purpose SQL query surface, so the generic sidebar action is+ * hidden there as well (issue #9609).*/export function supportsConnectionQueryActions(dbType?: DatabaseType): boolean {- return dbType !== "nacos" && dbType !== "consul" && dbType !== "hbase" && dbType !== "zookeeper" && dbType !== "plugin" && dbType !== "mq" && dbType !== "mqtt";+ return dbType !== "nacos" && dbType !== "consul" && dbType !== "hbase" && dbType !== "zookeeper" && dbType !== "plugin" && dbType !== "mq" && dbType !== "mqtt" && dbType !== "meilisearch";}/**