Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix import file filter on Mac OS #116

Merged
merged 1 commit into from
Aug 17, 2024
Merged
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
13 changes: 12 additions & 1 deletion src-svelte/src/routes/settings/Database.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import InfoBox from "$lib/InfoBox.svelte";
import { importDb, exportDb, type DatabaseCounts } from "$lib/bindings";
import { snackbarInfo, snackbarError } from "$lib/snackbar/Snackbar.svelte";
import { systemInfo } from "$lib/system-info";
import Button from "$lib/controls/Button.svelte";
import ButtonGroup from "$lib/controls/ButtonGroup.svelte";
import Warning from "$lib/Warning.svelte";
Expand All @@ -12,6 +13,11 @@
extensions: ["zamm.yaml"],
};

const MAC_ZAMM_DB_FILTER: DialogFilter = {
name: "ZAMM Database",
extensions: ["yaml"],
};

function nounify(counts: DatabaseCounts): string {
let noun: string;
if (counts.num_api_keys > 0 && counts.num_llm_calls === 0) {
Expand All @@ -28,13 +34,18 @@
}

async function importData() {
const defaultImportFilter =
$systemInfo?.os === "Mac" ? MAC_ZAMM_DB_FILTER : ZAMM_DB_FILTER;
const filePath =
window.WEBDRIVER_FILE_PATH ??
(await open({
title: "Import ZAMM data",
directory: false,
multiple: false,
filters: [ZAMM_DB_FILTER, { name: "All Files", extensions: ["*"] }],
filters: [
defaultImportFilter,
{ name: "All Files", extensions: ["*"] },
],
}));
if (filePath === null) {
return;
Expand Down
Loading