fix(connection): parse OceanBase JDBC URLs
This commit is contained in:
1 parent
6304335fcc
commit
9774a194ec
5 files changed
+107
-17
No files matched your search
@@ -2481,6 +2481,13 @@ function isCustomCompatibleProfile() {
|
||||
return selectedType.value === "custom_mysql" || selectedType.value === "custom_postgres";
|
||||
}
|
||||
|
||||
function connectionUrlPreferredProfile() {
|
||||
if (selectedType.value === "oceanbase" && form.value.driver_profile === "oceanbase-oracle") {
|
||||
return "oceanbase-oracle";
|
||||
}
|
||||
return selectedType.value;
|
||||
}
|
||||
|
||||
function applyProfile(val: string, preserveConnectionFields = false) {
|
||||
const profile = driverProfiles[val];
|
||||
if (!profile) return;
|
||||
@@ -3870,7 +3877,7 @@ function applyConnectionUrlToForm(input: string): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
const parsed = parseConnectionUrl(input, selectedType.value);
|
||||
const parsed = parseConnectionUrl(input, connectionUrlPreferredProfile());
|
||||
form.value = applyParsedConnectionUrl(form.value, parsed);
|
||||
if (form.value.db_type === "victoriametrics") {
|
||||
hydrateVictoriaMetricsFields(form.value.external_config);
|
||||
@@ -3881,7 +3888,12 @@ function applyConnectionUrlToForm(input: string): boolean {
|
||||
resetMeilisearchHostInput();
|
||||
}
|
||||
oracleTnsAdminPath.value = parseOracleTnsConnectionString(parsed.connectionString)?.tnsAdmin || "";
|
||||
selectedType.value = parsed.driverProfile;
|
||||
if (parsed.driverProfile === "oceanbase-oracle") {
|
||||
oceanbaseSubMode.value = "oracle";
|
||||
selectedType.value = "oceanbase";
|
||||
} else {
|
||||
selectedType.value = parsed.driverProfile;
|
||||
}
|
||||
customDriverName.value = isCustomCompatibleProfile() ? parsed.driverLabel : "";
|
||||
mongoUseUrl.value = !!parsed.useMongoUrl;
|
||||
if (form.value.db_type === "h2") {
|
||||
@@ -3936,7 +3948,7 @@ function formValueForSubmit(): Omit<ConnectionConfig, "id"> {
|
||||
return applyConnectionDraftToConfig(form.value, { ...draft, oneTime: undefined });
|
||||
}
|
||||
|
||||
return applyParsedConnectionUrl(form.value, parseConnectionUrl(url, selectedType.value));
|
||||
return applyParsedConnectionUrl(form.value, parseConnectionUrl(url, connectionUrlPreferredProfile()));
|
||||
}
|
||||
|
||||
if (form.value.db_type === "meilisearch" && hasPendingMeilisearchHostInput()) {
|
||||
|
||||
+2
-3
@@ -1,6 +1,6 @@
|
||||
// @vitest-environment happy-dom
|
||||
|
||||
import { createApp, nextTick, type App, type ComputedRef, type InjectionKey } from "vue";
|
||||
import { createApp, defineComponent, h, nextTick, type App, type ComputedRef, type InjectionKey } from "vue";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
const backend = vi.hoisted(() => ({
|
||||
@@ -93,8 +93,7 @@ vi.mock("@/stores/settingsStore", () => ({
|
||||
useSettingsStore: () => settings,
|
||||
}));
|
||||
|
||||
vi.mock("@/components/grid/DataGrid.vue", async () => {
|
||||
const { defineComponent, h } = await import("vue");
|
||||
vi.mock("@/components/grid/DataGrid.vue", () => {
|
||||
return {
|
||||
default: defineComponent({
|
||||
name: "DataGridStub",
|
||||
|
||||
+3
-4
@@ -1,7 +1,8 @@
|
||||
// @vitest-environment happy-dom
|
||||
|
||||
import { createApp, nextTick, type App } from "vue";
|
||||
import { createApp, defineComponent, h, nextTick, type App } from "vue";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { isDataGridPrefixAppend } from "@/lib/dataGrid/dataGridInfiniteScroll";
|
||||
|
||||
const backend = vi.hoisted(() => ({
|
||||
documentFindDocuments: vi.fn(),
|
||||
@@ -77,9 +78,7 @@ vi.mock("@/stores/settingsStore", () => ({
|
||||
useSettingsStore: () => settings,
|
||||
}));
|
||||
|
||||
vi.mock("@/components/grid/DataGrid.vue", async () => {
|
||||
const { defineComponent, h } = await import("vue");
|
||||
const { isDataGridPrefixAppend } = await import("@/lib/dataGrid/dataGridInfiniteScroll");
|
||||
vi.mock("@/components/grid/DataGrid.vue", () => {
|
||||
return {
|
||||
default: defineComponent({
|
||||
name: "DataGridStub",
|
||||
|
||||
Reference in new issue
Block a user