fix(view): restore per-cell kernel switch and Clean
Code cards again show a kernel selector and a Clean button. Clean calls /api/session/cell/clear for live sessions and clears local output in static snapshots, without restarting kernels.
This commit is contained in:
1 parent
05d48f68a4
commit
15362cb048
6 files changed
+109
-13
No files matched your search
@@ -905,6 +905,22 @@ impl DocumentSession {
|
||||
])
|
||||
}
|
||||
|
||||
/// Clear one cell's displayed output/record; kernels and live state survive.
|
||||
pub fn clear_cell(&mut self, cell: &str) -> Result<Value, String> {
|
||||
let i = self
|
||||
.cell_index(cell)
|
||||
.ok_or_else(|| format!("unknown cell `{cell}`"))?;
|
||||
self.cells[i].runs = 0;
|
||||
self.cells[i].last_ms = 0;
|
||||
self.cells[i].last_ok = false;
|
||||
self.cells[i].last_error.clear();
|
||||
if self.cells[i].listed {
|
||||
self.cells[i].status = CellStatus::Never;
|
||||
}
|
||||
self.journal.retain(|j| j.cell != cell);
|
||||
Ok(self.summary())
|
||||
}
|
||||
|
||||
/// Clear displayed outputs and per-cell records; kernels and live state survive.
|
||||
pub fn clear_outputs(&mut self) -> Value {
|
||||
for cell in &mut self.cells {
|
||||
|
||||
Reference in new issue
Block a user