Skip to content
This repository has been archived by the owner on May 24, 2018. It is now read-only.

Commit

Permalink
Merge 9302ec8 into 59f9895
Browse files Browse the repository at this point in the history
  • Loading branch information
Kateryna Musina committed Feb 10, 2016
2 parents 59f9895 + 9302ec8 commit d3e679a
Show file tree
Hide file tree
Showing 17 changed files with 315 additions and 228 deletions.
4 changes: 3 additions & 1 deletion master/buildbot/status/web/jsontestresults.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# Copyright Buildbot Team Members
import json
from twisted.python import log
from os.path import join
from os.path import join, basename, splitext
from buildbot.status.web.base import HtmlResource, path_to_builder, path_to_builders, path_to_codebases, path_to_build


Expand Down Expand Up @@ -45,6 +45,8 @@ def content(self, req, cxt):
cxt['build_number'] = b.getNumber()
cxt['path_to_artifacts'] = self.get_artifact_path(b)
cxt['join'] = join
cxt['basename'] = basename
cxt['splitext'] = splitext
cxt['selectedproject'] = project

try:
Expand Down
4 changes: 2 additions & 2 deletions www/Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module.exports = function (grunt) {
dest: "prod/script/main.js",
include: [
"require.js",
"testResults",
"rtTestReport",
"buildLog",
"buildLogiFrame",
"login"
Expand Down Expand Up @@ -218,7 +218,7 @@ module.exports = function (grunt) {
if (overrideTarget !== undefined) {
target = overrideTarget;
}
grunt.task.run(["fontelloUpdate", "sass", "cssmin", "handlebars:compile", "requirejs:" + target]);
grunt.task.run(["sass", "cssmin", "handlebars:compile", "requirejs:" + target]);
});
grunt.registerTask("test", ["karma:unit"]);
grunt.registerTask("coverage", ["karma:coverage", "open:coverage"]);
Expand Down
2 changes: 1 addition & 1 deletion www/prod/css/default.css
Original file line number Diff line number Diff line change
Expand Up @@ -1423,7 +1423,7 @@ button.toast-close-button{padding:0;cursor:pointer;background:0 0;border:0;-webk
span.covered{background:#00df00}
span.uncovered{background:#df0000;border-top:#9c9c9c 1px solid;border-bottom:#9c9c9c 1px solid;border-right:#9c9c9c 1px solid}
span.ignored{background:#ff0}
.Failed{background-color:#EFCFCF;border-top:1px solid #FFF}
.Error,.Failed{background-color:#EFCFCF;border-top:1px solid #FFF}
.failure-detail-cont{vertical-align:top}
.failure-detail-cont a{margin-right:5px}
.Passed,.Success{border-top:1px solid #FFF;background-color:#DDE6D6}
Expand Down
8 changes: 4 additions & 4 deletions www/prod/script/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion www/prod/script/main.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion www/sass/_testreport.scss
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ span.uncovered {
}
span.ignored {background: #ffff00;}

.Failed {background-color: #EFCFCF;border-top: 1px solid #FFFFFF;}
.Failed, .Error {background-color: #EFCFCF;border-top: 1px solid #FFFFFF;}

.failure-detail-cont {
vertical-align:top;
Expand Down
2 changes: 1 addition & 1 deletion www/script/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ require.config({
"rtGenericTable": "project/rtGenericTable",
"userSettings": "project/userSettings",
"toastr": "plugins/toastr",
"testResults": "project/testresults-common",
"rtTestReport": "project/rtTestReport",
"buildLog": "project/buildLog",
"buildLogiFrame": "project/buildLog-iFrame",
"login": "project/login",
Expand Down
8 changes: 6 additions & 2 deletions www/script/project/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ define(function (require) {
NOT_STARTED: [10, "not-started"],
None: ""
},
settings = {};
settings = {},
key_codes = {
ENTER : 13
};

$.each(css_classes, function (key, val) {
css_class_enum[key] = val[0];
Expand Down Expand Up @@ -651,7 +654,8 @@ define(function (require) {
$.cookie('exthistorylist', cookie, {expires: 10000000000, path: "/"});
}
}
}
},
keyCodes : key_codes
};

return helpers;
Expand Down
17 changes: 15 additions & 2 deletions www/script/project/realtimeRouting.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,20 @@
define(function (require) {
"use strict";

var helpers = require('helpers');
var helpers = require('helpers'),
_callbacks = {};

return {
addPageInitHandler : function(key, callback) {
if (!key || !callback) {
return;
}
_callbacks[key] = callback;
},
init: function () {
/*jslint white: true */
switch (helpers.getCurrentPage()) {
var page = helpers.getCurrentPage();
switch (page) {
case 'builddetail_page':
// For the builddetailpage
require(['rtBuildDetail'],
Expand Down Expand Up @@ -62,6 +70,11 @@ define(function (require) {
});
break;
default:
if(Object.keys(_callbacks).indexOf(page) > -1)
{
_callbacks[page]();
break;
}
// For pages without overriden realtime
require(['rtGlobal'],
function (rtGlobal) {
Expand Down
191 changes: 191 additions & 0 deletions www/script/project/rtTestReport.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
/*global define, jQuery, require */
define(function (require) {
"use strict";

var $ = require('jquery'),
helpers = require('helpers'),
moment = require('moment'),
oTable,
th,
rtTestReport,
realtimeRouting = require('realtimerouting');


rtTestReport = {
init: function () {
th = $('.table-holder');
rtTestReport.dataTablesInit();
rtTestReport.parseTimes("[data-time]");
rtTestReport.setupFilterButtons();
rtTestReport.addCodebasesBar();

var checkboxesList = $('#CheckBoxesList').find('input');
checkboxesList.bind("click.katana", function () {
rtTestReport.filterCheckboxes();
});
rtTestReport.filterCheckboxes();
helpers.initRecentBuildsFilters();

setTimeout(rtTestReport.addFailureButtons, 100);
},
dataTablesInit: function () {
//Filter tables based on checkboxes
$.fn.dataTableExt.oApi.fnFilterAll = function (oSettings, sInput, iColumn, bRegex, bSmart) {
var settings = $.fn.dataTableSettings,
i;

for (i = 0; i < settings.length; i += 1) {
settings[i].oInstance.fnFilter(sInput, iColumn, bRegex, bSmart);
}

$('.dataTables_empty').closest(th).hide();
};

//Filter when return is hit
$.fn.dataTableExt.oApi.fnFilterOnReturn = function () {
this.each(function (i) {
$.fn.dataTableExt.iApiIndex = i;
var anControl = $('input', this.fnSettings().aanFeatures.f);
anControl.unbind('keyup').bind('keypress.katana', function (e) {
if (e.which === helpers.keyCodes.ENTER) {
$.fn.dataTableExt.iApiIndex = i;
this.fnFilter(anControl.val());
}
});
return this;
});
return this;
};

//Setup all datatables
oTable = $('.tablesorter-log-js').dataTable({
"asSorting": false,
"bPaginate": false,
"bFilter": true,
"bSort": false,
"bInfo": false,
"bAutoWidth": false
});

$('a.collapse').click(function () {
var target = $(this).attr('data-target');
var hidden = $(target).is(":hidden");
$(target).toggle(hidden);
});
},
addFailureButtons: function () {
$('.failure-detail-cont', th).each(function () {
var $fdTxt = $('.failure-detail-txt', this);
$fdTxt.text($fdTxt.text().trim());
$(this).height($fdTxt.height() + 40);

if (!$fdTxt.is(':empty')) {
$('<a href="#" class="new-window var-3 grey-btn">Open new window</a>').insertBefore($fdTxt);
if ($fdTxt.height() >= 130) {
$('<a class="height-toggle var-3 grey-btn" href="#">Show more</a>').insertBefore($fdTxt);
}
}

});

// show content of exceptions in new window
$('.new-window').bind("click.katana", function (e) {
e.preventDefault();
var newWinHtml = $(this).parent().find($('.failure-detail-txt')).html();
rtTestReport.openNewWindow(newWinHtml);
});

// show more / hide
$('.height-toggle').bind("click.katana", function (e) {
e.preventDefault();
var $failDetail = $(this).parent().find($('.failure-detail-txt')),
parentTd = $(this).parent().parent();

$failDetail.css({'max-height': 'none', 'height': ''});

if (!$(this).hasClass('expanded-js')) {
$(this).addClass('expanded-js');
$(this).text('Show less');
$failDetail.css('height', '');
parentTd.css('height', $failDetail.height() + 40);
} else {
$(this).removeClass('expanded-js');
$(this).text('Show more');
$failDetail.css('max-height', 130);
parentTd.css('height', 170);
}
});
},
parseTimes: function (elements) {
$.each($(elements), function (i, elem) {
var timeUnit = $(elem).attr("data-time-unit");
var msUnit = timeUnit && timeUnit.trim().toLowerCase() === "ms";
var ms = parseFloat($(elem).attr("data-time")) * (msUnit ? 1 : 1000.0),
parsedTime = moment.utc(ms).format("HH:mm:ss");
$(elem).append(parsedTime);
});
},
filterCheckboxes: function () {
var iFields = $('#CheckBoxesList').find('input:checked'),
checkString = [];
th.show();

iFields.each(function () {
checkString.push('(' + $(this).val() + ')');
});
oTable.fnFilterAll(checkString.join("|"), 1, true);
},
setupFilterButtons: function () {
// submit on return
var $filterInput = $("#filterinput"),
$submitButton = $('#submitFilter'),
failedTests = $(".log-main").attr("data-failed-tests");

$filterInput.keydown(function (event) {
// Filter on the column (the index) of this element
var e = window.event || event;
if (e.keyCode === helpers.keyCodes.ENTER) {
rtTestReport.filterTables(this.value);
}
});

$submitButton.bind("click.katana", function () {
rtTestReport.filterTables($filterInput.val());
});

// clear the input field
$('#clearFilter').bind("click.katana", function () {
$filterInput.val("");
$submitButton.click();
});

if (failedTests === 0) {
$("#failedinput").attr("checked", false);
$("#passinput").attr("checked", true);
}
},
filterTables: function (inputVal, num, bool) {
th.show(inputVal);
oTable.fnFilterAll(inputVal, num, bool);
},
openNewWindow: function (html) {
var w = window.open();

html = "<style>body {padding:0 0 0 15px;margin:0;" +
"font-family:'Courier New';font-size:12px;white-space:" +
" pre;overflow:auto;}</style>" + html;

$(w.document.body).html(html);
},
addCodebasesBar: function () {
// insert codebase and branch on the builders page
helpers.tableHeader($('.top'));
}
};

realtimeRouting.addPageInitHandler("testresults_page",function () {
rtTestReport.init();
});

return rtTestReport;
});
Loading

0 comments on commit d3e679a

Please sign in to comment.