feat(connection): categorize database types
This commit is contained in:
10 files changed
+264
-47
No files matched your search
@@ -47,6 +47,7 @@ import { connectionAttemptOriginalErrorMessage, connectionAttemptTimeoutMessage,
|
|||||||
import { appendConnectionErrorHints, isJdbcMissingRuntimeDependencyError } from "@/lib/connection/connectionErrorHints";
|
import { appendConnectionErrorHints, isJdbcMissingRuntimeDependencyError } from "@/lib/connection/connectionErrorHints";
|
||||||
import { postgresTlsModeForForm } from "@/lib/connection/postgresTlsMode";
|
import { postgresTlsModeForForm } from "@/lib/connection/postgresTlsMode";
|
||||||
import { normalizeKafkaBootstrapServers } from "@/lib/connection/kafkaBootstrapServers";
|
import { normalizeKafkaBootstrapServers } from "@/lib/connection/kafkaBootstrapServers";
|
||||||
|
import { assertCompleteDatabaseCategories, databaseSelectionForCategory } from "@/lib/connection/databaseCategoryOptions";
|
||||||
import { normalizeRocketmqNamesrvAddr } from "@/lib/connection/rocketmqNamesrv";
|
import { normalizeRocketmqNamesrvAddr } from "@/lib/connection/rocketmqNamesrv";
|
||||||
import { detectMqUiAuthKind, isMqAuthKindAllowedForSystem, type MqUiAuthKind } from "@/lib/connection/mqAuth";
|
import { detectMqUiAuthKind, isMqAuthKindAllowedForSystem, type MqUiAuthKind } from "@/lib/connection/mqAuth";
|
||||||
import { driverInstallProgressPercent, type DriverInstallProgress } from "@/lib/connection/driverInstallProgressUi";
|
import { driverInstallProgressPercent, type DriverInstallProgress } from "@/lib/connection/driverInstallProgressUi";
|
||||||
@@ -92,7 +93,8 @@ import { hasCloudflareD1Credentials, isCloudflareD1Connection, normalizeCloudfla
|
|||||||
import { buildElasticsearchExternalConfig, elasticsearchConnectionModeFromConfig, elasticsearchKibanaBasePathFromConfig, type ElasticsearchConnectionMode } from "@/lib/connection/elasticsearchKibanaProxy";
|
import { buildElasticsearchExternalConfig, elasticsearchConnectionModeFromConfig, elasticsearchKibanaBasePathFromConfig, type ElasticsearchConnectionMode } from "@/lib/connection/elasticsearchKibanaProxy";
|
||||||
|
|
||||||
type DbOption = { value: string; label: string };
|
type DbOption = { value: string; label: string };
|
||||||
type DbCategory = { key: string; title: string; options: DbOption[] };
|
type DbCategoryKey = "sql" | "analytics" | "domestic" | "lightweight" | "document" | "graph_ai" | "timeseries" | "mq" | "registry_config";
|
||||||
|
type DbCategory = { key: DbCategoryKey; title: string; options: DbOption[] };
|
||||||
type DialogStep = "select" | "config";
|
type DialogStep = "select" | "config";
|
||||||
type DbPickerView = "icon" | "list";
|
type DbPickerView = "icon" | "list";
|
||||||
export type ConfigTab = "connection" | "advanced" | "tls" | "transport";
|
export type ConfigTab = "connection" | "advanced" | "tls" | "transport";
|
||||||
@@ -509,6 +511,7 @@ const hiveExtraJavaOptions = ref("");
|
|||||||
const dialogStep = ref<DialogStep>("select");
|
const dialogStep = ref<DialogStep>("select");
|
||||||
const dbPickerView = ref<DbPickerView>("icon");
|
const dbPickerView = ref<DbPickerView>("icon");
|
||||||
const dbSearchQuery = ref("");
|
const dbSearchQuery = ref("");
|
||||||
|
const selectedDbCategory = ref<DbCategoryKey>("sql");
|
||||||
const configTab = ref<ConfigTab>("connection");
|
const configTab = ref<ConfigTab>("connection");
|
||||||
const MQ_KAFKA_SECURITY_PROTOCOL_AUTO = "__auto";
|
const MQ_KAFKA_SECURITY_PROTOCOL_AUTO = "__auto";
|
||||||
const mqAdminUrl = ref("http://127.0.0.1:8080");
|
const mqAdminUrl = ref("http://127.0.0.1:8080");
|
||||||
@@ -1900,6 +1903,8 @@ function defaultDatabaseForProfile() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onDbTypeChange(val: string) {
|
function onDbTypeChange(val: string) {
|
||||||
|
const category = dbCategoryForOption(val);
|
||||||
|
if (category) selectedDbCategory.value = category;
|
||||||
customDriverName.value = "";
|
customDriverName.value = "";
|
||||||
applyProfile(val, !!editingId.value);
|
applyProfile(val, !!editingId.value);
|
||||||
resetTestState();
|
resetTestState();
|
||||||
@@ -2087,7 +2092,71 @@ const dbOptions: DbOption[] = [
|
|||||||
{ value: "dremio", label: "Dremio" },
|
{ value: "dremio", label: "Dremio" },
|
||||||
];
|
];
|
||||||
|
|
||||||
const dbCategories = computed<DbCategory[]>(() => [{ key: "all", title: "", options: dbOptions }]);
|
const dbCategoryDefinitions: Array<{
|
||||||
|
key: DbCategoryKey;
|
||||||
|
titleKey: string;
|
||||||
|
optionValues: readonly string[];
|
||||||
|
}> = [
|
||||||
|
{
|
||||||
|
key: "sql",
|
||||||
|
titleKey: "connection.databaseCategorySql",
|
||||||
|
optionValues: ["postgres", "mysql", "oracle", "sqlserver", "mariadb", "cockroachdb", "db2", "informix", "firebird", "iris", "jdbcx", "custom_mysql", "custom_postgres"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "analytics",
|
||||||
|
titleKey: "connection.databaseCategoryAnalytics",
|
||||||
|
optionValues: ["clickhouse", "doris", "starrocks", "databend", "selectdb", "databricks", "saphana", "teradata", "vertica", "exasol", "redshift", "snowflake", "trino", "prestosql", "hive", "spark", "bigquery", "kylin", "dremio"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "domestic",
|
||||||
|
titleKey: "connection.databaseCategoryDomestic",
|
||||||
|
optionValues: ["dm", "opengauss", "gaussdb", "kwdb", "tidb", "oceanbase", "goldendb", "tdsql", "polardb", "greatsql", "gbase", "kingbase", "highgo", "yashandb", "vastbase", "sundb", "oscar", "xugu"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "lightweight",
|
||||||
|
titleKey: "connection.databaseCategoryLightweight",
|
||||||
|
optionValues: ["sqlite", "turso", "cloudflare-d1", "duckdb", "rqlite", "access", "h2"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "document",
|
||||||
|
titleKey: "connection.databaseCategoryDocument",
|
||||||
|
optionValues: ["mongodb", "redis", "elasticsearch", "manticoresearch", "cassandra"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "graph_ai",
|
||||||
|
titleKey: "connection.databaseCategoryGraphAi",
|
||||||
|
optionValues: ["neo4j", "qdrant", "milvus", "weaviate", "chromadb"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "timeseries",
|
||||||
|
titleKey: "connection.databaseCategoryTimeseries",
|
||||||
|
optionValues: ["questdb", "tdengine", "iotdb", "influxdb"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "mq",
|
||||||
|
titleKey: "connection.databaseCategoryMq",
|
||||||
|
optionValues: ["mq", "kafka", "rocketmq"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "registry_config",
|
||||||
|
titleKey: "connection.databaseCategoryRegistryConfig",
|
||||||
|
optionValues: ["etcd", "zookeeper", "nacos"],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
// Keep the picker exhaustive as database drivers are added or reorganized.
|
||||||
|
assertCompleteDatabaseCategories(
|
||||||
|
dbOptions.map((option) => option.value),
|
||||||
|
dbCategoryDefinitions.map((category) => category.optionValues),
|
||||||
|
);
|
||||||
|
|
||||||
|
const dbCategories = computed<DbCategory[]>(() => {
|
||||||
|
return dbCategoryDefinitions.map((category) => ({
|
||||||
|
key: category.key,
|
||||||
|
title: t(category.titleKey),
|
||||||
|
options: dbOptions.filter((option) => category.optionValues.includes(option.value)),
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
|
||||||
function matchesDbOption(option: DbOption, keyword: string, categoryTitle = "") {
|
function matchesDbOption(option: DbOption, keyword: string, categoryTitle = "") {
|
||||||
const profile = driverProfiles[option.value];
|
const profile = driverProfiles[option.value];
|
||||||
@@ -2098,9 +2167,11 @@ function matchesDbOption(option: DbOption, keyword: string, categoryTitle = "")
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isDbSearchActive = computed(() => !!dbSearchQuery.value.trim());
|
||||||
|
|
||||||
const filteredDbCategories = computed<DbCategory[]>(() => {
|
const filteredDbCategories = computed<DbCategory[]>(() => {
|
||||||
const keyword = dbSearchQuery.value.trim().toLowerCase();
|
const keyword = dbSearchQuery.value.trim().toLowerCase();
|
||||||
if (!keyword) return dbCategories.value;
|
if (!isDbSearchActive.value) return dbCategories.value;
|
||||||
|
|
||||||
return dbCategories.value
|
return dbCategories.value
|
||||||
.map((category) => ({
|
.map((category) => ({
|
||||||
@@ -2110,7 +2181,25 @@ const filteredDbCategories = computed<DbCategory[]>(() => {
|
|||||||
.filter((category) => category.options.length > 0);
|
.filter((category) => category.options.length > 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
const hasDbPickerResults = computed(() => filteredDbCategories.value.some((category) => category.options.length > 0));
|
const visibleDbCategories = computed<DbCategory[]>(() => {
|
||||||
|
if (isDbSearchActive.value) return filteredDbCategories.value;
|
||||||
|
return filteredDbCategories.value.filter((category) => category.key === selectedDbCategory.value);
|
||||||
|
});
|
||||||
|
const hasDbPickerResults = computed(() => visibleDbCategories.value.some((category) => category.options.length > 0));
|
||||||
|
const selectedDbOptionIsVisible = computed(() => visibleDbCategories.value.some((category) => category.options.some((option) => option.value === selectedType.value)));
|
||||||
|
|
||||||
|
function selectDbCategory(category: DbCategoryKey) {
|
||||||
|
selectedDbCategory.value = category;
|
||||||
|
dbSearchQuery.value = "";
|
||||||
|
const categoryOptions = dbCategoryDefinitions.find((definition) => definition.key === category)?.optionValues ?? [];
|
||||||
|
const nextSelection = databaseSelectionForCategory(selectedType.value, categoryOptions);
|
||||||
|
if (nextSelection && nextSelection !== selectedType.value) onDbTypeChange(nextSelection);
|
||||||
|
}
|
||||||
|
|
||||||
|
function dbCategoryForOption(value: string): DbCategoryKey | undefined {
|
||||||
|
return dbCategories.value.find((category) => category.options.some((option) => option.value === value))?.key;
|
||||||
|
}
|
||||||
|
|
||||||
const selectedDbIcon = computed(() => iconTypeMap[selectedType.value] || selectedProfile().icon || selectedType.value);
|
const selectedDbIcon = computed(() => iconTypeMap[selectedType.value] || selectedProfile().icon || selectedType.value);
|
||||||
const jdbcBackedDatabaseTypes = new Set<DatabaseType>(["jdbc", "prestosql"]);
|
const jdbcBackedDatabaseTypes = new Set<DatabaseType>(["jdbc", "prestosql"]);
|
||||||
const isJdbcConnection = computed(() => form.value.db_type === "jdbc");
|
const isJdbcConnection = computed(() => form.value.db_type === "jdbc");
|
||||||
@@ -2395,7 +2484,7 @@ const canCloseAgentInstallDialog = computed(() => !agentInstallRunning.value ||
|
|||||||
const sqlServerDriverMode = computed<"auto" | "legacy">(() => (sqlServerUsesLegacyCompatibility(form.value) ? "legacy" : "auto"));
|
const sqlServerDriverMode = computed<"auto" | "legacy">(() => (sqlServerUsesLegacyCompatibility(form.value) ? "legacy" : "auto"));
|
||||||
const shouldUseWideConnectionDialog = computed(() => dialogStep.value === "config" && (canChooseVisibleDatabases.value || (canChooseVisibleSchemas.value && !visibleFilterUsesSchemas.value)));
|
const shouldUseWideConnectionDialog = computed(() => dialogStep.value === "config" && (canChooseVisibleDatabases.value || (canChooseVisibleSchemas.value && !visibleFilterUsesSchemas.value)));
|
||||||
const connectionDialogContentClass = computed(() => {
|
const connectionDialogContentClass = computed(() => {
|
||||||
if (dialogStep.value === "select") return "sm:max-w-[760px]";
|
if (dialogStep.value === "select") return "sm:h-[720px] sm:max-w-[880px]";
|
||||||
return shouldUseWideConnectionDialog.value ? "sm:max-w-[660px]" : "sm:max-w-[560px]";
|
return shouldUseWideConnectionDialog.value ? "sm:max-w-[660px]" : "sm:max-w-[560px]";
|
||||||
});
|
});
|
||||||
const connectionLabelClass = "justify-self-start text-left";
|
const connectionLabelClass = "justify-self-start text-left";
|
||||||
@@ -2458,6 +2547,8 @@ function goToConnectionStep(value = selectedType.value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function backToDatabasePicker() {
|
function backToDatabasePicker() {
|
||||||
|
const category = dbCategoryForOption(selectedType.value);
|
||||||
|
if (category) selectedDbCategory.value = category;
|
||||||
dialogStep.value = "select";
|
dialogStep.value = "select";
|
||||||
resetTestState();
|
resetTestState();
|
||||||
}
|
}
|
||||||
@@ -3490,6 +3581,7 @@ function resetForm() {
|
|||||||
dialogStep.value = "select";
|
dialogStep.value = "select";
|
||||||
dbPickerView.value = "icon";
|
dbPickerView.value = "icon";
|
||||||
dbSearchQuery.value = "";
|
dbSearchQuery.value = "";
|
||||||
|
selectedDbCategory.value = "sql";
|
||||||
configTab.value = "connection";
|
configTab.value = "connection";
|
||||||
resetVisibleDatabaseDraftState();
|
resetVisibleDatabaseDraftState();
|
||||||
resetProductionDatabaseDraftState();
|
resetProductionDatabaseDraftState();
|
||||||
@@ -4202,50 +4294,66 @@ function openExternalUrl(url: string) {
|
|||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="min-h-0 flex-1 space-y-5 overflow-y-auto pr-2">
|
<div class="min-h-0 flex flex-1 flex-col gap-3 overflow-hidden sm:flex-row sm:gap-4">
|
||||||
<section v-for="category in filteredDbCategories" :key="category.key" class="space-y-2">
|
<nav class="flex shrink-0 gap-1 overflow-x-auto border-b pb-2 sm:w-40 sm:flex-col sm:overflow-y-auto sm:border-b-0 sm:border-r sm:pb-0 sm:pr-3" :aria-label="t('connection.databaseCategories')">
|
||||||
<div class="flex items-center">
|
<button
|
||||||
<h3 v-if="category.title" class="text-sm font-medium">{{ category.title }}</h3>
|
v-for="category in dbCategories"
|
||||||
</div>
|
:key="category.key"
|
||||||
|
type="button"
|
||||||
|
class="shrink-0 whitespace-nowrap rounded-md px-3 py-2 text-left text-sm transition hover:bg-muted/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring sm:w-full"
|
||||||
|
:class="!isDbSearchActive && selectedDbCategory === category.key ? 'bg-primary/10 font-medium text-primary' : 'text-muted-foreground'"
|
||||||
|
:aria-current="!isDbSearchActive && selectedDbCategory === category.key ? 'page' : undefined"
|
||||||
|
@click="selectDbCategory(category.key)"
|
||||||
|
>
|
||||||
|
{{ category.title }}
|
||||||
|
</button>
|
||||||
|
</nav>
|
||||||
|
|
||||||
<div v-if="dbPickerView === 'icon'" class="connection-db-picker-grid grid grid-cols-2 gap-2 sm:grid-cols-4 lg:grid-cols-5">
|
<div class="min-w-0 flex-1 space-y-5 overflow-y-auto pr-2">
|
||||||
<button
|
<div v-if="isDbSearchActive" class="text-sm font-medium">{{ t("connection.searchResults") }}</div>
|
||||||
v-for="opt in category.options"
|
|
||||||
:key="opt.value"
|
|
||||||
type="button"
|
|
||||||
class="connection-db-picker-option group flex min-h-24 flex-col items-center justify-center gap-2 rounded-xl border bg-background/70 p-3 text-center transition hover:-translate-y-0.5 hover:border-primary/40 hover:bg-muted/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
|
||||||
:class="selectedType === opt.value ? 'connection-db-picker-option--selected shadow-sm' : 'border-border'"
|
|
||||||
:aria-pressed="selectedType === opt.value"
|
|
||||||
@click="onDbTypeChange(opt.value)"
|
|
||||||
@dblclick="goToConnectionStep(opt.value)"
|
|
||||||
>
|
|
||||||
<span class="flex h-10 w-10 items-center justify-center rounded-xl bg-muted/60 transition group-hover:bg-background">
|
|
||||||
<DatabaseIcon :db-type="iconTypeMap[opt.value]" class="h-6 w-6" />
|
|
||||||
</span>
|
|
||||||
<span class="max-w-full truncate text-sm font-medium">{{ opt.label }}</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div v-else class="grid gap-2">
|
<section v-for="category in visibleDbCategories" :key="category.key" class="space-y-2">
|
||||||
<button
|
<h3 v-if="isDbSearchActive" class="text-sm font-medium">{{ category.title }}</h3>
|
||||||
v-for="opt in category.options"
|
|
||||||
:key="opt.value"
|
|
||||||
type="button"
|
|
||||||
class="connection-db-picker-option flex items-center gap-3 rounded-lg border bg-background px-3 py-2 text-left transition hover:border-primary/40 hover:bg-muted/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
|
||||||
:class="selectedType === opt.value ? 'connection-db-picker-option--selected' : 'border-border'"
|
|
||||||
:aria-pressed="selectedType === opt.value"
|
|
||||||
@click="onDbTypeChange(opt.value)"
|
|
||||||
@dblclick="goToConnectionStep(opt.value)"
|
|
||||||
>
|
|
||||||
<DatabaseIcon :db-type="iconTypeMap[opt.value]" class="h-5 w-5 shrink-0" />
|
|
||||||
<span class="min-w-0 flex-1 truncate text-sm font-medium">{{ opt.label }}</span>
|
|
||||||
<span class="text-xs text-muted-foreground">{{ category.title }}</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<div v-if="!hasDbPickerResults" class="rounded-xl border border-dashed py-12 text-center text-sm text-muted-foreground">
|
<div v-if="dbPickerView === 'icon'" class="connection-db-picker-grid grid grid-cols-2 gap-2 sm:grid-cols-4 lg:grid-cols-5">
|
||||||
{{ t("connection.noDatabaseMatches") }}
|
<button
|
||||||
|
v-for="opt in category.options"
|
||||||
|
:key="opt.value"
|
||||||
|
type="button"
|
||||||
|
class="connection-db-picker-option group flex min-h-24 flex-col items-center justify-center gap-2 rounded-xl border bg-background/70 p-3 text-center transition hover:-translate-y-0.5 hover:border-primary/40 hover:bg-muted/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
||||||
|
:class="selectedType === opt.value ? 'connection-db-picker-option--selected shadow-sm' : 'border-border'"
|
||||||
|
:aria-pressed="selectedType === opt.value"
|
||||||
|
@click="onDbTypeChange(opt.value)"
|
||||||
|
@dblclick="goToConnectionStep(opt.value)"
|
||||||
|
>
|
||||||
|
<span class="flex h-10 w-10 items-center justify-center rounded-xl bg-muted/60 transition group-hover:bg-background">
|
||||||
|
<DatabaseIcon :db-type="iconTypeMap[opt.value]" class="h-6 w-6" />
|
||||||
|
</span>
|
||||||
|
<span class="max-w-full truncate text-sm font-medium">{{ opt.label }}</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-else class="grid gap-2">
|
||||||
|
<button
|
||||||
|
v-for="opt in category.options"
|
||||||
|
:key="opt.value"
|
||||||
|
type="button"
|
||||||
|
class="connection-db-picker-option flex items-center gap-3 rounded-lg border bg-background px-3 py-2 text-left transition hover:border-primary/40 hover:bg-muted/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
||||||
|
:class="selectedType === opt.value ? 'connection-db-picker-option--selected' : 'border-border'"
|
||||||
|
:aria-pressed="selectedType === opt.value"
|
||||||
|
@click="onDbTypeChange(opt.value)"
|
||||||
|
@dblclick="goToConnectionStep(opt.value)"
|
||||||
|
>
|
||||||
|
<DatabaseIcon :db-type="iconTypeMap[opt.value]" class="h-5 w-5 shrink-0" />
|
||||||
|
<span class="min-w-0 flex-1 truncate text-sm font-medium">{{ opt.label }}</span>
|
||||||
|
<span v-if="isDbSearchActive" class="text-xs text-muted-foreground">{{ category.title }}</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<div v-if="!hasDbPickerResults" class="rounded-xl border border-dashed py-12 text-center text-sm text-muted-foreground">
|
||||||
|
{{ t("connection.noDatabaseMatches") }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -4255,7 +4363,7 @@ function openExternalUrl(url: string) {
|
|||||||
<DatabaseIcon :db-type="selectedDbIcon" class="h-4 w-4 shrink-0" />
|
<DatabaseIcon :db-type="selectedDbIcon" class="h-4 w-4 shrink-0" />
|
||||||
<span class="truncate">{{ t("connection.selectedDatabase") }}: {{ selectedProfile().label }}</span>
|
<span class="truncate">{{ t("connection.selectedDatabase") }}: {{ selectedProfile().label }}</span>
|
||||||
</div>
|
</div>
|
||||||
<Button :disabled="!hasDbPickerResults" @click="goToConnectionStep()">
|
<Button :disabled="!hasDbPickerResults || !selectedDbOptionIsVisible" @click="goToConnectionStep()">
|
||||||
{{ t("connection.next") }}
|
{{ t("connection.next") }}
|
||||||
<ChevronRight class="h-4 w-4" />
|
<ChevronRight class="h-4 w-4" />
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -391,6 +391,17 @@ export default {
|
|||||||
mqTokenSigningKeyPlaceholderRs256: "-----BEGIN PRIVATE KEY-----",
|
mqTokenSigningKeyPlaceholderRs256: "-----BEGIN PRIVATE KEY-----",
|
||||||
mqTokenSigningHint: "Choose based on the broker jwt.broker.token.mode: SECRET uses HS256, PRIVATE uses RS256. The key is stored with connection secrets.",
|
mqTokenSigningHint: "Choose based on the broker jwt.broker.token.mode: SECRET uses HS256, PRIVATE uses RS256. The key is stored with connection secrets.",
|
||||||
searchDatabasePlaceholder: "Search database types",
|
searchDatabasePlaceholder: "Search database types",
|
||||||
|
searchResults: "Search results",
|
||||||
|
databaseCategories: "Categories",
|
||||||
|
databaseCategorySql: "Relational",
|
||||||
|
databaseCategoryAnalytics: "Analytics",
|
||||||
|
databaseCategoryDomestic: "Chinese DBs",
|
||||||
|
databaseCategoryLightweight: "Lightweight",
|
||||||
|
databaseCategoryDocument: "Docs/Cache/Search",
|
||||||
|
databaseCategoryGraphAi: "Graph/Vector",
|
||||||
|
databaseCategoryTimeseries: "Time series",
|
||||||
|
databaseCategoryMq: "Message queues",
|
||||||
|
databaseCategoryRegistryConfig: "Registry/Config",
|
||||||
jdbcConnection: "JDBC connection",
|
jdbcConnection: "JDBC connection",
|
||||||
iconView: "Icon view",
|
iconView: "Icon view",
|
||||||
listView: "List view",
|
listView: "List view",
|
||||||
|
|||||||
@@ -316,6 +316,17 @@ export default withEnglishFallback({
|
|||||||
nacosTlsSkipVerify: "Omitir verificación de certificado",
|
nacosTlsSkipVerify: "Omitir verificación de certificado",
|
||||||
nacosPageSize: "Tamaño de página",
|
nacosPageSize: "Tamaño de página",
|
||||||
searchDatabasePlaceholder: "Buscar tipos de bases de datos",
|
searchDatabasePlaceholder: "Buscar tipos de bases de datos",
|
||||||
|
searchResults: "Resultados de búsqueda",
|
||||||
|
databaseCategories: "Categorías",
|
||||||
|
databaseCategorySql: "Relacionales",
|
||||||
|
databaseCategoryAnalytics: "Analítica",
|
||||||
|
databaseCategoryDomestic: "BD chinas",
|
||||||
|
databaseCategoryLightweight: "Ligeras",
|
||||||
|
databaseCategoryDocument: "Docs/caché/búsqueda",
|
||||||
|
databaseCategoryGraphAi: "Grafos/vectores",
|
||||||
|
databaseCategoryTimeseries: "Temporal",
|
||||||
|
databaseCategoryMq: "Colas",
|
||||||
|
databaseCategoryRegistryConfig: "Registro/config.",
|
||||||
jdbcConnection: "Conexión JDBC",
|
jdbcConnection: "Conexión JDBC",
|
||||||
iconView: "Vista de íconos",
|
iconView: "Vista de íconos",
|
||||||
listView: "Vista de lista",
|
listView: "Vista de lista",
|
||||||
|
|||||||
@@ -315,6 +315,17 @@ export default withEnglishFallback({
|
|||||||
nacosTlsSkipVerify: "Salta verifica certificato",
|
nacosTlsSkipVerify: "Salta verifica certificato",
|
||||||
nacosPageSize: "Dimensione pagina",
|
nacosPageSize: "Dimensione pagina",
|
||||||
searchDatabasePlaceholder: "Cerca tipi di database",
|
searchDatabasePlaceholder: "Cerca tipi di database",
|
||||||
|
searchResults: "Risultati della ricerca",
|
||||||
|
databaseCategories: "Categorie",
|
||||||
|
databaseCategorySql: "Relazionali",
|
||||||
|
databaseCategoryAnalytics: "Analisi",
|
||||||
|
databaseCategoryDomestic: "DB cinesi",
|
||||||
|
databaseCategoryLightweight: "Leggeri",
|
||||||
|
databaseCategoryDocument: "Doc./cache/ricerca",
|
||||||
|
databaseCategoryGraphAi: "Grafi/vettori",
|
||||||
|
databaseCategoryTimeseries: "Temporali",
|
||||||
|
databaseCategoryMq: "Code messaggi",
|
||||||
|
databaseCategoryRegistryConfig: "Registro/config.",
|
||||||
jdbcConnection: "Connessione JDBC",
|
jdbcConnection: "Connessione JDBC",
|
||||||
iconView: "Vista icone",
|
iconView: "Vista icone",
|
||||||
listView: "Vista elenco",
|
listView: "Vista elenco",
|
||||||
|
|||||||
@@ -309,6 +309,17 @@ export default withEnglishFallback({
|
|||||||
nacosTlsSkipVerify: "証明書検証をスキップ",
|
nacosTlsSkipVerify: "証明書検証をスキップ",
|
||||||
nacosPageSize: "ページサイズ",
|
nacosPageSize: "ページサイズ",
|
||||||
searchDatabasePlaceholder: "データベースタイプを検索",
|
searchDatabasePlaceholder: "データベースタイプを検索",
|
||||||
|
searchResults: "検索結果",
|
||||||
|
databaseCategories: "カテゴリ",
|
||||||
|
databaseCategorySql: "リレーショナル",
|
||||||
|
databaseCategoryAnalytics: "分析",
|
||||||
|
databaseCategoryDomestic: "中国系DB",
|
||||||
|
databaseCategoryLightweight: "軽量DB",
|
||||||
|
databaseCategoryDocument: "文書/キャッシュ/検索",
|
||||||
|
databaseCategoryGraphAi: "グラフ/ベクトル",
|
||||||
|
databaseCategoryTimeseries: "時系列DB",
|
||||||
|
databaseCategoryMq: "メッセージキュー",
|
||||||
|
databaseCategoryRegistryConfig: "登録/設定",
|
||||||
jdbcConnection: "JDBC 接続",
|
jdbcConnection: "JDBC 接続",
|
||||||
iconView: "アイコン表示",
|
iconView: "アイコン表示",
|
||||||
listView: "リスト表示",
|
listView: "リスト表示",
|
||||||
|
|||||||
@@ -316,6 +316,17 @@ export default withEnglishFallback({
|
|||||||
nacosTlsSkipVerify: "Ignorar verificação do certificado",
|
nacosTlsSkipVerify: "Ignorar verificação do certificado",
|
||||||
nacosPageSize: "Tamanho da página",
|
nacosPageSize: "Tamanho da página",
|
||||||
searchDatabasePlaceholder: "Pesquisar tipos de banco de dados",
|
searchDatabasePlaceholder: "Pesquisar tipos de banco de dados",
|
||||||
|
searchResults: "Resultados da busca",
|
||||||
|
databaseCategories: "Categorias",
|
||||||
|
databaseCategorySql: "Relacionais",
|
||||||
|
databaseCategoryAnalytics: "Análises",
|
||||||
|
databaseCategoryDomestic: "BD chineses",
|
||||||
|
databaseCategoryLightweight: "Leves",
|
||||||
|
databaseCategoryDocument: "Docs/cache/busca",
|
||||||
|
databaseCategoryGraphAi: "Grafos/vetores",
|
||||||
|
databaseCategoryTimeseries: "Séries",
|
||||||
|
databaseCategoryMq: "Filas",
|
||||||
|
databaseCategoryRegistryConfig: "Registro/config.",
|
||||||
jdbcConnection: "Conexão JDBC",
|
jdbcConnection: "Conexão JDBC",
|
||||||
iconView: "Visualização em ícones",
|
iconView: "Visualização em ícones",
|
||||||
listView: "Visualização em lista",
|
listView: "Visualização em lista",
|
||||||
|
|||||||
@@ -393,6 +393,17 @@ export default withEnglishFallback({
|
|||||||
mqTokenSigningKeyPlaceholderRs256: "-----BEGIN PRIVATE KEY-----",
|
mqTokenSigningKeyPlaceholderRs256: "-----BEGIN PRIVATE KEY-----",
|
||||||
mqTokenSigningHint: "按 Broker 的 jwt.broker.token.mode 选择:SECRET 使用 HS256,PRIVATE 使用 RS256。密钥会走连接 secret 存储。",
|
mqTokenSigningHint: "按 Broker 的 jwt.broker.token.mode 选择:SECRET 使用 HS256,PRIVATE 使用 RS256。密钥会走连接 secret 存储。",
|
||||||
searchDatabasePlaceholder: "搜索数据库类型",
|
searchDatabasePlaceholder: "搜索数据库类型",
|
||||||
|
searchResults: "搜索结果",
|
||||||
|
databaseCategories: "分类",
|
||||||
|
databaseCategorySql: "关系型数据库",
|
||||||
|
databaseCategoryAnalytics: "数仓分析",
|
||||||
|
databaseCategoryDomestic: "国产数据库",
|
||||||
|
databaseCategoryLightweight: "轻量数据库",
|
||||||
|
databaseCategoryDocument: "文档/缓存/检索",
|
||||||
|
databaseCategoryGraphAi: "图谱/向量",
|
||||||
|
databaseCategoryTimeseries: "时序数据库",
|
||||||
|
databaseCategoryMq: "消息队列",
|
||||||
|
databaseCategoryRegistryConfig: "注册与配置",
|
||||||
jdbcConnection: "JDBC 连接",
|
jdbcConnection: "JDBC 连接",
|
||||||
iconView: "图标视图",
|
iconView: "图标视图",
|
||||||
listView: "列表视图",
|
listView: "列表视图",
|
||||||
|
|||||||
@@ -316,6 +316,17 @@ export default withEnglishFallback({
|
|||||||
nacosTlsSkipVerify: "跳過憑證驗證",
|
nacosTlsSkipVerify: "跳過憑證驗證",
|
||||||
nacosPageSize: "分頁大小",
|
nacosPageSize: "分頁大小",
|
||||||
searchDatabasePlaceholder: "搜尋資料庫類型",
|
searchDatabasePlaceholder: "搜尋資料庫類型",
|
||||||
|
searchResults: "搜尋結果",
|
||||||
|
databaseCategories: "分類",
|
||||||
|
databaseCategorySql: "關聯式資料庫",
|
||||||
|
databaseCategoryAnalytics: "數倉分析",
|
||||||
|
databaseCategoryDomestic: "國產資料庫",
|
||||||
|
databaseCategoryLightweight: "輕量資料庫",
|
||||||
|
databaseCategoryDocument: "文件/快取/檢索",
|
||||||
|
databaseCategoryGraphAi: "圖譜/向量",
|
||||||
|
databaseCategoryTimeseries: "時序資料庫",
|
||||||
|
databaseCategoryMq: "訊息佇列",
|
||||||
|
databaseCategoryRegistryConfig: "註冊與設定",
|
||||||
jdbcConnection: "JDBC 連線",
|
jdbcConnection: "JDBC 連線",
|
||||||
iconView: "圖示檢視",
|
iconView: "圖示檢視",
|
||||||
listView: "清單檢視",
|
listView: "清單檢視",
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
export function assertCompleteDatabaseCategories(optionValues: readonly string[], categoryOptionValues: readonly (readonly string[])[]) {
|
||||||
|
const available = new Set(optionValues);
|
||||||
|
const categorized = categoryOptionValues.flat();
|
||||||
|
const categorizedSet = new Set(categorized);
|
||||||
|
const duplicates = categorized.filter((value, index) => categorized.indexOf(value) !== index);
|
||||||
|
const missing = optionValues.filter((value) => !categorizedSet.has(value));
|
||||||
|
const unknown = categorized.filter((value) => !available.has(value));
|
||||||
|
|
||||||
|
if (duplicates.length || missing.length || unknown.length) {
|
||||||
|
throw new Error(`Invalid database categories: duplicates=${[...new Set(duplicates)].join(",")}; missing=${missing.join(",")}; unknown=${[...new Set(unknown)].join(",")}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function databaseSelectionForCategory(currentValue: string, categoryOptionValues: readonly string[]): string | undefined {
|
||||||
|
return categoryOptionValues.includes(currentValue) ? currentValue : categoryOptionValues[0];
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import assert from "node:assert/strict";
|
||||||
|
import { test } from "vitest";
|
||||||
|
import { assertCompleteDatabaseCategories, databaseSelectionForCategory } from "../../apps/desktop/src/lib/connection/databaseCategoryOptions.ts";
|
||||||
|
|
||||||
|
test("database categories cover every option exactly once", () => {
|
||||||
|
assert.doesNotThrow(() => assertCompleteDatabaseCategories(["mysql", "redis", "kafka"], [["mysql"], ["redis", "kafka"]]));
|
||||||
|
assert.throws(() => assertCompleteDatabaseCategories(["mysql", "redis"], [["mysql"]]), /missing=redis/);
|
||||||
|
assert.throws(() => assertCompleteDatabaseCategories(["mysql"], [["mysql"], ["mysql"]]), /duplicates=mysql/);
|
||||||
|
assert.throws(() => assertCompleteDatabaseCategories(["mysql"], [["mysql", "unknown"]]), /unknown=unknown/);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("database category changes keep only visible selections", () => {
|
||||||
|
assert.equal(databaseSelectionForCategory("mysql", ["mysql", "postgres"]), "mysql");
|
||||||
|
assert.equal(databaseSelectionForCategory("mysql", ["questdb", "tdengine"]), "questdb");
|
||||||
|
assert.equal(databaseSelectionForCategory("mysql", []), undefined);
|
||||||
|
});
|
||||||
Reference in new issue
Block a user