Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions apps/tauri/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();

Expand All @@ -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() {
Expand Down Expand Up @@ -247,6 +256,11 @@ onUnmounted(() => {
@close="newFolderOpen = false"
@create="onCreateFolder"
/>
<NewConnectionDialog
:open="newConnectionOpen"
@close="newConnectionOpen = false"
@connect-sqlite="onConnectSqliteFromDialog"
/>
</div>
</template>

Expand Down
9 changes: 6 additions & 3 deletions apps/tauri/src/stores/connections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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);
Expand Down
Loading
Loading