Iteration 4a: rebuild command with confirmation modal
Adds the explicit `rebuild` app-level command (ADR-0015 §7, §11)
and a modal UI infrastructure to host its confirmation dialog.
Typing `rebuild` emits Action::PrepareRebuild; the runtime reads
project.yaml + data/ to compute a summary ("3 tables and 47 rows
will be reconstructed; the existing playground.db will be
replaced") and posts AppEvent::RebuildPrepared, which opens the
modal. Y confirms, N/Esc cancels. While the modal is open,
normal input is gated.
The worker's do_rebuild_from_text now wipes existing user tables
and metadata before reloading from text, so it works on both
fresh and populated databases. Source text is plumbed through
rebuild_from_text so the explicit rebuild logs to history.log
while the silent on-load rebuild from Iteration 3 stays silent.
Modal infrastructure (App.modal field + key routing + centered
overlay rendering + word-wrap) is reused by Iteration 4b's save
/ save as / load / new flows.
Tests: 314 passing (268 lib + 9 + 5 + 6 new + 9 + 17),
0 failing, 0 skipped. Clippy clean.
This commit is contained in:
@@ -55,4 +55,21 @@ pub enum AppEvent {
|
||||
path: std::path::PathBuf,
|
||||
message: String,
|
||||
},
|
||||
/// Runtime has computed the rebuild summary from
|
||||
/// `project.yaml` + `data/` and is ready for the user to
|
||||
/// confirm. App opens the confirmation modal.
|
||||
RebuildPrepared {
|
||||
summary: String,
|
||||
},
|
||||
/// Rebuild completed successfully. App closes the modal,
|
||||
/// surfaces a friendly outcome message, and refreshes the
|
||||
/// table list.
|
||||
RebuildSucceeded {
|
||||
summary: String,
|
||||
},
|
||||
/// Rebuild failed in a non-fatal way (e.g., user-visible
|
||||
/// constraint problem) — surfaced like other DSL failures.
|
||||
RebuildFailed {
|
||||
error: String,
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user