aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bugzillaBugTriage.js99
1 files changed, 49 insertions, 50 deletions
diff --git a/bugzillaBugTriage.js b/bugzillaBugTriage.js
index 324aeff..d3ef752 100644
--- a/bugzillaBugTriage.js
+++ b/bugzillaBugTriage.js
@@ -196,9 +196,9 @@ Color.prototype.hs = function(nStr) {
};
Color.prototype.toString = function() {
- var rH = Number(this.r.toFixed()).toString(16);
- var gH = Number(this.g.toFixed()).toString(16);
- var bH = Number(this.b.toFixed()).toString(16);
+ var rH = new Number(this.r.toFixed()).toString(16);
+ var gH = new Number(this.g.toFixed()).toString(16);
+ var bH = new Number(this.b.toFixed()).toString(16);
return "#"+this.hs(rH)+this.hs(gH)+this.hs(bH);
};
@@ -378,8 +378,8 @@ Color.prototype.hsvToRgb = function (h, s, v){
*/
Color.prototype.lightColor = function() {
var hslArray = this.hsl();
- var h = Number(hslArray[0]);
- var s = Number(hslArray[1]) * Desaturated;
+ var h = new Number(hslArray[0]);
+ var s = new Number(hslArray[1]) * Desaturated;
var l = Luminosity;
var desA = this.hslToRgb(h, s, l);
return new Color(desA[0],desA[1],desA[2]);
@@ -429,7 +429,7 @@ bzPage.prototype.getVersion = function () {
if (/rawhide/.test(verStr)) {
verNo = 999;
} else {
- verNo = Number(verStr);
+ verNo = new Number(verStr);
}
return verNo;
};
@@ -525,15 +525,14 @@ bzPage.prototype.setBranding = function () {
style.background = brandColor.toString() + " none";
this.dok.getElementById("titles").
style.background = brandColor.toString() + " none";
-
+
// Remove "Bug" from the title of the bug page, so we have more space with plenty of tabs
var titleElem = this.dok.getElementsByTagName("title")[0];
titleElem.textContent = titleElem.textContent.slice(4);
- // var bodyTitleElem = this.dok.querySelector("#summary_alias_container ")
var bodyTitleParent = this.dok.getElementById("summary_alias_container").parentNode;
var bodyTitleElem = bodyTitleParent.getElementsByTagName("b")[0];
bodyTitleElem.textContent = bodyTitleElem.textContent.slice(4);
-
+
// Make background-color of the body of bug salmon pink
// for security bugs.
if (this.hasKeyword("Security")) {
@@ -550,6 +549,7 @@ bzPage.prototype.setBranding = function () {
// we should make visible whether maintCCAddr is in CCList
if (isInList(this.maintCCAddr, this.CCList)) {
let ccEditBoxElem = this.dok.getElementById("cc_edit_area_showhide");
+ //ccEditBoxElem.textContent = "*"+ccEditBoxElem.textContent;
ccEditBoxElem.style.color = "navy";
ccEditBoxElem.style.fontWeight = "bolder";
ccEditBoxElem.style.textDecoration = "underline";
@@ -646,7 +646,7 @@ bzPage.prototype.fillInWhiteBoard = function (iLine, driverStr) {
* Generic function to add new button to the page.
* Actually copies new button from the old one (in order to have the same
* look-and-feel, etc.
- * @param originalLocation object with the button to be copied from
+ * @param originalLocation object after which the new button will be added
* @param newId string with the id of the new button; has to be unique in
whole page
* @param newLabel string with the label which will be shown to user
@@ -741,15 +741,12 @@ bzPage.prototype.fillInChipMagic = function () {
* @param product (optional) string with the product name
* @return None
*
- * TODO make this method parametrized and use it for once for general search (as it is now)
- * a second time for the search for the same card_ID cards (button next to the Whiteboard field
- * when it matches card_ string).
- * FIXME search only in the same product version &version=11
+ * FIXME search only in the same version &version=11
*/
bzPage.prototype.queryInNewTab = function(text,component,product) {
// Optional parameter
if (product === undefined) {
- product = "Fedora";
+ product = this.product;
}
var url = "https://bugzilla.redhat.com/buglist.cgi?query_format=advanced";
if (product) {
@@ -758,6 +755,8 @@ bzPage.prototype.queryInNewTab = function(text,component,product) {
if (component) {
url += "&field0-0-0=component&type0-0-0=substring&value0-0-0="+component.trim();
}
+ // using more complicated query tables here, because they can be more easily edited
+ // for further investigative searches
if (text) {
text = text.trim();
url += "&field1-0-0=longdesc&type1-0-0=substring&value1-0-0="+text+
@@ -792,24 +791,24 @@ bzPage.prototype.queryForSelection = function() {
and the whole element itself
*/
bzPage.prototype.parseAttachmentLine = function (inElem,idx) {
- var MIMEtype = String();
- var size = Number();
+ var MIMEtype = new String();
+ var size = new Number();
// Skip over obsolete attachments
- if ($(".bz_obsolete",inElem).length>0) {
+ if (inElem.getElementsByClassName("bz_obsolete").length>0) {
return([]);
}
// getting name of the attachment
- var attName = $("b:first", inElem).text().trim();
+ var attName = inElem.getElementsByTagName("b")[0].textContent.trim();
// getting id
- var aHrefs = $("a:contains('Details')", inElem);
+ var aHrefs = $("a:contains('Details')", inElem); //FIXME
var id = parseInt(aHrefs.attr("href").replace(/^.*attachment.cgi\?id=/, ""),10);
//getting MIME type and size
- var stringArray = $(".bz_attach_extra_info",inElem).text().
- replace(/[\n ()]+/g," ").trim().split(", ");
+ var stringArray = inElem.getElementsByClassName("bz_attach_extra_info")[0].
+ textContent.replace(/[\n ()]+/g," ").trim().split(", ");
size = parseInt(stringArray[0],10);
MIMEtype = stringArray[1].split(" ")[0];
@@ -1126,7 +1125,7 @@ bzPage.prototype.addClosingUpstream = function() {
});
if (params.id) {
externalBugID = parseInt(params.id,10);
- inputBox.val(externalBugID);
+ inputBox.val(externalBugID);
}
// get host and bugzillaName
var bugzillaName = this.getBugzillaName(helpAElem.hostname);
@@ -1180,7 +1179,7 @@ bzPage.prototype.generateToolBar = function(anchor,array) {
bzPage.prototype.generalPurposeCureForAllDisease = function
(addString,nextState,secondParameter) {
var verNo = this.getVersion();
-
+
if (addString.length >0) {
this.addTextToTextBox("comment",addString);
}
@@ -1238,7 +1237,7 @@ bzPage.prototype.generalPurposeCureForAllDisease = function
$("#newcc",this.doc).text(this.maintCCAddr);
}
if ((!this.isRHEL()) && (verNo < TriagedDistro)) {
- this.selectOption("bug_status", nextState);
+ this.selectOption("bug_status", nextState);
}
this.setKeyword("Triaged");
} else if (nextState === "QUERYSEL") {
@@ -1269,14 +1268,14 @@ bzPage.prototype.parseBacktrace = function (ret) {
var i = 0, ii = splitArray.length;
var outStr = "", curLine = "", numStr = "";
var lineCounter = 0, endLineNo = 0;
-
+
while ( i < ii ) {
if (signalHandlerRE.test(splitArray[i])) {
break;
}
i++;
}
-
+
if (i < ii) {
lineCounter = parseInt(frameNoRE.exec(splitArray[i])[1],10);
endLineNo = lineCounter + NumberOfFrames;
@@ -1305,31 +1304,30 @@ bzPage.prototype.parseBacktrace = function (ret) {
*/
bzPage.prototype.buildButtons = function (above,below) {
//Generate a list of <input> elements in the page
- var IBLast = $("#commit_top", this.doc);
- this.addNewButton(IBLast,"changeOwnerbtn","reASSIGN",
- "","ASSIGNED","NODEFAULTASSIGNEE");
+ this.addNewButton(this.dok.getElementById("commit_top"),
+ "changeOwnerbtn","reASSIGN","","ASSIGNED","NODEFAULTASSIGNEE");
// THE MAIN BUTTON ROWS
- var commentBox = $("#comment", this.doc);
- commentBox.before("<br>");
- this.generateToolBar(commentBox.prev(),above);
+ var commentBox = this.dok.getElementById("comment");
+ var brElement = this.dok.createElement("br");
+ commentBox.parentNode.normalize();
+ commentBox.parentNode.insertBefore(brElement,commentBox);
+ this.generateToolBar(commentBox.previousSibling,above);
this.generateToolBar(this.originalButton,below);
if (queryButtonAvailable) {
// Add query search button
- // Apparently there is a bug in jQuery, we have to use plain DOM
- //newPosition = $("#newcommentprivacy ~ br", this.doc);
- newPosition = $(this.dok.querySelector("#newcommentprivacy ~ br"));
- newPosition.css("border","solid blue");
- this.addNewButton(newPosition,"newqueryintab","Query for string",
- "","QUERYSEL","",false);
- }
+ var triagedButton = this.dok.getElementById("comment_status_commit");
+ var brElementPlacer = triagedButton.getElementsByTagName("br")[0];
+ this.addNewButton(brElementPlacer,"newqueryintab",
+ "Query for string","","QUERYSEL","",false);
+ }
// FIXME Get compiz bugs as well
if ((chipIDsGroupings.length >0) &&
this.maintCCAddr === "xgl-maint@redhat.com") {
// Add find chip magic button
- var whiteboard_string = $("#status_whiteboard", this.doc).val();
- if (isInList("card_",whiteboard_string)) {
+ var whiteboard_string = this.dok.getElementById("status_whiteboard").value;
+ if (!/card_/.test(whiteboard_string)) {
this.fillInChipMagic();
}
}
@@ -1367,11 +1365,12 @@ function bzPage(doc) {
this.product = $("#product option:selected:first", this.doc).text();
this.component = $("#component option:selected:first", this.doc).text();
this.version = this.getVersion();
-// var ITbutton = this.dok.getElementById("cf_issuetracker");
-// this.its = ITbutton ? ITbutton.value.trim() : "";
- this.its = ""; // FIXME for now
+ var ITbutton = this.dok.getElementById("cf_issuetracker");
+ this.its = ITbutton ? ITbutton.value.trim() : "";
this.CCList = $.makeArray($("#cc", this.doc).val());
- this.owner = $("#bz_assignee_edit_container .fn:first", this.doc).text();
+ // TODO be careful about this,seems breaking for non-RH BugZappers, but I cannot see why
+ this.owner = this.dok.getElementById("bz_assignee_edit_container").
+ getElementsByClassName("fn")[0].textContent;
this.defaultAssignee = filterByRegexp(defAssigneeList,
this.component).toLowerCase();
this.maintCCAddr = filterByRegexp(AddrArray,this.component).toLowerCase();
@@ -1400,15 +1399,15 @@ function bzPage(doc) {
// Dig out backtrace
this.btSnippet = "";
-
+
var bugTitle = $("#short_desc_nonedit_display", this.doc).text();
if (AbrtRE.test(bugTitle)) {
-
+
var notedLabel = $("label[for='newcc']", this.doc);
notedLabel.replaceWith(notedLabel.children());
$(".bz_alias_short_desc_container:first", this.doc).
append("\u00A0<a accesskey='a' href='"+abrtQueryURL+"'>Abrt bugs</a>");
-
+
if (!(this.hasKeyword("Triaged") ||
/btparsed/.test($("#cf_devel_whiteboard",this.doc).val()))) {
var btAttachments = this.attachments.filter(function (att,idx,arr) {
@@ -1425,7 +1424,7 @@ function bzPage(doc) {
if (that.btSnippet) {
that.addTextToTextBox("comment",that.btSnippet);
that.addTextToTextBox("cf_devel_whiteboard","btparsed");
- }
+ }
});
}
});