feat(oracle): support oci thick connections via windows agent
This commit is contained in:
1 parent
a1e2d39ed3
commit
8d9e2dc49f
92 files changed
+2551
-143
No files matched your search
@@ -71,6 +71,7 @@ import {
|
||||
} from "@/lib/plugins/frontendPlugin";
|
||||
import type { PluginCenterFocus } from "@/lib/plugins/pluginCenterNavigation";
|
||||
import { isTauriRuntime } from "@/lib/backend/tauriRuntime";
|
||||
import { isWindows } from "@/lib/backend/platform";
|
||||
import { applyMeilisearchBasePathToExternalConfig, applyParsedConnectionUrl, normalizeMongoConnectionString, parseConnectionUrl } from "@/lib/connection/connectionUrl";
|
||||
import { hasXuguConnectionDatabase } from "@/lib/connection/xuguDatabase";
|
||||
import { DEFAULT_QUERY_TIMEOUT_SECS, MAX_CONNECT_TIMEOUT_SECS, MAX_QUERY_TIMEOUT_SECS } from "@/lib/connection/timeoutLimits";
|
||||
@@ -141,6 +142,7 @@ import {
|
||||
Pipette,
|
||||
Plus,
|
||||
RefreshCw,
|
||||
Save,
|
||||
Search,
|
||||
ShieldAlert,
|
||||
ShieldCheck,
|
||||
@@ -422,6 +424,8 @@ const defaultForm = (): ConnectionForm => ({
|
||||
client_cert_path: "",
|
||||
client_key_path: "",
|
||||
sysdba: false,
|
||||
oracle_oci_nls_lang: "",
|
||||
oracle_oci_tns_admin: "",
|
||||
oracle_connection_type: "service_name",
|
||||
connection_string: undefined,
|
||||
jdbc_driver_class: undefined,
|
||||
@@ -807,6 +811,8 @@ const appliedConnectionUrlInput = ref("");
|
||||
const meilisearchHostInput = ref("");
|
||||
const appliedMeilisearchHostInput = ref("");
|
||||
const oracleTnsAdminPath = ref("");
|
||||
/** 每次进入 OCI 模式只提醒一次 Instant Client 目录,避免反复点“测试”时刷屏。 */
|
||||
const oracleOciClientPathReminded = ref(false);
|
||||
const oceanbaseSubMode = ref<"mysql" | "oracle">("mysql");
|
||||
const h2ConnectionMode = ref<H2ConnectionMode>("file");
|
||||
const dremioConnectionMode = ref<DremioConnectionMode>("legacy");
|
||||
@@ -3105,6 +3111,8 @@ watch(
|
||||
idle_timeout_secs: config.idle_timeout_secs ?? 60,
|
||||
keepalive_interval_secs: config.keepalive_interval_secs ?? 30,
|
||||
sysdba: config.sysdba || isOracleSysUser(config),
|
||||
oracle_oci_nls_lang: config.oracle_oci_nls_lang || "",
|
||||
oracle_oci_tns_admin: config.oracle_oci_tns_admin || "",
|
||||
oracle_connection_type: config.oracle_connection_type || "service_name",
|
||||
connection_string: config.connection_string,
|
||||
jdbc_driver_class: config.db_type === "sundb" ? sundbJdbcDriverClass(config) : config.jdbc_driver_class,
|
||||
@@ -3467,6 +3475,156 @@ function switchH2DriverProfile(profile: "h2" | "h2-v1" | "h2-v2" | "h2-v3" | "h2
|
||||
resetTestState();
|
||||
}
|
||||
|
||||
/**
|
||||
* Oracle driver mode: thin (go-ora agent, default) or OCI (thick driver,
|
||||
* requires a globally configured Oracle Instant Client). The oci.dll path
|
||||
* lives in the global settings on purpose — one configuration is shared by
|
||||
* every OCI connection, and new OCI connections backfill it automatically.
|
||||
*/
|
||||
// OCI(thick)驱动目前只发布 Windows x64 产物:非 Windows 平台不显示模式切换,
|
||||
// 避免用户选到无法安装的驱动。已保存的 OCI 连接仍按原样打开(连接时会得到
|
||||
// 明确的“驱动未安装”错误),并把 Thin 按钮留在原地便于切回。
|
||||
const oracleOciDriverSelectable = isWindows();
|
||||
|
||||
function switchOracleDriverMode(mode: "thin" | "oci") {
|
||||
form.value.driver_profile = mode === "oci" ? "oci" : "oracle";
|
||||
oracleOciClientPathReminded.value = false;
|
||||
resetTestState();
|
||||
}
|
||||
|
||||
function persistOracleOciClientPath() {
|
||||
void settingsStore.updateEditorSettings({
|
||||
oracleOciClientPath: settingsStore.editorSettings.oracleOciClientPath,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* NLS_LANG is a per-connection override: an empty value follows the global
|
||||
* default, a filled value makes this connection own a dedicated agent process
|
||||
* (the variable is process-scoped for OCI). The dropdown lists the common
|
||||
* client character sets; the save button promotes the current value to the
|
||||
* global default for reuse.
|
||||
*/
|
||||
const OCI_NLS_LANG_FOLLOW_GLOBAL = "__follow_global__";
|
||||
const ORACLE_NLS_LANG_OPTIONS = [
|
||||
"AMERICAN_AMERICA.AL32UTF8",
|
||||
"AMERICAN_AMERICA.UTF8",
|
||||
"AMERICAN_AMERICA.WE8ISO8859P1",
|
||||
"AMERICAN_AMERICA.ZHS16GBK",
|
||||
"SIMPLIFIED CHINESE_CHINA.AL32UTF8",
|
||||
"SIMPLIFIED CHINESE_CHINA.ZHS16GBK",
|
||||
"TRADITIONAL CHINESE_TAIWAN.AL32UTF8",
|
||||
"TRADITIONAL CHINESE_TAIWAN.ZHT16MSWIN950",
|
||||
"JAPANESE_JAPAN.AL32UTF8",
|
||||
"JAPANESE_JAPAN.JA16SJIS",
|
||||
"KOREAN_KOREA.AL32UTF8",
|
||||
"KOREAN_KOREA.KO16MSWIN949",
|
||||
] as const;
|
||||
|
||||
const oracleOciNlsLangSelection = computed(() => (form.value.oracle_oci_nls_lang?.trim() ? form.value.oracle_oci_nls_lang.trim() : OCI_NLS_LANG_FOLLOW_GLOBAL));
|
||||
|
||||
/** A stored value that predates the preset list must stay selectable. */
|
||||
const oracleOciNlsLangCustomValue = computed(() => {
|
||||
const value = form.value.oracle_oci_nls_lang?.trim();
|
||||
if (!value) return null;
|
||||
return (ORACLE_NLS_LANG_OPTIONS as readonly string[]).includes(value) ? null : value;
|
||||
});
|
||||
|
||||
const oracleOciNlsLangPlaceholder = computed(() => {
|
||||
const globalValue = settingsStore.editorSettings.oracleOciNlsLang?.trim();
|
||||
return globalValue ? t("connection.oracleOciNlsLangPlaceholderGlobal", { value: globalValue }) : t("connection.oracleOciNlsLangPlaceholder");
|
||||
});
|
||||
|
||||
/** Names the global default in effect, so promoting a value becomes visible in place. */
|
||||
const oracleOciNlsLangFollowGlobalLabel = computed(() => {
|
||||
const globalValue = settingsStore.editorSettings.oracleOciNlsLang?.trim();
|
||||
return globalValue ? t("connection.oracleOciNlsLangFollowGlobalValue", { value: globalValue }) : t("connection.oracleOciNlsLangFollowGlobal");
|
||||
});
|
||||
|
||||
function onOciNlsLangSelected(value: unknown) {
|
||||
const selected = typeof value === "string" ? value : "";
|
||||
form.value.oracle_oci_nls_lang = selected === OCI_NLS_LANG_FOLLOW_GLOBAL ? "" : selected;
|
||||
resetTestState();
|
||||
}
|
||||
|
||||
async function saveOciNlsLangAsGlobalDefault() {
|
||||
const value = form.value.oracle_oci_nls_lang?.trim();
|
||||
if (!value) {
|
||||
toast(t("connection.oracleOciNlsLangSaveGlobalEmpty"), 3000);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await settingsStore.updateEditorSettingsAndPersist({ oracleOciNlsLang: value });
|
||||
toast(t("connection.oracleOciNlsLangSavedGlobal", { value }), 3000);
|
||||
} catch (error) {
|
||||
toast(error instanceof Error ? error.message : String(error), 5000);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 连接级 TNS_ADMIN(tnsnames.ora / sqlnet.ora / 钱包目录):留空跟随全局默认,
|
||||
* 填写后本连接使用自己的目录——ADB 钱包、sqlnet.ora 网络选项因此不依赖
|
||||
* TNS 连接方式。目录同样是进程级的,随 agent 启动注入。
|
||||
*/
|
||||
const oracleOciTnsAdminPlaceholder = computed(() => {
|
||||
const globalValue = settingsStore.editorSettings.oracleOciTnsAdmin?.trim();
|
||||
return globalValue ? t("connection.oracleOciTnsAdminPlaceholderGlobal", { value: globalValue }) : t("connection.oracleTnsAdminPlaceholder");
|
||||
});
|
||||
|
||||
async function saveOciTnsAdminAsGlobalDefault() {
|
||||
const value = form.value.oracle_oci_tns_admin?.trim();
|
||||
if (!value) {
|
||||
toast(t("connection.oracleOciTnsAdminSaveGlobalEmpty"), 3000);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await settingsStore.updateEditorSettingsAndPersist({ oracleOciTnsAdmin: value });
|
||||
toast(t("connection.oracleOciTnsAdminSavedGlobal", { value }), 3000);
|
||||
} catch (error) {
|
||||
toast(error instanceof Error ? error.message : String(error), 5000);
|
||||
}
|
||||
}
|
||||
|
||||
async function browseOciTnsAdminDirectory() {
|
||||
if (!isTauriRuntime()) {
|
||||
toast(t("connection.oraclePathPickerDesktopOnly"));
|
||||
return;
|
||||
}
|
||||
const { open } = await import("@tauri-apps/plugin-dialog");
|
||||
const selected = await open({
|
||||
title: t("connection.oracleTnsAdminBrowse"),
|
||||
directory: true,
|
||||
multiple: false,
|
||||
});
|
||||
if (typeof selected === "string") {
|
||||
form.value.oracle_oci_tns_admin = selected;
|
||||
resetTestState();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prompts for the Oracle Instant Client directory. The desktop shell is the
|
||||
* only runtime that can resolve a local path, so the picker explains itself
|
||||
* on the web build instead of silently doing nothing.
|
||||
*/
|
||||
async function browseOciClientDirectory() {
|
||||
if (!isTauriRuntime()) {
|
||||
toast(t("connection.oraclePathPickerDesktopOnly"));
|
||||
return;
|
||||
}
|
||||
const { open } = await import("@tauri-apps/plugin-dialog");
|
||||
const selected = await open({
|
||||
title: t("connection.oracleOciPathBrowse"),
|
||||
directory: true,
|
||||
multiple: false,
|
||||
});
|
||||
if (typeof selected === "string") {
|
||||
settingsStore.editorSettings.oracleOciClientPath = selected;
|
||||
persistOracleOciClientPath();
|
||||
resetTestState();
|
||||
}
|
||||
}
|
||||
|
||||
const damengDriverMode = computed(() => damengDriverModeForConfig(form.value));
|
||||
const isDamengCustomDriver = computed(() => form.value.db_type === "dameng" && damengDriverMode.value === "custom");
|
||||
|
||||
@@ -4718,6 +4876,11 @@ function connectionConfigForSubmit(id: string, generatedName = "", validatePlugi
|
||||
// service, SID, and descriptor JDBC strings exactly as before.
|
||||
config.connection_string = undefined;
|
||||
}
|
||||
if (config.db_type === "oracle" && config.driver_profile === "oci" && !settingsStore.editorSettings.oracleOciClientPath?.trim() && !oracleOciClientPathReminded.value) {
|
||||
// 非阻断提醒:没有配置 Instant Client 目录时,agent 进程只能依赖系统 PATH 里已有的 oci.dll。
|
||||
oracleOciClientPathReminded.value = true;
|
||||
toast(t("connection.oracleOciClientPathMissing"), 5000);
|
||||
}
|
||||
normalizeConnectionTimeouts(config, editGlobalConnectTimeoutSecs.value, editGlobalQueryTimeoutSecs.value);
|
||||
if (config.db_type === "manticoresearch") {
|
||||
config.url_params = "";
|
||||
@@ -4947,9 +5110,25 @@ function connectionConfigForSubmit(id: string, generatedName = "", validatePlugi
|
||||
if (config.db_type !== "oracle") {
|
||||
config.sysdba = undefined;
|
||||
config.oracle_connection_type = undefined;
|
||||
config.oracle_oci_nls_lang = undefined;
|
||||
config.oracle_oci_tns_admin = undefined;
|
||||
} else {
|
||||
config.sysdba = !!config.sysdba || isOracleSysUser(config);
|
||||
config.oracle_connection_type = config.oracle_connection_type || "service_name";
|
||||
// Driver mode is encoded as the driver profile so the agent router picks
|
||||
// the OCI (thick) agent; everything else stays on the thin agent.
|
||||
if (config.driver_profile === "oci") {
|
||||
config.driver_label = "Oracle (OCI)";
|
||||
config.oracle_oci_nls_lang = config.oracle_oci_nls_lang?.trim() || undefined;
|
||||
config.oracle_oci_tns_admin = config.oracle_oci_tns_admin?.trim() || undefined;
|
||||
} else {
|
||||
// Only default when empty: saved legacy profiles (oracle-legacy,
|
||||
// oracle-10g) must survive edits untouched.
|
||||
if (!config.driver_profile) config.driver_profile = "oracle";
|
||||
config.driver_label = "Oracle";
|
||||
config.oracle_oci_nls_lang = undefined;
|
||||
config.oracle_oci_tns_admin = undefined;
|
||||
}
|
||||
}
|
||||
if (config.db_type !== "redis") {
|
||||
config.redis_connection_mode = undefined;
|
||||
@@ -6639,12 +6818,17 @@ async function browseHiveKerberosFile(target: "krb5" | "jaas") {
|
||||
}
|
||||
|
||||
async function browseOracleTnsNamesFile() {
|
||||
if (!isTauriRuntime()) return;
|
||||
// TNS_ADMIN is a directory; accept a folder pick. Desktop-only, so the web
|
||||
// build gets an explanation instead of a silent no-op.
|
||||
if (!isTauriRuntime()) {
|
||||
toast(t("connection.oraclePathPickerDesktopOnly"));
|
||||
return;
|
||||
}
|
||||
const { open } = await import("@tauri-apps/plugin-dialog");
|
||||
const selected = await open({
|
||||
title: t("connection.oracleTnsAdminBrowse"),
|
||||
directory: true,
|
||||
multiple: false,
|
||||
filters: [{ name: "Oracle TNS names", extensions: ["ora"] }],
|
||||
});
|
||||
if (typeof selected === "string") {
|
||||
oracleTnsAdminPath.value = normalizeOracleTnsAdminPath(selected);
|
||||
@@ -8938,11 +9122,99 @@ function openExternalUrl(url: string) {
|
||||
<SpannerConnectionFields v-model:database="form.database" @change="resetTestState" />
|
||||
</template>
|
||||
|
||||
<div v-if="form.db_type === 'oracle' && (oracleOciDriverSelectable || form.driver_profile === 'oci')" class="grid grid-cols-4 items-center gap-4">
|
||||
<Label :class="connectionLabelSmallClass">{{ t("connection.oracleDriverMode") }}</Label>
|
||||
<div class="col-span-3 flex gap-2">
|
||||
<Button size="sm" :variant="form.driver_profile !== 'oci' ? 'default' : 'outline'" @click="switchOracleDriverMode('thin')"> Thin </Button>
|
||||
<Button v-if="oracleOciDriverSelectable" size="sm" :variant="form.driver_profile === 'oci' ? 'default' : 'outline'" @click="switchOracleDriverMode('oci')"> OCI </Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<template v-if="form.db_type === 'oracle' && form.driver_profile === 'oci'">
|
||||
<div class="grid grid-cols-4 items-center gap-4">
|
||||
<Label :class="connectionLabelSmallClass">oci.dll</Label>
|
||||
<div class="col-span-3 flex items-center gap-1">
|
||||
<Input v-model="settingsStore.editorSettings.oracleOciClientPath" class="flex-1 font-mono" :placeholder="t('connection.oracleOciPathPlaceholder')" @change="persistOracleOciClientPath" />
|
||||
<Tooltip>
|
||||
<TooltipTrigger as-child>
|
||||
<Button variant="outline" size="icon" class="h-9 w-9 shrink-0" @click="browseOciClientDirectory">
|
||||
<FolderOpen class="h-4 w-4" />
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>{{ t("connection.oracleOciPathBrowse") }}</TooltipContent>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid grid-cols-4 items-start gap-4">
|
||||
<span />
|
||||
<p class="col-span-3 text-xs text-muted-foreground">{{ t("connection.oracleOciPathHint") }}</p>
|
||||
</div>
|
||||
<div class="grid grid-cols-4 items-center gap-4">
|
||||
<Label :class="connectionLabelSmallClass">NLS_LANG</Label>
|
||||
<div class="col-span-3 flex items-center gap-1">
|
||||
<Select :model-value="oracleOciNlsLangSelection" @update:model-value="onOciNlsLangSelected">
|
||||
<SelectTrigger class="flex-1 font-mono" aria-label="NLS_LANG">
|
||||
<SelectValue :placeholder="oracleOciNlsLangPlaceholder" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem :value="OCI_NLS_LANG_FOLLOW_GLOBAL">
|
||||
{{ oracleOciNlsLangFollowGlobalLabel }}
|
||||
</SelectItem>
|
||||
<SelectItem v-for="option in ORACLE_NLS_LANG_OPTIONS" :key="option" :value="option">
|
||||
{{ option }}
|
||||
</SelectItem>
|
||||
<SelectItem v-if="oracleOciNlsLangCustomValue" :value="oracleOciNlsLangCustomValue">
|
||||
{{ oracleOciNlsLangCustomValue }}
|
||||
</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<Tooltip>
|
||||
<TooltipTrigger as-child>
|
||||
<Button variant="outline" size="icon" class="h-9 w-9 shrink-0" :aria-label="t('connection.oracleOciNlsLangSaveGlobal')" @click="saveOciNlsLangAsGlobalDefault">
|
||||
<Save class="h-4 w-4" />
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>{{ t("connection.oracleOciNlsLangSaveGlobal") }}</TooltipContent>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid grid-cols-4 items-start gap-4">
|
||||
<span />
|
||||
<p class="col-span-3 text-xs text-muted-foreground">{{ t("connection.oracleOciNlsLangHint") }}</p>
|
||||
</div>
|
||||
<div class="grid grid-cols-4 items-center gap-4">
|
||||
<Label :class="connectionLabelSmallClass">TNS_ADMIN</Label>
|
||||
<div class="col-span-3 flex items-center gap-1">
|
||||
<Input v-model="form.oracle_oci_tns_admin" class="flex-1 font-mono" :placeholder="oracleOciTnsAdminPlaceholder" @change="resetTestState" />
|
||||
<Tooltip>
|
||||
<TooltipTrigger as-child>
|
||||
<Button variant="outline" size="icon" class="h-9 w-9 shrink-0" :aria-label="t('connection.oracleTnsAdminBrowse')" @click="browseOciTnsAdminDirectory">
|
||||
<FolderOpen class="h-4 w-4" />
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>{{ t("connection.oracleTnsAdminBrowse") }}</TooltipContent>
|
||||
</Tooltip>
|
||||
<Tooltip>
|
||||
<TooltipTrigger as-child>
|
||||
<Button variant="outline" size="icon" class="h-9 w-9 shrink-0" :aria-label="t('connection.oracleOciTnsAdminSaveGlobal')" @click="saveOciTnsAdminAsGlobalDefault">
|
||||
<Save class="h-4 w-4" />
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>{{ t("connection.oracleOciTnsAdminSaveGlobal") }}</TooltipContent>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid grid-cols-4 items-start gap-4">
|
||||
<span />
|
||||
<p class="col-span-3 text-xs text-muted-foreground">{{ t("connection.oracleOciTnsAdminHint") }}</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div v-if="form.db_type === 'oracle' && form.oracle_connection_type === 'tns'" class="grid grid-cols-4 items-center gap-4">
|
||||
<Label :class="connectionLabelSmallClass">TNS_ADMIN</Label>
|
||||
<div class="col-span-3 flex items-center gap-1">
|
||||
<Input v-model="oracleTnsAdminPath" class="flex-1" :placeholder="t('connection.oracleTnsAdminPlaceholder')" />
|
||||
<Tooltip v-if="isDesktop">
|
||||
<Tooltip>
|
||||
<TooltipTrigger as-child>
|
||||
<Button variant="outline" size="icon" class="h-9 w-9 shrink-0" @click="browseOracleTnsNamesFile">
|
||||
<FolderOpen class="h-4 w-4" />
|
||||
|
||||
+232
@@ -0,0 +1,232 @@
|
||||
// @vitest-environment happy-dom
|
||||
|
||||
import { createApp, defineComponent, h, nextTick, reactive, type App } from "vue";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import i18n from "@/i18n";
|
||||
import type { ConnectionConfig } from "@/types/database";
|
||||
|
||||
const { store, settings, backend, platformState } = vi.hoisted(() => ({
|
||||
store: {
|
||||
connectionGroupOptions: [],
|
||||
newConnectionGroupId: null,
|
||||
selectedConnectionGroupId: null,
|
||||
addConnection: vi.fn(),
|
||||
updateConnection: vi.fn(),
|
||||
connect: vi.fn(),
|
||||
ensureConnected: vi.fn(),
|
||||
addEphemeralConnection: vi.fn(),
|
||||
removeConnection: vi.fn(),
|
||||
startEditing: vi.fn(),
|
||||
stopEditing: vi.fn(),
|
||||
clearConnectionError: vi.fn(),
|
||||
updateConnectionDatabaseInfo: vi.fn(),
|
||||
applyGlobalTimeouts: vi.fn((config) => config),
|
||||
getConfig: vi.fn(),
|
||||
},
|
||||
settings: {
|
||||
editorSettings: { sidebarShowConnectionNotes: false, globalConnectTimeoutSecs: 10, globalQueryTimeoutSecs: 0 },
|
||||
rememberedDatabaseForConnection: vi.fn(() => ""),
|
||||
persistEditorSettings: vi.fn(),
|
||||
updateEditorSettings: vi.fn(),
|
||||
updateEditorSettingsAndPersist: vi.fn(),
|
||||
},
|
||||
backend: {
|
||||
connectDb: vi.fn(),
|
||||
disconnectDb: vi.fn(),
|
||||
testConnectionWithInfo: vi.fn(),
|
||||
listDatabases: vi.fn(),
|
||||
listPlugins: vi.fn(),
|
||||
listJdbcDrivers: vi.fn(),
|
||||
listJdbcMavenBundles: vi.fn(),
|
||||
listJdbcLocalBundles: vi.fn(),
|
||||
listSshConfigHosts: vi.fn(),
|
||||
listInstalledAgentsLocal: vi.fn(),
|
||||
listenAgentInstallProgress: vi.fn(),
|
||||
},
|
||||
platformState: { windows: true },
|
||||
}));
|
||||
|
||||
vi.mock("@/stores/connectionStore", () => ({ useConnectionStore: () => store, CONNECTION_ATTEMPT_CANCELLED_MESSAGE: "cancelled" }));
|
||||
vi.mock("@/stores/settingsStore", async (original) => ({ ...(await original<typeof import("@/stores/settingsStore")>()), useSettingsStore: () => settings }));
|
||||
vi.mock("@/stores/tunnelProfileStore", () => ({ useTunnelProfileStore: () => ({ profiles: [], profileById: () => undefined, init: vi.fn() }) }));
|
||||
vi.mock("@/lib/backend/api", async (original) => ({ ...(await original<typeof import("@/lib/backend/api")>()), ...backend }));
|
||||
vi.mock("@/lib/backend/tauriRuntime", () => ({ isTauriRuntime: () => false }));
|
||||
vi.mock("@/lib/backend/platform", async (original) => ({
|
||||
...(await original<typeof import("@/lib/backend/platform")>()),
|
||||
isWindows: () => platformState.windows,
|
||||
}));
|
||||
vi.mock("@/composables/useToast", () => ({ useToast: () => ({ toast: vi.fn() }) }));
|
||||
|
||||
vi.mock("@/components/ui/dialog", async () => {
|
||||
const { defineComponent, h } = await import("vue");
|
||||
const passthrough = defineComponent({
|
||||
setup:
|
||||
(_props, { slots }) =>
|
||||
() =>
|
||||
h("div", slots.default?.()),
|
||||
});
|
||||
const Dialog = defineComponent({
|
||||
props: { open: Boolean },
|
||||
emits: ["update:open"],
|
||||
setup:
|
||||
(props, { slots, emit }) =>
|
||||
() =>
|
||||
props.open ? h("section", [h("button", { "data-testid": "dismiss-dialog", onClick: () => emit("update:open", false) }, "Dismiss"), slots.default?.()]) : null,
|
||||
});
|
||||
return { Dialog, DialogContent: passthrough, DialogHeader: passthrough, DialogTitle: passthrough, DialogFooter: passthrough };
|
||||
});
|
||||
vi.mock("@/components/ui/button", async () => {
|
||||
const { defineComponent, h } = await import("vue");
|
||||
return {
|
||||
Button: defineComponent({
|
||||
inheritAttrs: false,
|
||||
setup:
|
||||
(_props, { attrs, slots }) =>
|
||||
() =>
|
||||
h("button", attrs, slots.default?.()),
|
||||
}),
|
||||
};
|
||||
});
|
||||
vi.mock("@/components/ui/input", async () => {
|
||||
const { defineComponent, h } = await import("vue");
|
||||
return {
|
||||
Input: defineComponent({
|
||||
props: ["modelValue"],
|
||||
emits: ["update:modelValue"],
|
||||
setup:
|
||||
(props, { attrs, emit }) =>
|
||||
() =>
|
||||
h("input", { ...attrs, value: props.modelValue, onInput: (event: Event) => emit("update:modelValue", (event.target as HTMLInputElement).value) }),
|
||||
}),
|
||||
};
|
||||
});
|
||||
vi.mock("@/components/ui/PasswordInput.vue", async () => {
|
||||
const { defineComponent, h } = await import("vue");
|
||||
return {
|
||||
default: defineComponent({
|
||||
props: ["modelValue"],
|
||||
setup:
|
||||
(props, { attrs }) =>
|
||||
() =>
|
||||
h("input", { ...attrs, type: "password", value: props.modelValue }),
|
||||
}),
|
||||
};
|
||||
});
|
||||
vi.mock("@/components/ui/tabs", async () => {
|
||||
const { defineComponent, h } = await import("vue");
|
||||
const pass = defineComponent({
|
||||
setup:
|
||||
(_props, { slots }) =>
|
||||
() =>
|
||||
h("div", slots.default?.()),
|
||||
});
|
||||
const TabsContent = defineComponent({
|
||||
props: ["value"],
|
||||
setup:
|
||||
(props, { slots }) =>
|
||||
() =>
|
||||
props.value === "connection" ? h("div", slots.default?.()) : null,
|
||||
});
|
||||
return { Tabs: pass, TabsContent, TabsList: pass, TabsTrigger: pass };
|
||||
});
|
||||
vi.mock("@/components/ui/tooltip", async () => {
|
||||
const { defineComponent, h } = await import("vue");
|
||||
const pass = defineComponent({
|
||||
setup:
|
||||
(_props, { slots }) =>
|
||||
() =>
|
||||
h("span", slots.default?.()),
|
||||
});
|
||||
return { HelpTooltip: pass, Tooltip: pass, TooltipContent: pass, TooltipTrigger: pass };
|
||||
});
|
||||
|
||||
import ConnectionDialog from "@/components/connection/ConnectionDialog.vue";
|
||||
|
||||
const mountedApps: App[] = [];
|
||||
|
||||
function oracleConnection(overrides: Partial<ConnectionConfig> = {}): ConnectionConfig {
|
||||
return {
|
||||
id: "oracle-conn",
|
||||
name: "Oracle connection",
|
||||
db_type: "oracle",
|
||||
driver_profile: "oracle",
|
||||
driver_label: "Oracle",
|
||||
host: "oracle.example.test",
|
||||
port: 1521,
|
||||
username: "dbx_test",
|
||||
password: "secret",
|
||||
database: "XEPDB1",
|
||||
save_password: true,
|
||||
...overrides,
|
||||
} as ConnectionConfig;
|
||||
}
|
||||
|
||||
async function settle() {
|
||||
for (let i = 0; i < 8; i++) await nextTick();
|
||||
}
|
||||
|
||||
async function mountDialog(config: ConnectionConfig) {
|
||||
const props = reactive({ open: true, editConfig: config });
|
||||
store.getConfig.mockReturnValue(config);
|
||||
const container = document.createElement("div");
|
||||
document.body.append(container);
|
||||
const app = createApp(
|
||||
defineComponent({
|
||||
setup: () => () =>
|
||||
h(ConnectionDialog, {
|
||||
...props,
|
||||
"onUpdate:open": (value: boolean) => {
|
||||
props.open = value;
|
||||
},
|
||||
}),
|
||||
}),
|
||||
);
|
||||
app.use(i18n);
|
||||
mountedApps.push(app);
|
||||
app.mount(container);
|
||||
await settle();
|
||||
return props;
|
||||
}
|
||||
|
||||
function buttonByText(text: string): HTMLButtonElement | undefined {
|
||||
return [...document.querySelectorAll("button")].find((button) => button.textContent?.trim() === text);
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
platformState.windows = true;
|
||||
i18n.global.locale.value = "en";
|
||||
for (const fn of Object.values(backend)) fn.mockResolvedValue([]);
|
||||
backend.listenAgentInstallProgress.mockResolvedValue(() => {});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
for (const app of mountedApps.splice(0)) app.unmount();
|
||||
document.body.innerHTML = "";
|
||||
});
|
||||
|
||||
describe("Oracle driver mode availability", () => {
|
||||
it("shows the OCI switch on Windows", async () => {
|
||||
platformState.windows = true;
|
||||
await mountDialog(oracleConnection());
|
||||
|
||||
expect(buttonByText("Thin")).toBeTruthy();
|
||||
expect(buttonByText("OCI")).toBeTruthy();
|
||||
});
|
||||
|
||||
it("hides the whole mode row for plain Oracle connections on non-Windows platforms", async () => {
|
||||
platformState.windows = false;
|
||||
await mountDialog(oracleConnection());
|
||||
|
||||
expect(buttonByText("OCI")).toBeUndefined();
|
||||
expect(buttonByText("Thin")).toBeUndefined();
|
||||
});
|
||||
|
||||
it("keeps the mode row for saved OCI connections on non-Windows platforms so they can switch back", async () => {
|
||||
platformState.windows = false;
|
||||
await mountDialog(oracleConnection({ driver_profile: "oci", driver_label: "Oracle (OCI)" }));
|
||||
|
||||
expect(buttonByText("OCI")).toBeUndefined();
|
||||
expect(buttonByText("Thin")).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -652,6 +652,25 @@ export default withEnglishFallback({
|
||||
serviceNameOnly: "Xidmətin adı",
|
||||
oracleTnsAlias: "Şəbəkə ləqəbi",
|
||||
oracleTnsAliasPlaceholder: "tnsnames.ora faylındakı ləqəb",
|
||||
oracleDriverMode: "Driver mode",
|
||||
oracleOciPathPlaceholder: "Directory containing oci.dll",
|
||||
oracleOciPathBrowse: "Select the Oracle Instant Client directory",
|
||||
oracleOciPathHint: "The Instant Client location is a global setting shared by every OCI connection; new OCI connections reuse it automatically.",
|
||||
oracleOciClientPathMissing: "No Oracle Instant Client directory is configured. An OCI connection may fail to load oci.dll — set the directory that contains it under the driver mode.",
|
||||
oracleOciNlsLangPlaceholder: "Select a client character set",
|
||||
oracleOciNlsLangFollowGlobal: "Follow the global default (empty)",
|
||||
oracleOciNlsLangFollowGlobalValue: "Follows the global default: {value}",
|
||||
oraclePathPickerDesktopOnly: "Picking a local path is only available in the desktop app.",
|
||||
oracleOciNlsLangPlaceholderGlobal: "Follows the global default: {value}",
|
||||
oracleOciNlsLangSaveGlobal: "Save as the global default",
|
||||
oracleOciNlsLangSavedGlobal: "Saved as the global default: {value}",
|
||||
oracleOciTnsAdminPlaceholderGlobal: "Follows the global default: {value}",
|
||||
oracleOciTnsAdminHint: "Connection-level TNS_ADMIN: the directory holding tnsnames.ora / sqlnet.ora / the wallet; empty follows the global default. ADB wallets and sqlnet.ora network options work without switching to the TNS connection form.",
|
||||
oracleOciTnsAdminSaveGlobal: "Save as the global default",
|
||||
oracleOciTnsAdminSavedGlobal: "Saved as the global default: {value}",
|
||||
oracleOciTnsAdminSaveGlobalEmpty: "Enter a TNS_ADMIN directory to save first",
|
||||
oracleOciNlsLangSaveGlobalEmpty: "Select an NLS_LANG to save first",
|
||||
oracleOciNlsLangHint: "Connection-level client character set (NLS_LANG) for OCI; overriding it gives this connection its own agent process. Set AL32UTF8 to match a UTF-8 database and avoid mojibake.",
|
||||
oracleTnsAdminPlaceholder: "tnsnames.ora olan qovluq",
|
||||
oracleTnsAdminBrowse: "tnsnames.ora faylını seçin",
|
||||
oracleTnsPathHint: "Bu yolu DBX server hissəsi/Oracle agenti oxuyur. Masaüstü yollar yerlidir; veb və Docker yolları serverdədir.",
|
||||
|
||||
@@ -889,8 +889,27 @@ export default {
|
||||
serviceNameOnly: "Service Name",
|
||||
oracleTnsAlias: "Network Alias",
|
||||
oracleTnsAliasPlaceholder: "Alias from tnsnames.ora",
|
||||
oracleDriverMode: "Driver mode",
|
||||
oracleOciPathPlaceholder: "Directory containing oci.dll",
|
||||
oracleOciPathBrowse: "Select the Oracle Instant Client directory",
|
||||
oracleOciPathHint: "The Instant Client location is a global setting shared by every OCI connection; new OCI connections reuse it automatically.",
|
||||
oracleOciClientPathMissing: "No Oracle Instant Client directory is configured. An OCI connection may fail to load oci.dll — set the directory that contains it under the driver mode.",
|
||||
oracleOciNlsLangPlaceholder: "Select a client character set",
|
||||
oracleOciNlsLangFollowGlobal: "Follow the global default (empty)",
|
||||
oracleOciNlsLangFollowGlobalValue: "Follows the global default: {value}",
|
||||
oraclePathPickerDesktopOnly: "Picking a local path is only available in the desktop app.",
|
||||
oracleOciNlsLangPlaceholderGlobal: "Follows the global default: {value}",
|
||||
oracleOciNlsLangSaveGlobal: "Save as the global default",
|
||||
oracleOciNlsLangSavedGlobal: "Saved as the global default: {value}",
|
||||
oracleOciTnsAdminPlaceholderGlobal: "Follows the global default: {value}",
|
||||
oracleOciTnsAdminHint: "Connection-level TNS_ADMIN: the directory holding tnsnames.ora / sqlnet.ora / the wallet; empty follows the global default. ADB wallets and sqlnet.ora network options work without switching to the TNS connection form.",
|
||||
oracleOciTnsAdminSaveGlobal: "Save as the global default",
|
||||
oracleOciTnsAdminSavedGlobal: "Saved as the global default: {value}",
|
||||
oracleOciTnsAdminSaveGlobalEmpty: "Enter a TNS_ADMIN directory to save first",
|
||||
oracleOciNlsLangSaveGlobalEmpty: "Select an NLS_LANG to save first",
|
||||
oracleOciNlsLangHint: "Connection-level client character set (NLS_LANG) for OCI; overriding it gives this connection its own agent process. Set AL32UTF8 to match a UTF-8 database and avoid mojibake.",
|
||||
oracleTnsAdminPlaceholder: "Directory containing tnsnames.ora",
|
||||
oracleTnsAdminBrowse: "Select tnsnames.ora",
|
||||
oracleTnsAdminBrowse: "Select the TNS_ADMIN directory",
|
||||
oracleTnsPathHint: "The DBX backend/Oracle agent reads this path. Desktop paths are local; Web and Docker paths are on the server.",
|
||||
oracleTnsAliasRequired: "Oracle TNS mode requires a network alias.",
|
||||
oracleTnsAdminRequired: "Oracle TNS mode requires the TNS_ADMIN directory containing tnsnames.ora.",
|
||||
|
||||
@@ -880,6 +880,25 @@ export default withEnglishFallback({
|
||||
serviceNameOnly: "Nombre de servicio",
|
||||
oracleTnsAlias: "Alias de red",
|
||||
oracleTnsAliasPlaceholder: "Alias de tnsnames.ora",
|
||||
oracleDriverMode: "Driver mode",
|
||||
oracleOciPathPlaceholder: "Directory containing oci.dll",
|
||||
oracleOciPathBrowse: "Select the Oracle Instant Client directory",
|
||||
oracleOciPathHint: "The Instant Client location is a global setting shared by every OCI connection; new OCI connections reuse it automatically.",
|
||||
oracleOciClientPathMissing: "No Oracle Instant Client directory is configured. An OCI connection may fail to load oci.dll — set the directory that contains it under the driver mode.",
|
||||
oracleOciNlsLangPlaceholder: "Select a client character set",
|
||||
oracleOciNlsLangFollowGlobal: "Follow the global default (empty)",
|
||||
oracleOciNlsLangFollowGlobalValue: "Follows the global default: {value}",
|
||||
oraclePathPickerDesktopOnly: "Picking a local path is only available in the desktop app.",
|
||||
oracleOciNlsLangPlaceholderGlobal: "Follows the global default: {value}",
|
||||
oracleOciNlsLangSaveGlobal: "Save as the global default",
|
||||
oracleOciNlsLangSavedGlobal: "Saved as the global default: {value}",
|
||||
oracleOciTnsAdminPlaceholderGlobal: "Follows the global default: {value}",
|
||||
oracleOciTnsAdminHint: "Connection-level TNS_ADMIN: the directory holding tnsnames.ora / sqlnet.ora / the wallet; empty follows the global default. ADB wallets and sqlnet.ora network options work without switching to the TNS connection form.",
|
||||
oracleOciTnsAdminSaveGlobal: "Save as the global default",
|
||||
oracleOciTnsAdminSavedGlobal: "Saved as the global default: {value}",
|
||||
oracleOciTnsAdminSaveGlobalEmpty: "Enter a TNS_ADMIN directory to save first",
|
||||
oracleOciNlsLangSaveGlobalEmpty: "Select an NLS_LANG to save first",
|
||||
oracleOciNlsLangHint: "Connection-level client character set (NLS_LANG) for OCI; overriding it gives this connection its own agent process. Set AL32UTF8 to match a UTF-8 database and avoid mojibake.",
|
||||
oracleTnsAdminPlaceholder: "Directorio que contiene tnsnames.ora",
|
||||
oracleTnsAdminBrowse: "Seleccionar tnsnames.ora",
|
||||
oracleTnsPathHint: "La ruta la lee el backend de DBX/Oracle Agent. En escritorio es local; en Web y Docker pertenece al servidor.",
|
||||
|
||||
@@ -874,6 +874,25 @@ export default withEnglishFallback({
|
||||
serviceNameOnly: "Nome Servizio",
|
||||
oracleTnsAlias: "Alias di rete",
|
||||
oracleTnsAliasPlaceholder: "Alias da tnsnames.ora",
|
||||
oracleDriverMode: "Driver mode",
|
||||
oracleOciPathPlaceholder: "Directory containing oci.dll",
|
||||
oracleOciPathBrowse: "Select the Oracle Instant Client directory",
|
||||
oracleOciPathHint: "The Instant Client location is a global setting shared by every OCI connection; new OCI connections reuse it automatically.",
|
||||
oracleOciClientPathMissing: "No Oracle Instant Client directory is configured. An OCI connection may fail to load oci.dll — set the directory that contains it under the driver mode.",
|
||||
oracleOciNlsLangPlaceholder: "Select a client character set",
|
||||
oracleOciNlsLangFollowGlobal: "Follow the global default (empty)",
|
||||
oracleOciNlsLangFollowGlobalValue: "Follows the global default: {value}",
|
||||
oraclePathPickerDesktopOnly: "Picking a local path is only available in the desktop app.",
|
||||
oracleOciNlsLangPlaceholderGlobal: "Follows the global default: {value}",
|
||||
oracleOciNlsLangSaveGlobal: "Save as the global default",
|
||||
oracleOciNlsLangSavedGlobal: "Saved as the global default: {value}",
|
||||
oracleOciTnsAdminPlaceholderGlobal: "Follows the global default: {value}",
|
||||
oracleOciTnsAdminHint: "Connection-level TNS_ADMIN: the directory holding tnsnames.ora / sqlnet.ora / the wallet; empty follows the global default. ADB wallets and sqlnet.ora network options work without switching to the TNS connection form.",
|
||||
oracleOciTnsAdminSaveGlobal: "Save as the global default",
|
||||
oracleOciTnsAdminSavedGlobal: "Saved as the global default: {value}",
|
||||
oracleOciTnsAdminSaveGlobalEmpty: "Enter a TNS_ADMIN directory to save first",
|
||||
oracleOciNlsLangSaveGlobalEmpty: "Select an NLS_LANG to save first",
|
||||
oracleOciNlsLangHint: "Connection-level client character set (NLS_LANG) for OCI; overriding it gives this connection its own agent process. Set AL32UTF8 to match a UTF-8 database and avoid mojibake.",
|
||||
oracleTnsAdminPlaceholder: "Directory contenente tnsnames.ora",
|
||||
oracleTnsAdminBrowse: "Seleziona tnsnames.ora",
|
||||
oracleTnsPathHint: "Il percorso viene letto dal backend DBX/Oracle Agent. Sul desktop è locale; su Web e Docker appartiene al server.",
|
||||
|
||||
@@ -874,6 +874,25 @@ export default withEnglishFallback({
|
||||
serviceNameOnly: "サービス名",
|
||||
oracleTnsAlias: "ネットワーク・エイリアス",
|
||||
oracleTnsAliasPlaceholder: "tnsnames.ora のエイリアス",
|
||||
oracleDriverMode: "Driver mode",
|
||||
oracleOciPathPlaceholder: "Directory containing oci.dll",
|
||||
oracleOciPathBrowse: "Select the Oracle Instant Client directory",
|
||||
oracleOciPathHint: "The Instant Client location is a global setting shared by every OCI connection; new OCI connections reuse it automatically.",
|
||||
oracleOciClientPathMissing: "No Oracle Instant Client directory is configured. An OCI connection may fail to load oci.dll — set the directory that contains it under the driver mode.",
|
||||
oracleOciNlsLangPlaceholder: "Select a client character set",
|
||||
oracleOciNlsLangFollowGlobal: "Follow the global default (empty)",
|
||||
oracleOciNlsLangFollowGlobalValue: "Follows the global default: {value}",
|
||||
oraclePathPickerDesktopOnly: "Picking a local path is only available in the desktop app.",
|
||||
oracleOciNlsLangPlaceholderGlobal: "Follows the global default: {value}",
|
||||
oracleOciNlsLangSaveGlobal: "Save as the global default",
|
||||
oracleOciNlsLangSavedGlobal: "Saved as the global default: {value}",
|
||||
oracleOciTnsAdminPlaceholderGlobal: "Follows the global default: {value}",
|
||||
oracleOciTnsAdminHint: "Connection-level TNS_ADMIN: the directory holding tnsnames.ora / sqlnet.ora / the wallet; empty follows the global default. ADB wallets and sqlnet.ora network options work without switching to the TNS connection form.",
|
||||
oracleOciTnsAdminSaveGlobal: "Save as the global default",
|
||||
oracleOciTnsAdminSavedGlobal: "Saved as the global default: {value}",
|
||||
oracleOciTnsAdminSaveGlobalEmpty: "Enter a TNS_ADMIN directory to save first",
|
||||
oracleOciNlsLangSaveGlobalEmpty: "Select an NLS_LANG to save first",
|
||||
oracleOciNlsLangHint: "Connection-level client character set (NLS_LANG) for OCI; overriding it gives this connection its own agent process. Set AL32UTF8 to match a UTF-8 database and avoid mojibake.",
|
||||
oracleTnsAdminPlaceholder: "tnsnames.ora を含むディレクトリ",
|
||||
oracleTnsAdminBrowse: "tnsnames.ora を選択",
|
||||
oracleTnsPathHint: "このパスは DBX バックエンド/Oracle Agent が読み取ります。デスクトップではローカルパス、Web/Docker ではサーバーパスを指定してください。",
|
||||
|
||||
@@ -876,6 +876,25 @@ export default withEnglishFallback({
|
||||
serviceNameOnly: "서비스 이름",
|
||||
oracleTnsAlias: "네트워크 별칭",
|
||||
oracleTnsAliasPlaceholder: "tnsnames.ora의 별칭",
|
||||
oracleDriverMode: "Driver mode",
|
||||
oracleOciPathPlaceholder: "Directory containing oci.dll",
|
||||
oracleOciPathBrowse: "Select the Oracle Instant Client directory",
|
||||
oracleOciPathHint: "The Instant Client location is a global setting shared by every OCI connection; new OCI connections reuse it automatically.",
|
||||
oracleOciClientPathMissing: "No Oracle Instant Client directory is configured. An OCI connection may fail to load oci.dll — set the directory that contains it under the driver mode.",
|
||||
oracleOciNlsLangPlaceholder: "Select a client character set",
|
||||
oracleOciNlsLangFollowGlobal: "Follow the global default (empty)",
|
||||
oracleOciNlsLangFollowGlobalValue: "Follows the global default: {value}",
|
||||
oraclePathPickerDesktopOnly: "Picking a local path is only available in the desktop app.",
|
||||
oracleOciNlsLangPlaceholderGlobal: "Follows the global default: {value}",
|
||||
oracleOciNlsLangSaveGlobal: "Save as the global default",
|
||||
oracleOciNlsLangSavedGlobal: "Saved as the global default: {value}",
|
||||
oracleOciTnsAdminPlaceholderGlobal: "Follows the global default: {value}",
|
||||
oracleOciTnsAdminHint: "Connection-level TNS_ADMIN: the directory holding tnsnames.ora / sqlnet.ora / the wallet; empty follows the global default. ADB wallets and sqlnet.ora network options work without switching to the TNS connection form.",
|
||||
oracleOciTnsAdminSaveGlobal: "Save as the global default",
|
||||
oracleOciTnsAdminSavedGlobal: "Saved as the global default: {value}",
|
||||
oracleOciTnsAdminSaveGlobalEmpty: "Enter a TNS_ADMIN directory to save first",
|
||||
oracleOciNlsLangSaveGlobalEmpty: "Select an NLS_LANG to save first",
|
||||
oracleOciNlsLangHint: "Connection-level client character set (NLS_LANG) for OCI; overriding it gives this connection its own agent process. Set AL32UTF8 to match a UTF-8 database and avoid mojibake.",
|
||||
oracleTnsAdminPlaceholder: "tnsnames.ora가 있는 디렉터리",
|
||||
oracleTnsAdminBrowse: "tnsnames.ora 선택",
|
||||
oracleTnsPathHint: "DBX 백엔드/Oracle 에이전트가 이 경로를 읽습니다. 데스크톱 경로는 로컬이며, Web과 Docker 경로는 서버에 있습니다.",
|
||||
|
||||
@@ -875,6 +875,25 @@ export default withEnglishFallback({
|
||||
serviceNameOnly: "Service Name",
|
||||
oracleTnsAlias: "Alias de rede",
|
||||
oracleTnsAliasPlaceholder: "Alias do tnsnames.ora",
|
||||
oracleDriverMode: "Driver mode",
|
||||
oracleOciPathPlaceholder: "Directory containing oci.dll",
|
||||
oracleOciPathBrowse: "Select the Oracle Instant Client directory",
|
||||
oracleOciPathHint: "The Instant Client location is a global setting shared by every OCI connection; new OCI connections reuse it automatically.",
|
||||
oracleOciClientPathMissing: "No Oracle Instant Client directory is configured. An OCI connection may fail to load oci.dll — set the directory that contains it under the driver mode.",
|
||||
oracleOciNlsLangPlaceholder: "Select a client character set",
|
||||
oracleOciNlsLangFollowGlobal: "Follow the global default (empty)",
|
||||
oracleOciNlsLangFollowGlobalValue: "Follows the global default: {value}",
|
||||
oraclePathPickerDesktopOnly: "Picking a local path is only available in the desktop app.",
|
||||
oracleOciNlsLangPlaceholderGlobal: "Follows the global default: {value}",
|
||||
oracleOciNlsLangSaveGlobal: "Save as the global default",
|
||||
oracleOciNlsLangSavedGlobal: "Saved as the global default: {value}",
|
||||
oracleOciTnsAdminPlaceholderGlobal: "Follows the global default: {value}",
|
||||
oracleOciTnsAdminHint: "Connection-level TNS_ADMIN: the directory holding tnsnames.ora / sqlnet.ora / the wallet; empty follows the global default. ADB wallets and sqlnet.ora network options work without switching to the TNS connection form.",
|
||||
oracleOciTnsAdminSaveGlobal: "Save as the global default",
|
||||
oracleOciTnsAdminSavedGlobal: "Saved as the global default: {value}",
|
||||
oracleOciTnsAdminSaveGlobalEmpty: "Enter a TNS_ADMIN directory to save first",
|
||||
oracleOciNlsLangSaveGlobalEmpty: "Select an NLS_LANG to save first",
|
||||
oracleOciNlsLangHint: "Connection-level client character set (NLS_LANG) for OCI; overriding it gives this connection its own agent process. Set AL32UTF8 to match a UTF-8 database and avoid mojibake.",
|
||||
oracleTnsAdminPlaceholder: "Diretório que contém tnsnames.ora",
|
||||
oracleTnsAdminBrowse: "Selecionar tnsnames.ora",
|
||||
oracleTnsPathHint: "O caminho é lido pelo backend do DBX/Oracle Agent. No desktop é local; no Web e Docker pertence ao servidor.",
|
||||
|
||||
@@ -833,6 +833,25 @@ export default withEnglishFallback({
|
||||
serviceNameOnly: "Имя службы",
|
||||
oracleTnsAlias: "Сетевой псевдоним",
|
||||
oracleTnsAliasPlaceholder: "Псевдоним из tnsnames.ora",
|
||||
oracleDriverMode: "Driver mode",
|
||||
oracleOciPathPlaceholder: "Directory containing oci.dll",
|
||||
oracleOciPathBrowse: "Select the Oracle Instant Client directory",
|
||||
oracleOciPathHint: "The Instant Client location is a global setting shared by every OCI connection; new OCI connections reuse it automatically.",
|
||||
oracleOciClientPathMissing: "No Oracle Instant Client directory is configured. An OCI connection may fail to load oci.dll — set the directory that contains it under the driver mode.",
|
||||
oracleOciNlsLangPlaceholder: "Select a client character set",
|
||||
oracleOciNlsLangFollowGlobal: "Follow the global default (empty)",
|
||||
oracleOciNlsLangFollowGlobalValue: "Follows the global default: {value}",
|
||||
oraclePathPickerDesktopOnly: "Picking a local path is only available in the desktop app.",
|
||||
oracleOciNlsLangPlaceholderGlobal: "Follows the global default: {value}",
|
||||
oracleOciNlsLangSaveGlobal: "Save as the global default",
|
||||
oracleOciNlsLangSavedGlobal: "Saved as the global default: {value}",
|
||||
oracleOciTnsAdminPlaceholderGlobal: "Follows the global default: {value}",
|
||||
oracleOciTnsAdminHint: "Connection-level TNS_ADMIN: the directory holding tnsnames.ora / sqlnet.ora / the wallet; empty follows the global default. ADB wallets and sqlnet.ora network options work without switching to the TNS connection form.",
|
||||
oracleOciTnsAdminSaveGlobal: "Save as the global default",
|
||||
oracleOciTnsAdminSavedGlobal: "Saved as the global default: {value}",
|
||||
oracleOciTnsAdminSaveGlobalEmpty: "Enter a TNS_ADMIN directory to save first",
|
||||
oracleOciNlsLangSaveGlobalEmpty: "Select an NLS_LANG to save first",
|
||||
oracleOciNlsLangHint: "Connection-level client character set (NLS_LANG) for OCI; overriding it gives this connection its own agent process. Set AL32UTF8 to match a UTF-8 database and avoid mojibake.",
|
||||
oracleTnsAdminPlaceholder: "Каталог, содержащий tnsnames.ora",
|
||||
oracleTnsAdminBrowse: "Выбрать tnsnames.ora",
|
||||
oracleTnsPathHint: "Этот путь читает бэкенд DBX / агент Oracle. В настольной версии пути локальные; в Web и Docker — на сервере.",
|
||||
|
||||
@@ -654,6 +654,25 @@ export default withEnglishFallback({
|
||||
serviceNameOnly: "Servis Adı",
|
||||
oracleTnsAlias: "Ağ Takma Adı",
|
||||
oracleTnsAliasPlaceholder: "tnsnames.ora dosyasındaki takma ad",
|
||||
oracleDriverMode: "Driver mode",
|
||||
oracleOciPathPlaceholder: "Directory containing oci.dll",
|
||||
oracleOciPathBrowse: "Select the Oracle Instant Client directory",
|
||||
oracleOciPathHint: "The Instant Client location is a global setting shared by every OCI connection; new OCI connections reuse it automatically.",
|
||||
oracleOciClientPathMissing: "No Oracle Instant Client directory is configured. An OCI connection may fail to load oci.dll — set the directory that contains it under the driver mode.",
|
||||
oracleOciNlsLangPlaceholder: "Select a client character set",
|
||||
oracleOciNlsLangFollowGlobal: "Follow the global default (empty)",
|
||||
oracleOciNlsLangFollowGlobalValue: "Follows the global default: {value}",
|
||||
oraclePathPickerDesktopOnly: "Picking a local path is only available in the desktop app.",
|
||||
oracleOciNlsLangPlaceholderGlobal: "Follows the global default: {value}",
|
||||
oracleOciNlsLangSaveGlobal: "Save as the global default",
|
||||
oracleOciNlsLangSavedGlobal: "Saved as the global default: {value}",
|
||||
oracleOciTnsAdminPlaceholderGlobal: "Follows the global default: {value}",
|
||||
oracleOciTnsAdminHint: "Connection-level TNS_ADMIN: the directory holding tnsnames.ora / sqlnet.ora / the wallet; empty follows the global default. ADB wallets and sqlnet.ora network options work without switching to the TNS connection form.",
|
||||
oracleOciTnsAdminSaveGlobal: "Save as the global default",
|
||||
oracleOciTnsAdminSavedGlobal: "Saved as the global default: {value}",
|
||||
oracleOciTnsAdminSaveGlobalEmpty: "Enter a TNS_ADMIN directory to save first",
|
||||
oracleOciNlsLangSaveGlobalEmpty: "Select an NLS_LANG to save first",
|
||||
oracleOciNlsLangHint: "Connection-level client character set (NLS_LANG) for OCI; overriding it gives this connection its own agent process. Set AL32UTF8 to match a UTF-8 database and avoid mojibake.",
|
||||
oracleTnsAdminPlaceholder: "tnsnames.ora dosyasını içeren dizin",
|
||||
oracleTnsAdminBrowse: "tnsnames.ora seçin",
|
||||
oracleTnsPathHint: "Bu yolu DBX arka ucu/Oracle agent'ı okur. Masaüstü yolları yereldir; Web ve Docker yolları sunucudadır.",
|
||||
|
||||
@@ -805,8 +805,27 @@ export default withEnglishFallback({
|
||||
serviceNameOnly: "服务名",
|
||||
oracleTnsAlias: "网络别名",
|
||||
oracleTnsAliasPlaceholder: "tnsnames.ora 中的别名",
|
||||
oracleDriverMode: "驱动模式",
|
||||
oracleOciPathPlaceholder: "包含 oci.dll 的目录",
|
||||
oracleOciPathBrowse: "选择 Oracle Instant Client 目录",
|
||||
oracleOciPathHint: "Instant Client 路径为全局配置,所有 OCI 连接共用;新增 OCI 连接会自动带出此路径。",
|
||||
oracleOciClientPathMissing: "尚未配置 Oracle Instant Client 目录,OCI 连接可能无法加载 oci.dll;请在“驱动模式”下填写 oci.dll 所在目录。",
|
||||
oracleOciNlsLangPlaceholder: "选择客户端字符集",
|
||||
oracleOciNlsLangFollowGlobal: "跟随全局默认(留空)",
|
||||
oracleOciNlsLangFollowGlobalValue: "跟随全局默认:{value}",
|
||||
oraclePathPickerDesktopOnly: "本地路径选择仅在桌面版可用。",
|
||||
oracleOciNlsLangPlaceholderGlobal: "跟随全局默认:{value}",
|
||||
oracleOciNlsLangSaveGlobal: "保存为全局默认",
|
||||
oracleOciNlsLangSavedGlobal: "已保存为全局默认:{value}",
|
||||
oracleOciTnsAdminPlaceholderGlobal: "跟随全局默认:{value}",
|
||||
oracleOciTnsAdminHint: "连接级 TNS_ADMIN:指向包含 tnsnames.ora / sqlnet.ora / 钱包的目录;留空跟随全局默认。ADB 钱包与 sqlnet.ora 网络选项因此无需切换到 TNS 连接方式。",
|
||||
oracleOciTnsAdminSaveGlobal: "保存为全局默认",
|
||||
oracleOciTnsAdminSavedGlobal: "已保存为全局默认:{value}",
|
||||
oracleOciTnsAdminSaveGlobalEmpty: "请先填写要保存的 TNS_ADMIN 目录",
|
||||
oracleOciNlsLangSaveGlobalEmpty: "请先选择要保存的 NLS_LANG",
|
||||
oracleOciNlsLangHint: "连接级 OCI 客户端字符集(NLS_LANG):填写后将为此连接启用独立 agent 进程;数据库为 UTF-8 时建议设为 AL32UTF8,避免中文乱码。",
|
||||
oracleTnsAdminPlaceholder: "包含 tnsnames.ora 的目录",
|
||||
oracleTnsAdminBrowse: "选择 tnsnames.ora",
|
||||
oracleTnsAdminBrowse: "选择 TNS_ADMIN 目录",
|
||||
oracleTnsPathHint: "该路径由 DBX 后端/Oracle Agent 读取。桌面端填写本机路径,Web 和 Docker 部署填写服务器路径。",
|
||||
oracleTnsAliasRequired: "Oracle TNS 模式需要填写网络别名。",
|
||||
oracleTnsAdminRequired: "Oracle TNS 模式需要填写包含 tnsnames.ora 的 TNS_ADMIN 目录。",
|
||||
|
||||
@@ -878,6 +878,25 @@ export default withEnglishFallback({
|
||||
serviceNameOnly: "服務名稱",
|
||||
oracleTnsAlias: "網路別名",
|
||||
oracleTnsAliasPlaceholder: "tnsnames.ora 中的別名",
|
||||
oracleDriverMode: "驱动模式",
|
||||
oracleOciPathPlaceholder: "包含 oci.dll 的目录",
|
||||
oracleOciPathBrowse: "选择 Oracle Instant Client 目录",
|
||||
oracleOciPathHint: "Instant Client 路径为全局配置,所有 OCI 连接共用;新增 OCI 连接会自动带出此路径。",
|
||||
oracleOciClientPathMissing: "尚未配置 Oracle Instant Client 目录,OCI 连接可能无法加载 oci.dll;请在“驱动模式”下填写 oci.dll 所在目录。",
|
||||
oracleOciNlsLangPlaceholder: "选择客户端字符集",
|
||||
oracleOciNlsLangFollowGlobal: "跟随全局默认(留空)",
|
||||
oracleOciNlsLangFollowGlobalValue: "跟随全局默认:{value}",
|
||||
oraclePathPickerDesktopOnly: "本地路径选择仅在桌面版可用。",
|
||||
oracleOciNlsLangPlaceholderGlobal: "跟随全局默认:{value}",
|
||||
oracleOciNlsLangSaveGlobal: "保存为全局默认",
|
||||
oracleOciNlsLangSavedGlobal: "已保存为全局默认:{value}",
|
||||
oracleOciTnsAdminPlaceholderGlobal: "跟随全局默认:{value}",
|
||||
oracleOciTnsAdminHint: "连接级 TNS_ADMIN:指向包含 tnsnames.ora / sqlnet.ora / 钱包的目录;留空跟随全局默认。ADB 钱包与 sqlnet.ora 网络选项因此无需切换到 TNS 连接方式。",
|
||||
oracleOciTnsAdminSaveGlobal: "保存为全局默认",
|
||||
oracleOciTnsAdminSavedGlobal: "已保存为全局默认:{value}",
|
||||
oracleOciTnsAdminSaveGlobalEmpty: "请先填写要保存的 TNS_ADMIN 目录",
|
||||
oracleOciNlsLangSaveGlobalEmpty: "请先选择要保存的 NLS_LANG",
|
||||
oracleOciNlsLangHint: "连接级 OCI 客户端字符集(NLS_LANG):填写后将为此连接启用独立 agent 进程;数据库为 UTF-8 时建议设为 AL32UTF8,避免中文乱码。",
|
||||
oracleTnsAdminPlaceholder: "包含 tnsnames.ora 的目錄",
|
||||
oracleTnsAdminBrowse: "選擇 tnsnames.ora",
|
||||
oracleTnsPathHint: "此路徑由 DBX 後端/Oracle Agent 讀取。桌面版填寫本機路徑,Web 和 Docker 部署填寫伺服器路徑。",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import i18n from "@/i18n";
|
||||
import * as api from "@/lib/backend/api";
|
||||
import { AGENT_ACTIONS, ASK_ACTIONS, buildAgentRequest, buildSystemPrompt, isValidActionForMode, type AiAction, type AiContext } from "@/lib/ai/ai";
|
||||
import { INTENT_CLASSIFY_MAX_TEXT_CHARS, actionForIntent, classifyIntentByLlm, intentCandidatesForMode, parseClassifierAction, requestsExplicitExecution, routeIntent, routeIntentByRules, type AiIntent, type AiIntentRouteInput } from "@/lib/ai/aiIntentRouter";
|
||||
@@ -26,6 +27,11 @@ function context(overrides: Partial<AiContext> = {}): AiContext {
|
||||
/** Gate-open sample: an unambiguous data request (查一下 anchors the execution gate). */
|
||||
const EXPLICIT_DATA_TEXT = "查一下这张表里的数据";
|
||||
|
||||
// 提示词断言按英文文案书写;显式固定语言,避免跟随机器语言环境(例如中文系统)而误报。
|
||||
beforeEach(() => {
|
||||
i18n.global.locale.value = "en";
|
||||
});
|
||||
|
||||
describe("routeIntentByRules — Ask mode golden cases", () => {
|
||||
// Every non-general Ask action is reachable from an unambiguous zh/en sample.
|
||||
it("routes SQL-production requests to generate", () => {
|
||||
|
||||
@@ -47,6 +47,21 @@ describe("NebulaGraph driver installation", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("Oracle driver installation", () => {
|
||||
it("routes the OCI profile to the dedicated oracle-oci agent", () => {
|
||||
expect(agentDriverInstallKey("oracle", "oci")).toBe("oracle-oci");
|
||||
expect(showAgentDriverInstallHint("oracle", [], "oci")).toBe(true);
|
||||
expect(showAgentDriverInstallHint("oracle", [{ db_type: "oracle-oci", installed: true }], "oci")).toBe(false);
|
||||
});
|
||||
|
||||
it("keeps plain Oracle connections on the thin agent", () => {
|
||||
for (const profile of [undefined, "oracle"]) {
|
||||
expect(agentDriverInstallKey("oracle", profile)).toBe("oracle");
|
||||
expect(showAgentDriverInstallHint("oracle", [{ db_type: "oracle", installed: true }], profile)).toBe(false);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe("shouldApplyDriverStoreFocus", () => {
|
||||
it("applies when the driver first appears after a list load", () => {
|
||||
expect(shouldApplyDriverStoreFocus(null, "driver:mysql", false)).toBe(true);
|
||||
|
||||
+48
-79
@@ -1,5 +1,7 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { AGENT_DRIVER_CATEGORY_MAP, DRIVER_CATEGORIES, assertAgentDriverCategoriesComplete, getCategoryForAgentDriver } from "@/lib/connection/driver-category-definitions";
|
||||
import { MANAGED_JDBC_DRIVERS } from "@/lib/database/managedJdbcDrivers";
|
||||
import { databaseManifestEntry, manifestDatabaseTypes } from "@/lib/database/databaseDriverManifest";
|
||||
|
||||
describe("getCategoryForAgentDriver", () => {
|
||||
it("returns correct category for one key from each of the 9 categories", () => {
|
||||
@@ -67,93 +69,60 @@ describe("AGENT_DRIVER_CATEGORY_MAP integrity", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("covers all known agent driver keys with no stale entries", () => {
|
||||
// Golden set — mirrors the store-visible entries in agent_catalog.rs
|
||||
// plus EXTRA_DRIVER_STORE_ENTRIES (duckdb, kafka, rocketmq,
|
||||
// rabbitmq, sqlserver-legacy) and the built-in JDBC driver rows.
|
||||
// When an Agent driver is added to the catalog its key MUST appear here;
|
||||
// removing a key from the map without removing it from the list below
|
||||
// will fail this test.
|
||||
const expectedKeys = new Set([
|
||||
// sql
|
||||
"db2",
|
||||
"firebird",
|
||||
"informix",
|
||||
"iris",
|
||||
"oracle",
|
||||
"spanner",
|
||||
"sqlserver-legacy",
|
||||
// analytics
|
||||
"bigquery",
|
||||
"databend",
|
||||
"databricks",
|
||||
"exasol",
|
||||
"hive",
|
||||
"ignite",
|
||||
"ignite3",
|
||||
"kylin",
|
||||
"phoenix",
|
||||
"prestosql",
|
||||
"saphana",
|
||||
"snowflake",
|
||||
"spark",
|
||||
"teradata",
|
||||
"trino",
|
||||
"vertica",
|
||||
// domestic
|
||||
"dameng",
|
||||
"gbase8a",
|
||||
"gbase8s",
|
||||
"goldendb",
|
||||
"highgo",
|
||||
"kingbase",
|
||||
"oceanbase-oracle",
|
||||
"oscar",
|
||||
"sundb",
|
||||
"transwarp",
|
||||
"uxdb",
|
||||
"vastbase",
|
||||
"xugu",
|
||||
"yashandb",
|
||||
// lightweight
|
||||
"access",
|
||||
"duckdb",
|
||||
"h2",
|
||||
"sqlite-worker",
|
||||
// document
|
||||
"cassandra",
|
||||
"mongodb",
|
||||
// graph_ai
|
||||
"neo4j",
|
||||
"nebula",
|
||||
// timeseries
|
||||
"influxdb",
|
||||
"iotdb",
|
||||
"tdengine",
|
||||
// mq
|
||||
"kafka",
|
||||
"rabbitmq",
|
||||
"rocketmq",
|
||||
// registry_config
|
||||
"etcd",
|
||||
"zookeeper",
|
||||
]);
|
||||
const actualKeys = Object.keys(AGENT_DRIVER_CATEGORY_MAP);
|
||||
it("covers every driver the store can list, derived from the manifest", () => {
|
||||
// Derived, not hand-maintained: the driver store renders
|
||||
// `agent_catalog::driver_store_entries()` (the store-visible entries of
|
||||
// database-drivers.manifest.json) plus the built-in managed JDBC rows. A
|
||||
// hand-written list silently absorbs a missing key — `oracle-oci` shipped
|
||||
// store-visible with no category and only produced a console warning in dev.
|
||||
const expectedKeys = new Set<string>(manifestStoreVisibleAgentKeys());
|
||||
for (const definition of MANAGED_JDBC_DRIVERS) {
|
||||
expectedKeys.add(definition.id);
|
||||
}
|
||||
|
||||
expect(actualKeys).toHaveLength(expectedKeys.size);
|
||||
const actualKeys = new Set(Object.keys(AGENT_DRIVER_CATEGORY_MAP));
|
||||
const missing = [...expectedKeys].filter((key) => !actualKeys.has(key));
|
||||
|
||||
const actualSet = new Set(actualKeys);
|
||||
const missing = [...expectedKeys].filter((k) => !actualSet.has(k));
|
||||
const extra = actualKeys.filter((k) => !expectedKeys.has(k));
|
||||
|
||||
expect(missing, `Missing from AGENT_DRIVER_CATEGORY_MAP: ${missing.join(", ")}`).toEqual([]);
|
||||
expect(extra, `Extra keys in AGENT_DRIVER_CATEGORY_MAP not in expected set: ${extra.join(", ")}`).toEqual([]);
|
||||
expect(missing, `Store-visible drivers without a category: ${missing.join(", ")}`).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Mirrors `agent_catalog::driver_store_entries()`: the base agent key of every
|
||||
* store-visible entry, every store-visible profile (by `packageKey` when it
|
||||
* shares another module's package), and every store-visible managed driver.
|
||||
*/
|
||||
function manifestStoreVisibleAgentKeys(): string[] {
|
||||
const keys: string[] = [];
|
||||
for (const dbType of manifestDatabaseTypes()) {
|
||||
const entry = databaseManifestEntry(dbType);
|
||||
if (!entry) continue;
|
||||
if (entry.driverStoreVisible && entry.agentKey) {
|
||||
keys.push(entry.agentKey);
|
||||
}
|
||||
for (const profile of entry.driverProfiles ?? []) {
|
||||
if (profile.storeVisible) {
|
||||
keys.push(profile.packageKey ?? profile.agentKey);
|
||||
}
|
||||
}
|
||||
for (const driver of entry.managedDrivers ?? []) {
|
||||
if (driver.storeVisible) {
|
||||
keys.push(driver.key);
|
||||
}
|
||||
}
|
||||
}
|
||||
return [...new Set(keys)];
|
||||
}
|
||||
|
||||
describe("built-in JDBC drivers match ConnectionDialog categories", () => {
|
||||
it("maps PrestoSQL and Apache Phoenix to analytics", () => {
|
||||
expect(getCategoryForAgentDriver("prestosql")).toBe("analytics");
|
||||
expect(getCategoryForAgentDriver("phoenix")).toBe("analytics");
|
||||
});
|
||||
});
|
||||
|
||||
describe("Oracle OCI driver category", () => {
|
||||
it("groups the OCI (thick) agent with the thin driver under SQL", () => {
|
||||
expect(getCategoryForAgentDriver("oracle-oci")).toBe("sql");
|
||||
});
|
||||
});
|
||||
@@ -36,7 +36,12 @@ export function agentDriverInstallKey(dbType: DatabaseType | undefined, driverPr
|
||||
if (dbType === "sqlite") return context?.ssh ? "sqlite-worker" : undefined;
|
||||
// argo owns its dedicated argo-go agent — only kyuubi/impala still share hive-go.
|
||||
if (dbType === "kyuubi" || dbType === "impala") return "hive";
|
||||
if (dbType === "oracle") return "oracle";
|
||||
// Oracle 的 OCI(thick)模式由独立的 oracle-oci agent 承担;其它 Oracle 连接继续用 thin agent。
|
||||
// agentKey 以连接类型声明(connection-types/oracle.yaml)为准,避免两处各写一份映射。
|
||||
if (dbType === "oracle") {
|
||||
const entry = databaseManifestEntry(dbType);
|
||||
return entry?.driverProfiles?.find((profile) => profile.profile === driverProfile)?.agentKey ?? entry?.agentKey;
|
||||
}
|
||||
if (dbType === "h2") return "h2";
|
||||
if (dbType === "transwarp") return "transwarp";
|
||||
if (dbType === "nebula") {
|
||||
|
||||
@@ -18,7 +18,9 @@ const EMPTY = 0;
|
||||
|
||||
export const AGENT_DRIVER_CATEGORY_MAP: Readonly<Record<string, DriverCategoryKey>> = {
|
||||
access: "lightweight",
|
||||
argo: "domestic",
|
||||
bigquery: "analytics",
|
||||
cache: "sql",
|
||||
cassandra: "document",
|
||||
dameng: "domestic",
|
||||
databend: "analytics",
|
||||
@@ -27,6 +29,7 @@ export const AGENT_DRIVER_CATEGORY_MAP: Readonly<Record<string, DriverCategoryKe
|
||||
duckdb: "lightweight",
|
||||
"sqlite-worker": "lightweight",
|
||||
etcd: "registry_config",
|
||||
etcd2: "registry_config",
|
||||
exasol: "analytics",
|
||||
firebird: "sql",
|
||||
gbase8a: "domestic",
|
||||
@@ -49,6 +52,9 @@ export const AGENT_DRIVER_CATEGORY_MAP: Readonly<Record<string, DriverCategoryKe
|
||||
nebula: "graph_ai",
|
||||
"oceanbase-oracle": "domestic",
|
||||
oracle: "sql",
|
||||
// OCI (thick) mode ships as its own store-visible agent package under the
|
||||
// Oracle connection type, so it needs its own category entry.
|
||||
"oracle-oci": "sql",
|
||||
oscar: "domestic",
|
||||
phoenix: "analytics",
|
||||
prestosql: "analytics",
|
||||
|
||||
@@ -43,7 +43,9 @@ describe("WebView startup sources stay compatible with old WebKit regex syntax",
|
||||
const source = readFileSync(file, "utf8");
|
||||
return source.includes("(?<=") || source.includes("(?<!");
|
||||
})
|
||||
.map((file) => path.relative(workspaceRoot, file))
|
||||
// 规范化路径分隔符:#allowlist 用的是仓库相对路径的 POSIX 形式,
|
||||
// 否则在 Windows 上 path.relative 返回反斜杠会误报(白名单文件被当成违规)。
|
||||
.map((file) => path.relative(workspaceRoot, file).split(path.sep).join("/"))
|
||||
.filter((relative) => !LOOKBEHIND_ALLOWLIST.has(relative));
|
||||
expect(offenders).toEqual([]);
|
||||
});
|
||||
|
||||
@@ -911,6 +911,27 @@ export interface EditorSettings {
|
||||
showColumnHeaderTooltips: boolean;
|
||||
/** 结果集页签/结果列表的名称是否带上库名(关闭后只显示表名,完整名称仍在悬浮提示中)。 */
|
||||
showResultSourceDatabase: boolean;
|
||||
/**
|
||||
* Global Oracle Instant Client location (the directory that contains
|
||||
* oci.dll / libclnts). Shared by every Oracle connection whose driver mode
|
||||
* is OCI; the connection dialog backfills it and edits write it back here.
|
||||
*/
|
||||
oracleOciClientPath: string;
|
||||
/**
|
||||
* Client character set for OCI connections, injected as the NLS_LANG
|
||||
* environment variable when the OCI agent starts. Empty keeps the OCI
|
||||
* default; Chinese environments usually want AL32UTF8 (matching the
|
||||
* database charset) to avoid mojibake.
|
||||
*/
|
||||
oracleOciNlsLang: string;
|
||||
/**
|
||||
* Global TNS_ADMIN directory for OCI connections (tnsnames.ora / sqlnet.ora
|
||||
* / wallet), injected as the TNS_ADMIN environment variable when the OCI
|
||||
* agent starts. A connection-level override wins over this default; this is
|
||||
* what makes ADB wallets and sqlnet.ora network options work without
|
||||
* switching the connection to the TNS form.
|
||||
*/
|
||||
oracleOciTnsAdmin: string;
|
||||
/** Naming strategy for query result execution and result-set tabs. */
|
||||
resultTabNamingMode: ResultTabNamingMode;
|
||||
/** Prefer SQL preamble comments in source naming mode, preserving the original naming behavior. */
|
||||
@@ -1205,6 +1226,9 @@ export const DEFAULT_EDITOR_SETTINGS: EditorSettings = {
|
||||
showColumnTypesInHeader: true,
|
||||
showColumnHeaderTooltips: true,
|
||||
showResultSourceDatabase: true,
|
||||
oracleOciClientPath: "",
|
||||
oracleOciNlsLang: "",
|
||||
oracleOciTnsAdmin: "",
|
||||
resultTabNamingMode: "source",
|
||||
resultTabPreferComments: true,
|
||||
dataGridShowTransposeFieldMetadata: false,
|
||||
@@ -1785,6 +1809,9 @@ export function normalizeEditorSettings(settings: Partial<EditorSettings>, exist
|
||||
showColumnTypesInHeader: settings.showColumnTypesInHeader ?? DEFAULT_EDITOR_SETTINGS.showColumnTypesInHeader,
|
||||
showColumnHeaderTooltips: settings.showColumnHeaderTooltips ?? DEFAULT_EDITOR_SETTINGS.showColumnHeaderTooltips,
|
||||
showResultSourceDatabase: settings.showResultSourceDatabase ?? DEFAULT_EDITOR_SETTINGS.showResultSourceDatabase,
|
||||
oracleOciNlsLang: typeof settings.oracleOciNlsLang === "string" ? settings.oracleOciNlsLang.trim() : "",
|
||||
oracleOciTnsAdmin: typeof settings.oracleOciTnsAdmin === "string" ? settings.oracleOciTnsAdmin.trim() : "",
|
||||
oracleOciClientPath: typeof settings.oracleOciClientPath === "string" ? settings.oracleOciClientPath.trim() : "",
|
||||
resultTabNamingMode: normalizeResultTabNamingMode(settings.resultTabNamingMode),
|
||||
resultTabPreferComments: settings.resultTabPreferComments !== false,
|
||||
dataGridShowTransposeFieldMetadata: settings.dataGridShowTransposeFieldMetadata === true,
|
||||
@@ -2628,6 +2655,9 @@ export const useSettingsStore = defineStore("settings", () => {
|
||||
if (partial.showColumnTypesInHeader !== undefined) editorSettings.value.showColumnTypesInHeader = partial.showColumnTypesInHeader;
|
||||
if (partial.showColumnHeaderTooltips !== undefined) editorSettings.value.showColumnHeaderTooltips = partial.showColumnHeaderTooltips;
|
||||
if (partial.showResultSourceDatabase !== undefined) editorSettings.value.showResultSourceDatabase = partial.showResultSourceDatabase;
|
||||
if (partial.oracleOciNlsLang !== undefined) editorSettings.value.oracleOciNlsLang = partial.oracleOciNlsLang.trim();
|
||||
if (partial.oracleOciTnsAdmin !== undefined) editorSettings.value.oracleOciTnsAdmin = partial.oracleOciTnsAdmin.trim();
|
||||
if (partial.oracleOciClientPath !== undefined) editorSettings.value.oracleOciClientPath = partial.oracleOciClientPath.trim();
|
||||
if (partial.resultTabNamingMode !== undefined) editorSettings.value.resultTabNamingMode = normalizeResultTabNamingMode(partial.resultTabNamingMode);
|
||||
if (partial.resultTabPreferComments !== undefined) editorSettings.value.resultTabPreferComments = partial.resultTabPreferComments !== false;
|
||||
if (partial.dataGridShowTransposeFieldMetadata !== undefined) editorSettings.value.dataGridShowTransposeFieldMetadata = partial.dataGridShowTransposeFieldMetadata === true;
|
||||
|
||||
@@ -129,6 +129,13 @@ export interface ConnectionConfig {
|
||||
client_key_path?: string;
|
||||
sysdba?: boolean;
|
||||
oracle_connection_type?: "service_name" | "sid" | "tns";
|
||||
/** Connection-level NLS_LANG override; empty follows the global default. */
|
||||
oracle_oci_nls_lang?: string;
|
||||
/**
|
||||
* Connection-level TNS_ADMIN override for OCI (tnsnames.ora / sqlnet.ora /
|
||||
* wallet directory); empty follows the global default.
|
||||
*/
|
||||
oracle_oci_tns_admin?: string;
|
||||
connection_string?: string;
|
||||
jdbc_driver_class?: string;
|
||||
jdbc_driver_paths?: string[];
|
||||
|
||||
Reference in new issue
Block a user