guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/02: hydra: status: Handle build failures.


From: Danny Milosavljevic
Subject: 01/02: hydra: status: Handle build failures.
Date: Sat, 5 May 2018 08:18:06 -0400 (EDT)

dannym pushed a commit to branch master
in repository maintenance.

commit 350d7e65bdbefe98f71c2732fe269eff57fd7b0d
Author: Danny Milosavljevic <address@hidden>
Date:   Sat May 5 14:02:46 2018 +0200

    hydra: status: Handle build failures.
    
    * hydra/nginx/html/status/index.html: Handle build failures.
---
 hydra/nginx/html/status/index.html | 37 +++++++++++++++++++++++++++++++------
 1 file changed, 31 insertions(+), 6 deletions(-)

diff --git a/hydra/nginx/html/status/index.html 
b/hydra/nginx/html/status/index.html
index aca6f98..7f5be64 100644
--- a/hydra/nginx/html/status/index.html
+++ b/hydra/nginx/html/status/index.html
@@ -37,6 +37,9 @@ tr.filter {
 }
 span {
 }
+div.failed {
+       background-color: red;
+}
 -->
 </style>
 <script>
@@ -222,9 +225,17 @@ function element(tagName, name) {
        return r;
 }
 
+function isBuildstatusFailed(buildstatus) {
+       return buildstatus && buildstatus > 0;
+}
+
+function isBuildstatusQueued(buildstatus) {
+       return buildstatus && buildstatus < 0;
+}
+
 /** Given a TABLE and PACKAGEGROUPID, adds an entry for build BUILDID to it.
-LINK specifies whether to add a link to show the log. */
-function addPackagegroupelement(table, packagegroupid, buildid, system, 
buildtime, loglink) {
+LOGLINK specifies whether to add a link to show the log. */
+function addPackagegroupelement(table, packagegroupid, buildid, system, 
buildtime, buildstatus, loglink) {
        let rootbody = table.getElementsByTagName("tbody")[0];
        let packagegroups = getElementsByName(rootbody, "packagegroup_" + 
packagegroupid);
        if (packagegroups.length == 0) {
@@ -233,7 +244,7 @@ function addPackagegroupelement(table, packagegroupid, 
buildid, system, buildtim
                tr.className = "packagegroup";
 
                let packagenamespan = element("span", "packagename");
-               packagenamespan.textContent = packagegroupid;
+               packagenamespan.textContent = 
cpackagegrouplabel(packagegroupid);
                tr.appendChild(td(packagenamespan));
 
                tr.appendChild(element("td", "builds", "builds"));
@@ -253,6 +264,9 @@ function addPackagegroupelement(table, packagegroupid, 
buildid, system, buildtim
        updateMultientry(buildstd, buildid, function() {
                let div = document.createElement("div");
                div.name = buildid;
+               if (isBuildstatusFailed(buildstatus)) {
+                       div.className = "failed";
+               }
                let a = element("a", system);
                if (loglink) {
                        a.href = URLPREFIX + "build/" + 
encodeURIComponent(buildid) + "/log/raw";
@@ -276,11 +290,20 @@ function addPackagegroupelement(table, packagegroupid, 
buildid, system, buildtim
        updateLatestbuildtime(buildtimestd);
 }
 
+/* Returns a key by which groups are formed (elements with the same key go 
into the same group) */
 function cpackagegroupid(datanode) {
        let s = datanode.job;
+       let buildstatus = datanode.buildstatus;
        let i = s.lastIndexOf(".");
+       let s_buildstatus = isBuildstatusQueued(buildstatus) ? "queued." : 
"finished.";
        // Strip off ".i686-linux" etc.
-       return s.substring(0, i);
+       return s_buildstatus + s.substring(0, i);
+}
+
+/* Given a cpackagegroupid, returns a human-readable label for it. */
+function cpackagegrouplabel(id) {
+       let i = id.indexOf(".");
+       return id.substring(i + 1);
 }
 
 /** Update filtered tables */
@@ -320,8 +343,9 @@ function displayQueuedbuilds(jsonResponse) {
                let buildid = datanode.id;
                let system = datanode.system;
                let buildtime = datanode.timestamp;
+               let buildstatus = datanode.buildstatus;
                removePackagegroupelement(latestbuilds, packagegroupid, 
buildid);
-               addPackagegroupelement(queuedbuildsElement, packagegroupid, 
buildid, system, buildtime, /*link*/false);
+               addPackagegroupelement(queuedbuildsElement, packagegroupid, 
buildid, system, buildtime, buildstatus, /*link*/false);
        });
        refilter(queuedbuilds, queuedbuildsfilters);
 }
@@ -336,8 +360,9 @@ function displayLatestbuilds(jsonResponse) {
                let buildid = datanode.id;
                let system = datanode.system;
                let buildtime = datanode.stoptime || datanode.timestamp;
+               let buildstatus = datanode.buildstatus;
                removePackagegroupelement(queuedbuildsElement, packagegroupid, 
buildid);
-               addPackagegroupelement(latestbuilds, packagegroupid, buildid, 
system, buildtime, /*link*/true);
+               addPackagegroupelement(latestbuilds, packagegroupid, buildid, 
system, buildtime, buildstatus, /*link*/true);
        });
        refilter(latestbuilds, latestbuildsfilters);
 }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]