feat(notebook): reload, journal and state panel polish

D3 (partial): reload re-parses the document while preserving kernels, marks changed cells dirty; Journal and Reload view actions; filtered Node variable names for the state panel; per-session timeout parsing before spawn.
This commit is contained in:
cflmy committed 2026-10-18 01:41:36 +08:00
1 parent 3001ed7ba5
commit 9873df7099
6 files changed
+131 -6

No files matched your search

+19
View File
@@ -2842,6 +2842,8 @@ fn notebook_ui() -> &'static str {
<button type="button" id="nb-restart">Restart &amp; Run All</button>
<button type="button" id="nb-step">Step</button>
<button type="button" id="nb-state">State</button>
<button type="button" id="nb-journal">Journal</button>
<button type="button" id="nb-reload">Reload</button>
<span id="nb-status">opening…</span>
</div>
<div class="notebook-bar" id="nb-state-actions" hidden>
@@ -3016,6 +3018,21 @@ fn notebook_ui() -> &'static str {
status(r.ok ? "pulled " + n + " ← " + k : "pull failed");
});
});
bind("nb-journal", function () {
post("/api/session/journal", {}).then(function (r) {
var pre = document.getElementById("nb-state-out");
if (!pre) return;
pre.hidden = false;
pre.textContent = JSON.stringify(r.journal || r, null, 2);
});
});
bind("nb-reload", function () {
post("/api/session/reload", {}).then(function (r) {
if (!r.ok) { status(r.error || "reload failed"); return; }
renderSummary(r.session);
status("reloaded");
});
});
document.addEventListener("click", function (e) {
var btn = e.target && e.target.closest ? e.target.closest(".code-run") : null;
if (!btn || !state.open) return;
@@ -3428,6 +3445,8 @@ mod tests {
"nb-restart",
"nb-step",
"nb-state",
"nb-journal",
"nb-reload",
"nb-kernel-input",
"nb-push",
"nb-pull",