Scope git commit to current diagram + fix complete JSON export/import
- Git commit: "Current diagram only" checkbox stages only that diagram's JSON file instead of all diagrams - JSON export now includes: waypoints, twisted_pair, twist_pitch, shielded, show_size_label, bundle_id, bundle_label, sheet_id, sheets, wire_bundles - JSON import reconstructs sheets and bundles with remapped IDs so restored diagrams are exact copies Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -63,7 +63,7 @@ const api = {
|
||||
git: {
|
||||
status: () => apiFetch("/git/status"),
|
||||
log: () => apiFetch("/git/log"),
|
||||
commit: (message) => apiFetch("/git/commit", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ message }) }),
|
||||
commit: (message, diagram_id) => apiFetch("/git/commit", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ message, diagram_id: diagram_id ?? null }) }),
|
||||
push: () => apiFetch("/git/push", { method: "POST" }),
|
||||
history: (hash) => apiFetch(`/git/history/${hash}`),
|
||||
restore: (commit_hash, filepath, name) => apiFetch("/git/restore", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ commit_hash, filepath, name }) }),
|
||||
|
||||
+5
-2
@@ -2079,12 +2079,15 @@ class WiringApp {
|
||||
async _gitCommit() {
|
||||
const msg = document.getElementById("git-commit-msg")?.value?.trim();
|
||||
if (!msg) { alert("Enter a commit message first."); return; }
|
||||
const currentOnly = document.getElementById("git-scope-current")?.checked;
|
||||
if (currentOnly && !this.diagramId) { alert("No diagram is currently open."); return; }
|
||||
const diagramId = currentOnly ? this.diagramId : null;
|
||||
const status = document.getElementById("git-op-status");
|
||||
status.textContent = "Committing…"; status.style.color = "#aabb88";
|
||||
try {
|
||||
const r = await api.git.commit(msg);
|
||||
const r = await api.git.commit(msg, diagramId);
|
||||
if (r.status === "nothing_to_commit") {
|
||||
status.textContent = "Nothing to commit — diagrams unchanged.";
|
||||
status.textContent = "Nothing to commit — diagram unchanged.";
|
||||
status.style.color = "#8899bb";
|
||||
} else {
|
||||
status.textContent = "✓ Committed: " + r.output.split("\n")[0];
|
||||
|
||||
Reference in New Issue
Block a user