add dbg function to hideci

This provides the facility to leave tracing in hideci that won't
trigger by default, however if trying to debug bad behavior you can
enter the javascript console, set hide_ci_debug = true.

Change-Id: I42bf4e830256ee64eb726e3a82d805f7ca35e246
This commit is contained in:
Sean Dague 2015-05-02 06:43:42 -04:00
parent 2507c4d7c8
commit 86d42106dc

View File

@ -26,6 +26,24 @@ var trustedCIRegex = /^(OpenStack CI|Jenkins)$/;
// this regex matches the pipeline markup
var pipelineNameRegex = /Build \w+ \((\w+) pipeline\)/;
// This is a variable to determine if we're in debugging mode, which
// lets you globally set it to see what's going on in the flow.
var hideci_debug = false;
/**
dbg(...) - prints a list of items out to the javascript
console.log. This allows us to leave tracing in this file which is a
no-op by default, but can be triggered if you enter a javascript
console and set hideci_debug = true.
*/
function dbg () {
if (hideci_debug == true) {
for (var i = 0; i < arguments.length; i++) {
console.log(arguments[i]);
}
}
}
var ci_parse_is_merge_conflict = function($panel) {
return (mergeFailedRegex.exec($panel.html()) !== null);
};
@ -144,6 +162,7 @@ var ci_parse_comments = function() {
comment.is_ci = (ciRegex.exec(comment.name) !== null);
comment.is_trusted_ci = (trustedCIRegex.exec(comment.name) !== null);
comment.ref = top;
dbg("Found comment", comment);
comments.push(comment);
}
});
@ -286,6 +305,7 @@ var ci_hide_ci_comments = function(comments) {
var ci_page_loaded = function() {
if (hashRegex.test(window.location.hash)) {
dbg("Searching for ci results on " + window.location.hash);
$("#toggleci").show();
var comments = ci_parse_comments();
ci_display_results(comments);