1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-09 11:46:49 +00:00

style(instances): the XML tab's editor is taller and its review marks the changed lines

The VM's XML editor takes most of the window's height and is framed like
a form field. The review dialog shows removed and added lines on a red and
green tint, and each part of the diff starts with its line number instead
of the unified diff's @@ header.
This commit is contained in:
catborise 2026-11-04 14:17:45 +03:00
parent 9cda2f4e1b
commit ab2192ef5f
7 changed files with 243 additions and 211 deletions

View file

@ -60,11 +60,12 @@
save.classList.toggle("d-none", lines.length === 0);
save.disabled = false;
diff.replaceChildren();
// skip the two file header lines; + added, - removed, @@ where
// skip the two file header lines; + added, - removed, @@ where: "@@ -1,9 +1,9 @@" shows as "Line 1"
lines.slice(2).forEach(function (line) {
var row = document.createElement("div");
row.textContent = line;
row.className = {"+": "text-success", "-": "text-danger", "@": "text-body-secondary"}[line[0]] || "";
var hunk = line.match(/^@@ -\d+(?:,\d+)? \+(\d+)/);
row.textContent = hunk ? diff.dataset.line.replace("__line__", hunk[1]) : line;
row.className = hunk ? "diff-hunk small text-body-secondary" : {"+": "diff-add text-success", "-": "diff-del text-danger"}[line[0]] || "";
diff.appendChild(row);
});
diff.classList.toggle("d-none", lines.length === 0);