Tweak builds page
This commit is contained in:
parent
ededf454a0
commit
6d85c4a859
1 changed files with 7 additions and 3 deletions
|
|
@ -30,6 +30,7 @@
|
||||||
if (oEvent.event == "upd") {
|
if (oEvent.event == "upd") {
|
||||||
var buildElement = document.getElementById(oEvent.build.name);
|
var buildElement = document.getElementById(oEvent.build.name);
|
||||||
if (buildElement) {
|
if (buildElement) {
|
||||||
|
// update event element
|
||||||
buildElement.build = oEvent.build;
|
buildElement.build = oEvent.build;
|
||||||
} else {
|
} else {
|
||||||
var rowId = `branch-${oEvent.build.target_branch}`;
|
var rowId = `branch-${oEvent.build.target_branch}`;
|
||||||
|
|
@ -38,20 +39,23 @@
|
||||||
}
|
}
|
||||||
var rowElement = document.getElementById(rowId);
|
var rowElement = document.getElementById(rowId);
|
||||||
if (!rowElement) {
|
if (!rowElement) {
|
||||||
|
// create row
|
||||||
rowElement = document.createElement("div");
|
rowElement = document.createElement("div");
|
||||||
rowElement.classList.add("row");
|
rowElement.classList.add("row");
|
||||||
rowElement.id = rowId;
|
rowElement.id = rowId;
|
||||||
document.getElementById("builds").appendChild(rowElement);
|
document.getElementById("builds").appendChild(rowElement);
|
||||||
}
|
}
|
||||||
|
// add build element to row
|
||||||
buildElement = document.createElement("runboat-build");
|
buildElement = document.createElement("runboat-build");
|
||||||
buildElement.id = oEvent.build.name;
|
buildElement.id = oEvent.build.name;
|
||||||
rowElement.appendChild(buildElement);
|
rowElement.appendChild(buildElement);
|
||||||
}
|
}
|
||||||
} else {
|
} else if (oEvent.event == "del") {
|
||||||
const buildElement = document.getElementById(oEvent.build.name);
|
const buildElement = document.getElementById(oEvent.build.name);
|
||||||
buildElement.remove();
|
if (buildElement) {
|
||||||
|
buildElement.remove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
buildElement.build = oEvent.event == "upd" ? oEvent.build : {};
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue