mirror of
https://github.com/t8y2/dbx.git
synced 2026-10-29 00:09:52 +00:00
feat: add Elasticsearch support with document browser (#38)
- New elasticsearch_driver using reqwest HTTP client - Reuse MongoDB document browser (MongoDocBrowser) for ES indices - ES indices shown as collections under "default" database - Document CRUD via ES REST API (_search, _doc) - No extra dependencies (uses existing reqwest)
This commit is contained in:
@@ -82,6 +82,7 @@ const driverProfiles: Record<string, { type: DatabaseType; port: number; user: s
|
||||
clickhouse: { type: "clickhouse", port: 8123, user: "default", label: "ClickHouse", icon: "clickhouse" },
|
||||
sqlserver: { type: "sqlserver", port: 1433, user: "sa", label: "SQL Server", icon: "sqlserver" },
|
||||
oracle: { type: "oracle", port: 1521, user: "system", label: "Oracle", icon: "oracle" },
|
||||
elasticsearch: { type: "elasticsearch", port: 9200, user: "", label: "Elasticsearch", icon: "elasticsearch" },
|
||||
mariadb: { type: "mysql", port: 3306, user: "root", label: "MariaDB", icon: "mariadb" },
|
||||
tidb: { type: "mysql", port: 4000, user: "root", label: "TiDB", icon: "tidb" },
|
||||
oceanbase: { type: "mysql", port: 2881, user: "root", label: "OceanBase", icon: "oceanbase" },
|
||||
@@ -174,6 +175,7 @@ const iconTypeMap: Record<string, string> = {
|
||||
mysql: "mysql", postgres: "postgres", sqlite: "sqlite", redis: "redis",
|
||||
mongodb: "mongodb", duckdb: "duckdb", clickhouse: "clickhouse", sqlserver: "sqlserver",
|
||||
oracle: "oracle",
|
||||
elasticsearch: "elasticsearch",
|
||||
mariadb: "mariadb", tidb: "tidb", oceanbase: "oceanbase", goldendb: "goldendb",
|
||||
opengauss: "opengauss", gaussdb: "gaussdb", kingbase: "kingbase", vastbase: "vastbase",
|
||||
custom_mysql: "mysql", custom_postgres: "postgres",
|
||||
@@ -189,6 +191,7 @@ const dbOptions = [
|
||||
{ value: "clickhouse", label: "ClickHouse" },
|
||||
{ value: "sqlserver", label: "SQL Server" },
|
||||
{ value: "oracle", label: "Oracle" },
|
||||
{ value: "elasticsearch", label: "Elasticsearch" },
|
||||
{ value: "mariadb", label: "MariaDB" },
|
||||
];
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from "vue";
|
||||
import { siPostgresql, siSqlite, siRedis, siMongodb, siClickhouse, siDuckdb, siMariadb, siTidb } from "simple-icons";
|
||||
import { siPostgresql, siSqlite, siRedis, siMongodb, siClickhouse, siDuckdb, siMariadb, siTidb, siElasticsearch } from "simple-icons";
|
||||
import { Database } from "lucide-vue-next";
|
||||
|
||||
const props = defineProps<{
|
||||
@@ -21,6 +21,7 @@ const brandIcons: Record<string, { path: string; color: string; viewBox?: string
|
||||
duckdb: { path: siDuckdb.path, color: `#${siDuckdb.hex}` },
|
||||
mariadb: { path: siMariadb.path, color: `#${siMariadb.hex}` },
|
||||
tidb: { path: siTidb.path, color: `#${siTidb.hex}` },
|
||||
elasticsearch: { path: siElasticsearch.path, color: `#${siElasticsearch.hex}` },
|
||||
oracle: {
|
||||
viewBox: "0 0 32 32",
|
||||
color: "#F80000",
|
||||
|
||||
@@ -76,7 +76,7 @@ function getIconInfo(node: TreeNode): { icon: any; colorClass: string } | null {
|
||||
}
|
||||
}
|
||||
|
||||
const leafTypes: Set<TreeNodeType> = new Set(["column", "index", "fkey", "trigger", "redis-db"]);
|
||||
const leafTypes: Set<TreeNodeType> = new Set(["column", "index", "fkey", "trigger", "redis-db", "mongo-collection"]);
|
||||
const groupTypes: Set<TreeNodeType> = new Set(["group-columns", "group-indexes", "group-fkeys", "group-triggers"]);
|
||||
const pinnableTypes: Set<TreeNodeType> = new Set([
|
||||
"database",
|
||||
@@ -101,7 +101,7 @@ async function toggle() {
|
||||
const config = connectionStore.getConfig(node.connectionId);
|
||||
if (config?.db_type === "redis") {
|
||||
await connectionStore.loadRedisDatabases(node.connectionId);
|
||||
} else if (config?.db_type === "mongodb") {
|
||||
} else if (config?.db_type === "mongodb" || config?.db_type === "elasticsearch") {
|
||||
await connectionStore.loadMongoDatabases(node.connectionId);
|
||||
} else {
|
||||
await connectionStore.loadDatabases(node.connectionId);
|
||||
@@ -144,6 +144,8 @@ function onClick() {
|
||||
toggle();
|
||||
} else if (node.type === "redis-db") {
|
||||
toggle();
|
||||
} else if (node.type === "mongo-collection") {
|
||||
toggle();
|
||||
} else if (canExpand) {
|
||||
toggle();
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ export const useConnectionStore = defineStore("connection", () => {
|
||||
sqlserver: "SQL Server",
|
||||
mongodb: "MongoDB",
|
||||
oracle: "Oracle",
|
||||
elasticsearch: "Elasticsearch",
|
||||
};
|
||||
return {
|
||||
...config,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export type DatabaseType = "mysql" | "postgres" | "sqlite" | "redis" | "duckdb" | "clickhouse" | "sqlserver" | "mongodb" | "oracle";
|
||||
export type DatabaseType = "mysql" | "postgres" | "sqlite" | "redis" | "duckdb" | "clickhouse" | "sqlserver" | "mongodb" | "oracle" | "elasticsearch";
|
||||
|
||||
export interface ConnectionConfig {
|
||||
id: string;
|
||||
|
||||
Reference in New Issue
Block a user