From 2bad843069cff2bec0ef5f66083214dbbc97d76e Mon Sep 17 00:00:00 2001 From: pptx704 Date: Sat, 11 Apr 2026 06:08:19 +0600 Subject: [PATCH] Extract SnapshotDialog and DestroyDialog into reusable components Add lifecycle buttons (pause, resume, snapshot, destroy) to the individual capsule detail page and refactor both the list and detail pages to share the new dialog components. --- .../src/lib/components/DestroyDialog.svelte | 82 ++++++++ .../src/lib/components/SnapshotDialog.svelte | 130 ++++++++++++ .../routes/dashboard/capsules/+page.svelte | 189 +++--------------- .../dashboard/capsules/[id]/+page.svelte | 100 ++++++++- 4 files changed, 335 insertions(+), 166 deletions(-) create mode 100644 frontend/src/lib/components/DestroyDialog.svelte create mode 100644 frontend/src/lib/components/SnapshotDialog.svelte diff --git a/frontend/src/lib/components/DestroyDialog.svelte b/frontend/src/lib/components/DestroyDialog.svelte new file mode 100644 index 0000000..549b7cc --- /dev/null +++ b/frontend/src/lib/components/DestroyDialog.svelte @@ -0,0 +1,82 @@ + + +{#if open} +
+ +
{ if (e.key === 'Escape') handleClose(); }} + >
+
+

Destroy Capsule

+

+ Terminate {capsuleId} and destroy all data inside it. This cannot be undone. +

+ + {#if error} +
+ {error} +
+ {/if} + +
+ + +
+
+
+{/if} diff --git a/frontend/src/lib/components/SnapshotDialog.svelte b/frontend/src/lib/components/SnapshotDialog.svelte new file mode 100644 index 0000000..fa9fec5 --- /dev/null +++ b/frontend/src/lib/components/SnapshotDialog.svelte @@ -0,0 +1,130 @@ + + +{#if open} +
+ +
{ if (e.key === 'Escape') handleClose(); }} + >
+ +
+
+
+ + + + +
+
+

Capture snapshot

+

{capsuleId}

+
+
+ +
+ {#if pauseFirst} +
+ + + + + +

This capsule will be paused first, then its full state (memory + disk) will be captured.

+
+ {:else} +

The capsule's current state (memory + disk) will be captured and stored as a reusable snapshot.

+ {/if} + + {#if error} +
+ {error} +
+ {/if} + +
+
+ + optional +
+ { if (e.key === 'Enter' && !snapshotting) handleConfirm(); }} + /> +

Leave blank to use an auto-generated name.

+
+ +
+ + +
+
+
+
+{/if} diff --git a/frontend/src/routes/dashboard/capsules/+page.svelte b/frontend/src/routes/dashboard/capsules/+page.svelte index e9d6734..87ca3c5 100644 --- a/frontend/src/routes/dashboard/capsules/+page.svelte +++ b/frontend/src/routes/dashboard/capsules/+page.svelte @@ -1,5 +1,7 @@