diff --git a/apps/desktop/src/components/connection/ConnectionDialog.vue b/apps/desktop/src/components/connection/ConnectionDialog.vue index ada4bc48e..e95a85ed9 100644 --- a/apps/desktop/src/components/connection/ConnectionDialog.vue +++ b/apps/desktop/src/components/connection/ConnectionDialog.vue @@ -4,12 +4,14 @@ import { uuid } from "@/lib/utils"; import { useI18n } from "vue-i18n"; import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from "@/components/ui/dialog"; import { Button } from "@/components/ui/button"; +import { Badge } from "@/components/ui/badge"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip"; import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"; +import { Switch } from "@/components/ui/switch"; import type { ConnectionConfig, DatabaseType, JdbcDriverInfo, JdbcMavenBundleInfo, ProxyTunnelConfig, SshTunnelConfig, TransportLayerConfig } from "@/types/database"; import { useConnectionStore } from "@/stores/connectionStore"; import { useSettingsStore } from "@/stores/settingsStore"; @@ -254,6 +256,7 @@ const jdbcDrivers = ref([]); const jdbcMavenBundles = ref([]); const agentDrivers = ref([]); const selectedJdbcDriverPath = ref(""); +const jdbcManualClasspathOpen = ref(false); const connectionUrlInput = ref(""); const oceanbaseSubMode = ref<"mysql" | "oracle">("mysql"); const h2ConnectionMode = ref("file"); @@ -293,6 +296,13 @@ const jdbcDriverSelectItems = computed(() => { }); const jdbcDriverSelectItemById = computed(() => new Map(jdbcDriverSelectItems.value.map((item) => [item.id, item]))); +const jdbcManualClasspathCount = computed( + () => + jdbcDriverPathsInput.value + .split(/\r?\n/) + .map((value) => value.trim()) + .filter(Boolean).length, +); function applyCustomColor(value: string) { form.value.color = value; @@ -751,7 +761,7 @@ const iconTypeMap: Record = { custom_postgres: "postgres", }; -const dbOptions = [ +const dbOptions: DbOption[] = [ { value: "postgres", label: "PostgreSQL" }, { value: "mysql", label: "MySQL" }, { value: "mongodb", label: "MongoDB" }, @@ -811,12 +821,19 @@ const dbOptions = [ { value: "influxdb", label: "InfluxDB" }, { value: "iris", label: "IRIS" }, { value: "jdbc", label: "JDBC" }, - { value: "custom_mysql", label: "Custom (MySQL)" }, - { value: "custom_postgres", label: "Custom (PostgreSQL)" }, ]; const dbCategories = computed(() => [{ key: "all", title: "", options: dbOptions }]); +function matchesDbOption(option: DbOption, keyword: string, categoryTitle = "") { + const profile = driverProfiles[option.value]; + return [option.label, option.value, profile?.label, profile?.type, categoryTitle].some((value) => + String(value || "") + .toLowerCase() + .includes(keyword), + ); +} + const filteredDbCategories = computed(() => { const keyword = dbSearchQuery.value.trim().toLowerCase(); if (!keyword) return dbCategories.value; @@ -824,14 +841,7 @@ const filteredDbCategories = computed(() => { return dbCategories.value .map((category) => ({ ...category, - options: category.options.filter((option) => { - const profile = driverProfiles[option.value]; - return [option.label, option.value, profile?.label, profile?.type, category.title].some((value) => - String(value || "") - .toLowerCase() - .includes(keyword), - ); - }), + options: category.options.filter((option) => matchesDbOption(option, keyword, category.title)), })) .filter((category) => category.options.length > 0); }); @@ -2003,6 +2013,7 @@ function onJdbcDriverSelect(id: any) { if (!item) return; selectedJdbcDriverPath.value = id; addJdbcDriverPaths(item.paths); + jdbcManualClasspathOpen.value = false; } function openExternalUrl(url: string) { @@ -2043,7 +2054,7 @@ function openExternalUrl(url: string) {
-

{{ category.title }}

+

{{ category.title }}

@@ -2229,10 +2240,6 @@ function openExternalUrl(url: string) {
-
- - -
@@ -2246,7 +2253,16 @@ function openExternalUrl(url: string) { -
+
+
+
{{ t("connection.jdbcManualClasspath") }}
+ + {{ t("connection.jdbcManualClasspathCount", { count: jdbcManualClasspathCount }) }} + +
+ +
+