diff --git a/apps/tauri/src/App.vue b/apps/tauri/src/App.vue index 0af557ed..ad32944b 100644 --- a/apps/tauri/src/App.vue +++ b/apps/tauri/src/App.vue @@ -25,6 +25,9 @@ import QuickSwitcher from "./ui/QuickSwitcher.vue"; import WelcomeTourDialog from "./ui/WelcomeTourDialog.vue"; import AboutDialog from "./ui/AboutDialog.vue"; import NewFolderDialog from "./ui/NewFolderDialog.vue"; +import NewConnectionDialog, { + type SqliteConnectPayload, +} from "./ui/NewConnectionDialog.vue"; const shell = useShellStore(); const status = useShellStatusStore(); @@ -40,6 +43,7 @@ const switcherOpen = ref(false); const tourOpen = ref(false); const aboutOpen = ref(false); const newFolderOpen = ref(false); +const newConnectionOpen = ref(false); provideQueryaMotion(); @@ -66,10 +70,15 @@ async function onOpenSqlite() { } function onNewConnection() { - status.setQueryMetrics({ - message: "Connection form UI next — use Demo or Open SQLite for now", - busy: false, - }); + newConnectionOpen.value = true; +} + +async function onConnectSqliteFromDialog(payload: SqliteConnectPayload) { + try { + await connections.connectSqlite(payload.path, { name: payload.name }); + } catch { + // status already set in store + } } function onNewFolder() { @@ -247,6 +256,11 @@ onUnmounted(() => { @close="newFolderOpen = false" @create="onCreateFolder" /> + diff --git a/apps/tauri/src/stores/connections.ts b/apps/tauri/src/stores/connections.ts index f467d5f4..f2257c8e 100644 --- a/apps/tauri/src/stores/connections.ts +++ b/apps/tauri/src/stores/connections.ts @@ -67,7 +67,10 @@ export const useConnectionsStore = defineStore("connections", () => { return conn; } - async function connectSqlite(path: string, folderId?: string | null) { + async function connectSqlite( + path: string, + opts?: { folderId?: string | null; name?: string }, + ) { const status = useShellStatusStore(); const nav = useShellNavStore(); status.setQueryMetrics({ @@ -79,9 +82,9 @@ export const useConnectionsStore = defineStore("connections", () => { const conn: LiveConnection = { id, driver: "sqlite", - name: fileName(path), + name: opts?.name?.trim() || fileName(path), path, - folderId: folderId ?? null, + folderId: opts?.folderId ?? null, }; upsert(conn); nav.setExpanded(id, true); diff --git a/apps/tauri/src/ui/NewConnectionDialog.vue b/apps/tauri/src/ui/NewConnectionDialog.vue new file mode 100644 index 00000000..7980ca75 --- /dev/null +++ b/apps/tauri/src/ui/NewConnectionDialog.vue @@ -0,0 +1,494 @@ + + + + + + + New Connection + + ✕ + + + + + + SQLite + + + PostgreSQL + + + MySQL + + + + + + + + Connection name + + + + Database file + + + + Browse… + + + + + Opens a local SQLite file. You can also use Open SQLite from the + empty workspace. + + + + + + + Connection name + + + + + Host + + + + Port + + + + + Database + + + + + Username + + + + Password + + + + + + Use SSL / TLS + + + {{ + driver === "postgres" ? "PostgreSQL" : "MySQL" + }} + adapter is next — fields match Flutter; Save connects when the + driver lands. + + + + {{ error }} + + + + + + + +
+ Opens a local SQLite file. You can also use Open SQLite from the + empty workspace. +
+ {{ + driver === "postgres" ? "PostgreSQL" : "MySQL" + }} + adapter is next — fields match Flutter; Save connects when the + driver lands. +
{{ error }}