diff --git a/apps/desktop/public/icons/database/yashandb.png b/apps/desktop/public/icons/database/yashandb.png new file mode 100644 index 000000000..ef3ab6946 Binary files /dev/null and b/apps/desktop/public/icons/database/yashandb.png differ diff --git a/apps/desktop/src/components/connection/ConnectionDialog.vue b/apps/desktop/src/components/connection/ConnectionDialog.vue index 2c30a2aa3..03b2d07f6 100644 --- a/apps/desktop/src/components/connection/ConnectionDialog.vue +++ b/apps/desktop/src/components/connection/ConnectionDialog.vue @@ -163,6 +163,7 @@ const driverProfiles: Record< gaussdb: { type: "gaussdb", port: 5432, user: "gaussdb", label: "GaussDB", icon: "gaussdb" }, kingbase: { type: "kingbase", port: 54321, user: "system", label: "KingBase", icon: "kingbase" }, highgo: { type: "highgo", port: 5866, user: "highgo", label: "瀚高 HighGo", icon: "highgo" }, + yashandb: { type: "yashandb", port: 1688, user: "sys", label: "崖山 YashanDB", icon: "yashandb" }, vastbase: { type: "vastbase", port: 5432, user: "vastbase", label: "Vastbase", icon: "vastbase" }, doris: { type: "mysql", port: 9030, user: "root", label: "Doris", icon: "doris", urlParams: "" }, selectdb: { @@ -342,6 +343,7 @@ function defaultDatabaseForProfile() { if (form.value.db_type === "gaussdb") return "postgres"; if (selectedType.value === "cockroachdb") return "defaultdb"; if (form.value.db_type === "highgo") return "highgo"; + if (form.value.db_type === "yashandb") return "yasdb"; if (form.value.db_type === "postgres" || form.value.db_type === "kingbase" || form.value.db_type === "vastbase") return "postgres"; if (form.value.db_type === "sqlserver") return "master"; @@ -376,6 +378,7 @@ const iconTypeMap: Record = { gaussdb: "gaussdb", kingbase: "kingbase", highgo: "highgo", + yashandb: "yashandb", vastbase: "vastbase", doris: "doris", selectdb: "selectdb", @@ -425,6 +428,7 @@ const dbOptions = [ { value: "opengauss", label: "openGauss" }, { value: "kingbase", label: "KingBase" }, { value: "highgo", label: "瀚高 HighGo" }, + { value: "yashandb", label: "崖山 YashanDB" }, { value: "vastbase", label: "Vastbase" }, { value: "redshift", label: "Redshift" }, { value: "cockroachdb", label: "CockroachDB" }, @@ -1229,6 +1233,7 @@ function openExternalUrl(url: string) { form.db_type === 'informix' || form.db_type === 'kingbase' || form.db_type === 'highgo' || + form.db_type === 'yashandb' || form.db_type === 'vastbase' || form.db_type === 'goldendb' " diff --git a/apps/desktop/src/components/icons/DatabaseIcon.vue b/apps/desktop/src/components/icons/DatabaseIcon.vue index d56e59b28..3b6619dc5 100644 --- a/apps/desktop/src/components/icons/DatabaseIcon.vue +++ b/apps/desktop/src/components/icons/DatabaseIcon.vue @@ -29,6 +29,7 @@ const assetIcons: Record = { kingbase: "kingbase", goldendb: "goldendb.png", vastbase: "vastbase.png", + yashandb: "yashandb.png", snowflake: "snowflake", h2: "h2", dm: "dm", diff --git a/apps/desktop/src/lib/connectionPresentation.ts b/apps/desktop/src/lib/connectionPresentation.ts index 094a2246d..5c8d9f967 100644 --- a/apps/desktop/src/lib/connectionPresentation.ts +++ b/apps/desktop/src/lib/connectionPresentation.ts @@ -33,6 +33,7 @@ export function connectionUrlPlaceholder(dbType: DatabaseType): string { case "postgres": case "gaussdb": + case "yashandb": case "redshift": return "postgresql://user:password@host:port/database"; diff --git a/apps/desktop/src/lib/connectionUrl.ts b/apps/desktop/src/lib/connectionUrl.ts index a53150568..19752f276 100644 --- a/apps/desktop/src/lib/connectionUrl.ts +++ b/apps/desktop/src/lib/connectionUrl.ts @@ -40,6 +40,7 @@ const SCHEME_PROFILES: Record = { dm: { type: "dameng", profile: "dm", label: "DM (Dameng)", defaultPort: 5236 }, dameng: { type: "dameng", profile: "dm", label: "DM (Dameng)", defaultPort: 5236 }, gaussdb: { type: "gaussdb", profile: "gaussdb", label: "GaussDB", defaultPort: 5432 }, + yashandb: { type: "yashandb", profile: "yashandb", label: "崖山 YashanDB", defaultPort: 1688 }, opengauss: { type: "gaussdb", profile: "opengauss", label: "openGauss", defaultPort: 5432 }, tdengine: { type: "tdengine", profile: "tdengine", label: "TDengine", defaultPort: 6041 }, "taos-ws": { type: "tdengine", profile: "tdengine", label: "TDengine", defaultPort: 6041 }, diff --git a/apps/desktop/src/lib/databaseCapabilitySets.ts b/apps/desktop/src/lib/databaseCapabilitySets.ts index 36e82d2d7..1711bfa50 100644 --- a/apps/desktop/src/lib/databaseCapabilitySets.ts +++ b/apps/desktop/src/lib/databaseCapabilitySets.ts @@ -10,6 +10,7 @@ export const SCHEMA_AWARE_TYPES = new Set([ "kingbase", "highgo", "vastbase", + "yashandb", "jdbc", "h2", "snowflake", @@ -33,6 +34,7 @@ export const DIAGRAM_SUPPORTED_TYPES = new Set([ "highgo", "vastbase", "goldendb", + "yashandb", "access", "h2", "db2", @@ -53,6 +55,7 @@ export const DATABASE_SEARCH_SUPPORTED_TYPES = new Set([ "highgo", "vastbase", "goldendb", + "yashandb", "access", "h2", "snowflake", @@ -85,6 +88,7 @@ export const TABLE_IMPORT_SUPPORTED_TYPES = new Set([ "highgo", "vastbase", "goldendb", + "yashandb", "access", ]); @@ -132,6 +136,7 @@ export const TREE_SCHEMA_TYPES = new Set([ "kingbase", "highgo", "vastbase", + "yashandb", "jdbc", "trino", "h2", @@ -145,6 +150,7 @@ export const AGENT_DRIVER_TYPES = new Set([ "kingbase", "highgo", "vastbase", + "yashandb", "goldendb", "access", "oracle", diff --git a/apps/desktop/src/stores/connectionStore.ts b/apps/desktop/src/stores/connectionStore.ts index 3505442eb..635dbe6a4 100644 --- a/apps/desktop/src/stores/connectionStore.ts +++ b/apps/desktop/src/stores/connectionStore.ts @@ -194,6 +194,7 @@ export const useConnectionStore = defineStore("connection", () => { gaussdb: "GaussDB", kingbase: "KingBase", highgo: "瀚高 HighGo", + yashandb: "崖山 YashanDB", vastbase: "Vastbase", goldendb: "GoldenDB", access: "Microsoft Access", diff --git a/apps/desktop/src/types/database.ts b/apps/desktop/src/types/database.ts index 249370896..20660ec34 100644 --- a/apps/desktop/src/types/database.ts +++ b/apps/desktop/src/types/database.ts @@ -18,6 +18,7 @@ export type DatabaseType = | "highgo" | "vastbase" | "goldendb" + | "yashandb" | "access" | "h2" | "snowflake" diff --git a/crates/dbx-core/src/connection.rs b/crates/dbx-core/src/connection.rs index 74b099365..39364a188 100644 --- a/crates/dbx-core/src/connection.rs +++ b/crates/dbx-core/src/connection.rs @@ -232,6 +232,7 @@ impl AppState { | DatabaseType::Highgo | DatabaseType::Vastbase | DatabaseType::Goldendb + | DatabaseType::Yashandb | DatabaseType::Oracle | DatabaseType::H2 | DatabaseType::Snowflake diff --git a/crates/dbx-core/src/database_capabilities.rs b/crates/dbx-core/src/database_capabilities.rs index bdca40517..f0a2eef3a 100644 --- a/crates/dbx-core/src/database_capabilities.rs +++ b/crates/dbx-core/src/database_capabilities.rs @@ -7,6 +7,7 @@ pub fn agent_key(db_type: &DatabaseType, driver_profile: Option<&str>) -> Option DatabaseType::Highgo => Some("highgo"), DatabaseType::Vastbase => Some("vastbase"), DatabaseType::Goldendb => Some("goldendb"), + DatabaseType::Yashandb => Some("yashandb"), DatabaseType::Oracle => match driver_profile { Some("oracle-10g") => Some("oracle-10g"), _ => Some("oracle"), @@ -45,6 +46,7 @@ pub fn is_single_connection_pool(db_type: &DatabaseType) -> bool { | DatabaseType::Highgo | DatabaseType::Vastbase | DatabaseType::Goldendb + | DatabaseType::Yashandb | DatabaseType::Access | DatabaseType::Jdbc ) diff --git a/crates/dbx-core/src/models/connection.rs b/crates/dbx-core/src/models/connection.rs index 4db3524de..86ed00bd2 100644 --- a/crates/dbx-core/src/models/connection.rs +++ b/crates/dbx-core/src/models/connection.rs @@ -128,6 +128,7 @@ pub enum DatabaseType { Vastbase, Goldendb, Gaussdb, + Yashandb, Access, #[serde(rename = "h2")] H2, @@ -175,6 +176,7 @@ impl ConnectionConfig { DatabaseType::Gaussdb => Some("postgres"), DatabaseType::Kingbase | DatabaseType::Vastbase => Some("postgres"), DatabaseType::Highgo => Some("highgo"), + DatabaseType::Yashandb => Some("yasdb"), _ => None, } } @@ -267,6 +269,7 @@ impl ConnectionConfig { DatabaseType::Vastbase => format!("vastbase://{host}:{port}{db_part}"), DatabaseType::Goldendb => format!("goldendb://{host}:{port}{db_part}"), DatabaseType::Gaussdb => format!("gaussdb://{host}:{port}{db_part}"), + DatabaseType::Yashandb => format!("yashandb://{host}:{port}{db_part}"), DatabaseType::H2 => format!("h2://{host}:{port}{db_part}"), DatabaseType::Snowflake => format!("snowflake://{host}/{db_part}"), DatabaseType::Trino => format!("trino://{host}:{port}{db_part}"), @@ -366,6 +369,9 @@ impl ConnectionConfig { DatabaseType::Gaussdb => { format!("gaussdb://{}:{}@{host}:{port}{db_part}", username, password) } + DatabaseType::Yashandb => { + format!("yashandb://{}:{}@{host}:{port}{db_part}", username, password) + } DatabaseType::H2 => { format!("h2://{}:{}@{host}:{port}{db_part}", username, password) } @@ -816,6 +822,14 @@ mod tests { assert_eq!(config.connection_url(), "gaussdb://gaussdb:secret@10.1.2.3:2883/postgres"); } + #[test] + fn yashandb_url_defaults_to_yasdb_database() { + let mut config = mysql_config("sys", "secret", None); + config.db_type = DatabaseType::Yashandb; + + assert_eq!(config.connection_url(), "yashandb://sys:secret@10.1.2.3:2883/yasdb"); + } + #[test] fn mongodb_form_url_without_params_does_not_force_topology_or_auth() { let config = mongodb_config("root", "secret", Some("admin")); diff --git a/crates/dbx-core/tests/database_capabilities.rs b/crates/dbx-core/tests/database_capabilities.rs index 4337f3b12..1668ce956 100644 --- a/crates/dbx-core/tests/database_capabilities.rs +++ b/crates/dbx-core/tests/database_capabilities.rs @@ -9,6 +9,7 @@ fn maps_agent_database_types_to_driver_keys() { assert_eq!(agent_key(&DatabaseType::Hive, None), Some("hive")); assert_eq!(agent_key(&DatabaseType::Gaussdb, None), Some("gaussdb")); assert_eq!(agent_key(&DatabaseType::Tdengine, None), Some("tdengine")); + assert_eq!(agent_key(&DatabaseType::Yashandb, None), Some("yashandb")); assert_eq!(agent_key(&DatabaseType::Access, None), Some("access")); assert_eq!(agent_key(&DatabaseType::Oracle, None), Some("oracle")); assert_eq!(agent_key(&DatabaseType::Oracle, Some("oracle-10g")), Some("oracle-10g")); @@ -21,6 +22,7 @@ fn classifies_agent_database_types() { assert!(is_agent_type(&DatabaseType::Trino)); assert!(is_agent_type(&DatabaseType::Hive)); assert!(is_agent_type(&DatabaseType::Tdengine)); + assert!(is_agent_type(&DatabaseType::Yashandb)); assert!(is_agent_type(&DatabaseType::Access)); assert!(!is_agent_type(&DatabaseType::Mysql)); assert!(!is_agent_type(&DatabaseType::Jdbc)); @@ -33,6 +35,7 @@ fn identifies_single_connection_pool_types() { assert!(is_single_connection_pool(&DatabaseType::Oracle)); assert!(is_single_connection_pool(&DatabaseType::Dameng)); assert!(is_single_connection_pool(&DatabaseType::Access)); + assert!(is_single_connection_pool(&DatabaseType::Yashandb)); assert!(is_single_connection_pool(&DatabaseType::Jdbc)); assert!(!is_single_connection_pool(&DatabaseType::Trino)); assert!(!is_single_connection_pool(&DatabaseType::Postgres)); @@ -56,6 +59,7 @@ fn skips_tcp_probe_for_local_file_plugin_and_agent_types() { assert!(skips_tcp_probe(&DatabaseType::Trino)); assert!(skips_tcp_probe(&DatabaseType::Oracle)); assert!(skips_tcp_probe(&DatabaseType::Tdengine)); + assert!(skips_tcp_probe(&DatabaseType::Yashandb)); assert!(!skips_tcp_probe(&DatabaseType::Postgres)); assert!(!skips_tcp_probe(&DatabaseType::Mysql)); } diff --git a/src-tauri/src/commands/agents.rs b/src-tauri/src/commands/agents.rs index 00cc5cd33..464013c0d 100644 --- a/src-tauri/src/commands/agents.rs +++ b/src-tauri/src/commands/agents.rs @@ -36,6 +36,7 @@ const AGENT_TYPES: &[(&str, &str)] = &[ ("kylin", "Apache Kylin"), ("sundb", "SunDB"), ("gaussdb", "GaussDB"), + ("yashandb", "崖山 YashanDB"), ("tdengine", "TDengine"), ("mongodb", "MongoDB (Legacy)"), ]; @@ -112,6 +113,7 @@ mod tests { let agents = build_agent_list(&manager, None); assert!(agents.iter().any(|agent| agent.db_type == "tdengine" && agent.label == "TDengine")); + assert!(agents.iter().any(|agent| agent.db_type == "yashandb" && agent.label == "崖山 YashanDB")); assert!(agents.iter().any(|agent| agent.db_type == "access" && agent.label == "Microsoft Access")); let _ = std::fs::remove_dir_all(dir); }