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:
+6
-1
@@ -430,7 +430,12 @@
|
||||
|
||||
<!-- Commit section -->
|
||||
<div class="git-section">
|
||||
<label class="git-section-title">Commit all diagrams</label>
|
||||
<div style="display:flex;align-items:center;justify-content:space-between">
|
||||
<label class="git-section-title">Commit diagrams</label>
|
||||
<label style="font-size:11px;color:#8899bb;display:flex;align-items:center;gap:5px;cursor:pointer">
|
||||
<input type="checkbox" id="git-scope-current"> Current diagram only
|
||||
</label>
|
||||
</div>
|
||||
<div style="display:flex;gap:6px;align-items:flex-start">
|
||||
<textarea id="git-commit-msg" placeholder="Describe what changed…" rows="2"
|
||||
style="flex:1;resize:vertical;font-size:12px;padding:5px;background:#0d0d20;color:#ccd;border:1px solid #2a2a44;border-radius:4px"></textarea>
|
||||
|
||||
+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