Krinkle has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/58239


Change subject: Zuul status page: Fix flow bug when job doesn't have a url yet.
......................................................................

Zuul status page: Fix flow bug when job doesn't have a url yet.

The status badge is floated to the right. If the job name is too
long to fit on one line, the badge is bumped to the next line.

Normally this is not a problem as the anchor tag clears the
float with `overflow: hidden;`, but when there is no url, there
is no anchor tag.

Fixed by making sure it is wrapped in an element regardless of
the presence of the url.

Also:
- Fixed sample JSON to hit this edge case.
- Separated generic css from the css only applicable in
  bootstrap layout.

Change-Id: I312d9df18d617bd3baca28a5361e5e765163d4d7
---
M org/wikimedia/integration/zuul/index.php
M org/wikimedia/integration/zuul/sample-status-basic.json
M org/wikimedia/integration/zuul/status.js
3 files changed, 45 insertions(+), 22 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/integration/docroot 
refs/changes/39/58239/1

diff --git a/org/wikimedia/integration/zuul/index.php 
b/org/wikimedia/integration/zuul/index.php
index 68c5b97..7664f12 100644
--- a/org/wikimedia/integration/zuul/index.php
+++ b/org/wikimedia/integration/zuul/index.php
@@ -49,17 +49,11 @@
 
 .zuul-change-id {
        text-transform: none;
-       float: right;
-}
-
-.zuul-change-job a {
-       overflow: auto;
 }
 
 .zuul-result {
        text-shadow: none;
        font-weight: normal;
-       float: right;
        background-color: #E9E9E9;
        color: #555;
 }
@@ -95,6 +89,23 @@
 .zuul-msg p {
        margin: 0;
 }
+
+/**
+ * Zuul status (bootstrap layout)
+ */
+
+.zuul-change-id {
+       float: right;
+}
+
+.zuul-change-job-link {
+       overflow: auto;
+       display: block;
+}
+
+.zuul-result {
+       float: right;
+}
 ');
 
 $p->addHtmlContent('
diff --git a/org/wikimedia/integration/zuul/sample-status-basic.json 
b/org/wikimedia/integration/zuul/sample-status-basic.json
index 0994eac..4e12cd6 100644
--- a/org/wikimedia/integration/zuul/sample-status-basic.json
+++ b/org/wikimedia/integration/zuul/sample-status-basic.json
@@ -126,20 +126,32 @@
                                     {
                                         "name": "zuul-test",
                                         "url": 
"#!/jenkins.example.org/job/zuul-test/200",
-                                        "result": "SUCCESS",
-                                        "voting": true
-                                    },
-                                    {
-                                        "name": "zuul-regression",
-                                        "url": 
"#!/jenkins.example.org/job/zuul-regression/200",
                                         "result": "FAILURE",
                                         "voting": true
                                     },
                                     {
-                                        "name": "zuul-performance",
-                                        "url": 
"#!/jenkins.example.org/job/zuul-performance/200",
+                                        "name": "zuul-regression-python2",
+                                        "url": 
"#!/jenkins.example.org/job/zuul-regression-python2/200",
+                                        "result": "SUCCESS",
+                                        "voting": true
+                                    },
+                                    {
+                                        "name": "zuul-regression-python3",
+                                        "url": 
"#!/jenkins.example.org/job/zuul-regression-python3/200",
+                                        "result": "FAILURE",
+                                        "voting": true
+                                    },
+                                    {
+                                        "name": "zuul-performance-python2",
+                                        "url": null,
                                         "result": null,
-                                        "voting": false
+                                        "voting": true
+                                    },
+                                    {
+                                        "name": "zuul-performance-python3",
+                                        "url": null,
+                                        "result": null,
+                                        "voting": true
                                     },
                                     {
                                         "name": "zuul-docs-publish",
diff --git a/org/wikimedia/integration/zuul/status.js 
b/org/wikimedia/integration/zuul/status.js
index 67fbb68..563c8be 100644
--- a/org/wikimedia/integration/zuul/status.js
+++ b/org/wikimedia/integration/zuul/status.js
@@ -20,7 +20,9 @@
 (function ($) {
        var $container, $msg, $msgWrap, $indicator, prevHtml, xhr, zuul, $jq,
                demo = location.search.match(/[?&]demo=([^?&]*)/),
-               source = demo ? './sample-status-' + (demo[1] || 'basic') + 
'.json' : '/zuul/status.json';
+               source = demo ?
+                       './sample-status-' + (demo[1] || 'basic') + '.json' :
+                       '/zuul/status.json';
 
        zuul = {
                enabled: true,
@@ -129,17 +131,15 @@
                                                break;
                                        }
                                        html += '<li class="zuul-change-job">';
-                                       if (job.url !== null) {
-                                               html += '<a href="' + job.url + 
'">';
-                                       }
+                                       html += job.url !== null ?
+                                               '<a href="' + job.url + '" 
class="zuul-change-job-link">' :
+                                               '<span 
class="zuul-change-job-link">';
                                        html += job.name;
                                        html += ' <span class="' + resultClass 
+ '">' + result + '</span>';
                                        if (job.voting === false) {
                                                html += ' <span 
class="muted">(non-voting)</span>';
                                        }
-                                       if (job.url !== null) {
-                                               html += '</a>';
-                                       }
+                                       html += job.url !== null ? '</a>' : 
'</span>';
                                        html += '</li>';
                                });
 

-- 
To view, visit https://gerrit.wikimedia.org/r/58239
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I312d9df18d617bd3baca28a5361e5e765163d4d7
Gerrit-PatchSet: 1
Gerrit-Project: integration/docroot
Gerrit-Branch: master
Gerrit-Owner: Krinkle <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to