From 88c5fa249b9aaa2a5c60bfc37f8238d135914a97 Mon Sep 17 00:00:00 2001 From: Kiril Videlov Date: Fri, 26 Apr 2024 23:34:09 +0200 Subject: [PATCH] updated ui structs for snapshots --- app/src/lib/components/History.svelte | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/app/src/lib/components/History.svelte b/app/src/lib/components/History.svelte index 95dad4c75..adf550961 100644 --- a/app/src/lib/components/History.svelte +++ b/app/src/lib/components/History.svelte @@ -15,17 +15,28 @@ listSnapshots(projectId, snapshotsLimit); }); - type SnapshotEntry = { - sha: string; - label: string; + type Trailer = { + key: string; + value: string; + }; + type SnapshotDetails = { + title: string; + operation: string; + body: string | undefined; + trailers: Trailer[]; + }; + type Snapshot = { + id: string; + details: SnapshotDetails | undefined; createdAt: number; }; - let snapshots: SnapshotEntry[] = []; + let snapshots: Snapshot[] = []; async function listSnapshots(projectId: string, limit: number) { - const resp = await invoke('list_snapshots', { + const resp = await invoke('list_snapshots', { projectId: projectId, limit: limit }); + console.log(resp); snapshots = resp; } async function restoreSnapshot(projectId: string, sha: string) { @@ -45,7 +56,7 @@
- {entry.label} + {entry.details?.operation}
@@ -56,7 +67,7 @@ style="pop" size="tag" icon="undo-small" - on:click={async () => await restoreSnapshot(projectId, entry.sha)}>restore await restoreSnapshot(projectId, entry.id)}>restore {/if}