feat(db): add an "INCOMING" rescan mode

refactor/errors
Tomáš Mládek 2023-11-05 13:10:31 +01:00
parent d10b28621e
commit 659ed571b6
1 changed files with 41 additions and 25 deletions

View File

@ -6,15 +6,18 @@
import api from "../lib/api";
const navigate = useNavigate();
let mode: "Flat" | "DepthFirst" | "Mirror" = undefined;
let mode: "Flat" | "DepthFirst" | "Mirror" | "Incoming" = undefined;
async function submitOptions() {
const tree_mode = {};
tree_mode[mode] = null;
const optionResponse = await fetch("/api/options", {
method: "PUT",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ tree_mode: mode }),
body: JSON.stringify({ tree_mode }),
});
if (!optionResponse.ok) {
throw new Error("Failed to set options");
@ -29,8 +32,38 @@
<main>
<h1>{$i18n.t("Vault Setup")}</h1>
<section class="tree-mode">
<h2>Tree mode</h2>
<h2>Scan mode</h2>
<div class="icons">
<div class="option">
<IconButton
name="copy-alt"
outline
on:click={() => (mode = "Mirror")}
active={mode === "Mirror"}
>
Mirror
</IconButton>
<p>
{$i18n.t(
"Groups are nested reflecting the original file directory structure.",
)}
</p>
</div>
<div class="option">
<IconButton
name="vertical-bottom"
outline
on:click={() => (mode = "DepthFirst")}
active={mode === "DepthFirst"}
>
Depth-First
</IconButton>
<p>
{$i18n.t(
"Like Mirror, but the shortest path with the same end group is chosen. ",
)}
</p>
</div>
<div class="option">
<IconButton
name="checkbox-minus"
@ -48,32 +81,15 @@
</div>
<div class="option">
<IconButton
name="vertical-bottom"
name="download"
outline
on:click={() => (mode = "DepthFirst")}
active={mode === "DepthFirst"}
on:click={() => (mode = "Incoming")}
active={mode === "Incoming"}
>
Depth-First
Incoming
</IconButton>
<p>
{$i18n.t(
"All groups are created as direct descendants of the root group.",
)}
</p>
</div>
<div class="option">
<IconButton
name="copy-alt"
outline
on:click={() => (mode = "Mirror")}
active={mode === "Mirror"}
>
Mirror
</IconButton>
<p>
{$i18n.t(
"Groups are nested reflecting the original file directory structure.",
)}
{$i18n.t("New files are added to a group called 'Incoming'.")}
</p>
</div>
</div>