mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-18 23:02:31 +03:00
updated ui structs for snapshots
This commit is contained in:
parent
9d534b09ca
commit
88c5fa249b
@ -15,17 +15,28 @@
|
|||||||
listSnapshots(projectId, snapshotsLimit);
|
listSnapshots(projectId, snapshotsLimit);
|
||||||
});
|
});
|
||||||
|
|
||||||
type SnapshotEntry = {
|
type Trailer = {
|
||||||
sha: string;
|
key: string;
|
||||||
label: string;
|
value: string;
|
||||||
|
};
|
||||||
|
type SnapshotDetails = {
|
||||||
|
title: string;
|
||||||
|
operation: string;
|
||||||
|
body: string | undefined;
|
||||||
|
trailers: Trailer[];
|
||||||
|
};
|
||||||
|
type Snapshot = {
|
||||||
|
id: string;
|
||||||
|
details: SnapshotDetails | undefined;
|
||||||
createdAt: number;
|
createdAt: number;
|
||||||
};
|
};
|
||||||
let snapshots: SnapshotEntry[] = [];
|
let snapshots: Snapshot[] = [];
|
||||||
async function listSnapshots(projectId: string, limit: number) {
|
async function listSnapshots(projectId: string, limit: number) {
|
||||||
const resp = await invoke<SnapshotEntry[]>('list_snapshots', {
|
const resp = await invoke<Snapshot[]>('list_snapshots', {
|
||||||
projectId: projectId,
|
projectId: projectId,
|
||||||
limit: limit
|
limit: limit
|
||||||
});
|
});
|
||||||
|
console.log(resp);
|
||||||
snapshots = resp;
|
snapshots = resp;
|
||||||
}
|
}
|
||||||
async function restoreSnapshot(projectId: string, sha: string) {
|
async function restoreSnapshot(projectId: string, sha: string) {
|
||||||
@ -45,7 +56,7 @@
|
|||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="entry">
|
<div class="entry">
|
||||||
<div>
|
<div>
|
||||||
{entry.label}
|
{entry.details?.operation}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<span>
|
<span>
|
||||||
@ -56,7 +67,7 @@
|
|||||||
style="pop"
|
style="pop"
|
||||||
size="tag"
|
size="tag"
|
||||||
icon="undo-small"
|
icon="undo-small"
|
||||||
on:click={async () => await restoreSnapshot(projectId, entry.sha)}>restore</Button
|
on:click={async () => await restoreSnapshot(projectId, entry.id)}>restore</Button
|
||||||
>
|
>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user