Browse Source

Add highlight Jenkins +1 functionality

Currently ciwatch highlights Jenkins -1 votes, but many
third party CIs pick up Gerrit events only when Jenkins
has voted +1. Hence it is important to highlight vendor
CI failures when Jenkins has verified the change set.

Closes-Bug: #1516110

Change-Id: I5635d344404c21206d7cae049f81fb1f2067ec09
changes/81/245281/4
apoorvad 5 years ago
committed by Mikhail S Medvedev
parent
commit
f52b39f483
3 changed files with 23 additions and 12 deletions
  1. +2
    -2
      ciwatch/events.py
  2. +17
    -7
      ciwatch/static/verified.js
  3. +4
    -3
      ciwatch/templates/project.html.jinja

+ 2
- 2
ciwatch/events.py View File

@ -48,7 +48,7 @@ def _process_event(event):
def _is_ci_user(name):
return 'CI' in name or 'Jenkins' in name
return 'CI' in name or 'Jenkins' in name or 'Bot' in name
# Check if this is a third party CI event
@ -139,7 +139,7 @@ def add_event_to_db(event, commit_=True):
trusted = (event["author"]["username"] == "jenkins")
if trusted and "approvals" in event:
if event["approvals"][0]["value"] in ("+1", "+2"):
if event["approvals"][0]["value"] in ("1", "2"):
patch_set.verified = True
elif event["approvals"][0]["value"] in ("-1", "-2"):
patch_set.verified = False


+ 17
- 7
ciwatch/static/verified.js View File

@ -13,21 +13,31 @@
* under the License.
*/
var toggle1 = function () {
$(".verified-1").css("background-color", "#FAA");
$(this).one("click", toggle2);
var toggle_verified_plus = function () {
var color = "#BFA";
if ($(this).hasClass("active")){
color = "";
}
$(".verified1").css("background-color", color);
}
var toggle2 = function () {
$(".verified-1").css("background-color", "");
$(this).one("click", toggle1);
var toggle_verified_minus = function () {
var color = "#FAA";
if ($(this).hasClass("active")){
color = "";
}
$(".verified-1").css("background-color", color);
}
$(document).ready(function () {
$("colgroup").each(function (i, elem) {
if ($(elem).hasClass("verified-1")) {
$("#results").find("td").filter(":nth-child(" + (i + 1) + ")").addClass("verified-1");
} else if ($(elem).hasClass("verified1")) {
$("#results").find("td").filter(":nth-child(" + (i + 1) + ")").addClass("verified1");
}
});
$("#verified-1-button").one("click", toggle1);
$("#verified1-button").on("click", toggle_verified_plus);
$("#verified-1-button").on("click", toggle_verified_minus);
});

+ 4
- 3
ciwatch/templates/project.html.jinja View File

@ -39,16 +39,17 @@
</div>
<button id="verified-1-button" class="btn btn-default" type="button" data-toggle="button">Highlight Jenkins -1 votes</button>
<button id="verified1-button" class="btn btn-default" type="button" data-toggle="button">Highlight Jenkins +1 votes</button>
</div>
<br>
<div class="table">
<table id="results" class="table table-bordered table-condensed">
<colgroup></colgroup>
{% for patch_set in patch_sets %}
{% if patch_set.verified is not none and not patch_set.verfied %}
{% if patch_set.verified %}
<colgroup class="verified1"></colgroup>
{% elif patch_set.verified is not none and not patch_set.verfied %}
<colgroup class="verified-1"></colgroup>
{% else %}
<colgroup></colgroup>


Loading…
Cancel
Save