aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bugzillaBugTriage.js608
1 files changed, 321 insertions, 287 deletions
diff --git a/bugzillaBugTriage.js b/bugzillaBugTriage.js
index b1b4700..1c5c100 100644
--- a/bugzillaBugTriage.js
+++ b/bugzillaBugTriage.js
@@ -13,7 +13,6 @@ var NumberOfFrames = 7;
var XMLRPCurl = "https://bugzilla.redhat.com/xmlrpc.cgi";
var bugURL = "https://bugzilla.redhat.com/show_bug.cgi?id=";
var myStorage = jetpack.storage.simple;
-var badMIMEArray = [ "application/octet-stream", "text/x-log", "undefined" ];
// ==============================================================
// TODO https://wiki.mozilla.org/Labs/Jetpack/JEP/24
@@ -32,12 +31,8 @@ var manifest = {
} ]
};
jetpack.future.import("storage.settings");
-// if (!jetpack.storage.settings.BZpassword) {
-// jetpack.settings.open();
-// }
-var jsonDataURL = myStorage.JSONURL ? myStorage.JSONURL
- : "http://mcepl.fedorapeople.org/scripts/BugZappers_data.json";
+var jsonDataURL = jetpack.storage.settings.JSONURL;
var PCIIDsURL = "http://mcepl.fedorapeople.org/scripts/drm_pciids.json";
var abrtQueryURL = "https://bugzilla.redhat.com/buglist.cgi?"
+ "cmdtype=dorem&remaction=run&namedcmd=all%20NEW%20abrt%20crashes&sharer_id=74116";
@@ -75,28 +70,6 @@ var PCI_ID_Array = [];
var topRow = {};
var bottomRow = {};
-// ======== load external library ===============================
-
-// var XMLRPCMessage = {};
-// var req = new XMLHttpRequest();
-// req.open("GET","http://mcepl.fedorapeople.org/scripts/xmlrpc.js",true);
-// req.onreadystatechange = function (aEvt) {
-// if (req.readyState == 4) {
-// if (req.status == 200) {
-// var thisDoc = jetpack.tabs.focused.contentDocument;
-// var script = thisDoc.createElement("script");
-// script.setAttribute("type","text/javascript");
-// script.innerHTML = req.responseText;
-// thisDoc.getElementsByTagName("head")[0].appendChild(script);
-// XMLRPCMessage =
-// jetpack.tabs.focused.contentWindow.wrappedJSObject.XMLRPCMessage;
-// console.log("XMLHTTPRequest should be loaded.");
-// console.log(XMLRPCMessage);
-// }
-// }
-// };
-// console.log("Now we are calling XMLHTTPRequest to load xmlrpc.js");
-// req.send("");
/*
*
* xmlrpc.js beta version 1 Tool for creating XML-RPC formatted requests in
@@ -269,28 +242,72 @@ XMLRPCMessage.prototype.getParamXML = function(type, data) {
var hlpr = function () {
};
+/**
+ * Function for the management of the prototypal inheritace
+ * David Flanagan, Javascript: The Definitve Guide,
+ * IV. edition, O'Reilly, 2006, p. 168
+ *
+ * @param superobject
+ * @return new object, it needs new prototype.constructor
+ *
+ * <pre>
+ * function Father(x) {
+ * this.family = x;
+ * }
+ *
+ * function Son(x,w) {
+ * Father.call(this,x);
+ * this.wife = w;
+ * }
+ * Son.prototype = hlpr.heir(Father);
+ * Son.prototype.constructor = Son;
+ * </pre>
+ */
+hlpr.heir = function(p) {
+ function f() {};
+ f.prototype = p.prototype;
+ return new f();
+}
+
+/**
+ * Check whether an item is member of the list. Idea is just to make long if
+ * commands slightly more readable.
+ *
+ * @param mbr string to be searched in the list
+ * @param list list
+ * @return position of the string in the list, or -1 if none found.
+ */
+hlpr.isInList = function(mbr, list) {
+ return (list.indexOf(mbr) !== -1);
+};
+
+/**
+ * Make sure value returned is Array
+ *
+ * @param Array/String
+ * @return Array
+ *
+ * If something else than Array or String is passed to the function
+ * strange things may happen and the result will be untouched
+ * actual argument of the call.
+ */
hlpr.valToArray = function valToArray(val) {
- let arr = [];
- if (typeof val == "string") {
- arr = [val];
- } else if (val instanceof Array) {
- arr = val;
- }
- return arr;
+ return (val instanceof Array) ? val : [val.trim()];
};
/**
* Merges two comma separated string as a list and returns new string
*
* @param str String with one values
- * @param value String with other values
+ * @param value String/Array with other values
* @return String with merged lists
*/
hlpr.addCSVValue = function addCSVValue(str, value) {
- let parts = (str.trim().length > 0 ? str.split(",") : []);
- // FIXME isn't this wrong? In if conditions it treats value as a
- // string, but then uses hlpr.valToArray on it ???
- if (parts.indexOf(value) < 0) {
+ str = str.trim();
+ let parts = (str ? str.split(",") : []);
+ // FIXME this doesn't work when value is actually array
+ // Should it work? (neither original function worked)
+ if (this.isInList(value,parts)) {
parts.concat(hlpr.valToArray(value));
}
return parts.join(",");
@@ -304,38 +321,15 @@ hlpr.addCSVValue = function addCSVValue(str, value) {
* @return String with the resulting list comma separated
*/
hlpr.removeCSVValue = function removeCSVValue(str, value) {
- str = str.trim(); // we want it trimmed without any questions anyway
+ str = str.trim();
let parts = str ? str.split(",") : [];
- parts = parts.filter(function(e,i,a) {return (e != value)});
+ let valueArr = value instanceof Array ? value : value.split(",");
+ parts = parts.filter(function(e,i,a) {
+ return (hlpr.isInList(e,valueArr));
+ });
return parts.join(",");
};
-/**
- * Check whether an item is member of the list. Idea is just to make long if
- * commands slightly more readable.
- *
- * @param mbr string to be searched in the list
- * @param list list
- * @return position of the string in the list, or -1 if none found.
- */
-hlpr.isInList = function(mbr, list) {
- return (list.indexOf(mbr) !== -1);
-};
-
-hlpr.createBlankPage = function (ttl, bodyBuildCB) {
- var title = ttl || "Yet another untitled page";
- var that = this;
-
- var logTab = jetpack.tabs.open("about:blank");
- jetpack.tabs.onReady(function() {
- var otherDoc = logTab.contentDocument;
- otherDoc.title = title;
- otherDoc.body.innerHTML = "<h1>" + title + "</h1>";
- bodyBuildCB.call(that, otherDoc.body);
- logTab.focus();
- });
-};
-
//Get JSON configuration data
hlpr.loadText = function(URL, cb_function, what) {
if (what === undefined) { // missing optional argument
@@ -356,26 +350,6 @@ hlpr.loadText = function(URL, cb_function, what) {
req.send("");
};
-/**
- * Converts attributes value of the given list of elements to the Javascript
- * list.
- *
- * @param list
- * array of elements
- * @return array of values
- * @depreceated FIXME never used
- */
-hlpr.valuesToList = function(list) {
- var outL = [];
-
- list.forEach(function(e, i, a) {
- if (e.hasAttribute("value")) {
- outL.push(e.getAttribute("value").trim());
- }
- });
- return outL;
-};
-
// Initialization
hlpr.loadJSON = function(URL, cb_function, what) {
if (what === undefined) { // missing optional argument
@@ -389,6 +363,7 @@ hlpr.loadJSON = function(URL, cb_function, what) {
};
hlpr.loadJSON(jsonDataURL, function(response) {
+ console.log("jsonDataURL = " + jsonDataURL);
msgStrs = response.strings;
signatureFedoraString = response.signature;
suspiciousComponents = response.suspiciousComponents;
@@ -653,6 +628,16 @@ Color.prototype.lightColor = function() {
// BZPage's methods
function BZPage(doc) {
+ // constants
+ this.SalmonPink = new Color(255, 224, 176); // RGB 255, 224, 176; HSL 36, 2,
+ // 85
+ this.ReporterColor = new Color(255, 255, 166); // RGB 255, 255, 166; HSL 60, 2,
+ // 83
+ this.EmptyLogsColor = new Color(0, 255, 0);
+ this.FullLogsColor = new Color(0, 40, 103);
+
+ // initialize dynamic properties
+ this.doc = doc;
// this.initCommentsDropdown();
}
@@ -727,24 +712,42 @@ BZPage.prototype.onCommentsDropdownChange = function() {
});
// selectOption
- if ("status" in commentObj) this.selectOption("bug_status", commentObj.status);
+ if ("status" in commentObj)
+ this.selectOption("bug_status", commentObj.status);
console.log("1");
- if ("resolution" in commentObj) this.selectOption("resolution", commentObj.resolution);
+ if ("resolution" in commentObj)
+ this.selectOption("resolution", commentObj.resolution);
console.log("2");
- if ("addKeyword" in commentObj) keywordsInput.val(this.addKeyword(keywordsInput.val(), commentObj.addKeyword));
- if ("removeKeyword" in commentObj) keywordsInput.val(this.removeKeyword(keywordsInput.val(), commentObj.removeKeyword));
- if ("addWhiteboard" in commentObj) whiteboardsInput.val(this.addWhiteboard(whiteboardsInput.val(), commentObj.addWhiteboard));
- if ("removeWhiteboard" in commentObj) whiteboardsInput.val(this.removeWhiteboard(whiteboardsInput.val(), commentObj.removeWhiteboard));
- if ("product" in commentObj) this.selectOption("product", commentObj.product);
- if ("component" in commentObj) this.selectOption("component", commentObj.component);
- if ("version" in commentObj) this.selectOption("version", commentObj.version);
- if ("platform" in commentObj) this.selectOption("rep_platform", commentObj.platform);
- if ("os" in commentObj) this.selectOption("op_sys", commentObj.os);
-
- if ("priority" in commentObj) this.selectOption("priority", commentObj.priority);
- if ("severity" in commentObj) this.selectOption("bug_severity", commentObj.severity);
- if ("target" in commentObj) this.selectOption("target_milestone", commentObj.target);
+ if ("addKeyword" in commentObj)
+ keywordsInput.value = this.addKeyword(keywordsInput.value,
+ commentObj.addKeyword);
+ if ("removeKeyword" in commentObj)
+ keywordsInput.value = this.removeKeyword(keywordsInput.value,
+ commentObj.removeKeyword);
+ if ("addWhiteboard" in commentObj)
+ whiteboardsInput.value = this.addWhiteboard(whiteboardsInput.value,
+ commentObj.addWhiteboard);
+ if ("removeWhiteboard" in commentObj)
+ whiteboardsInput.value = this.removeWhiteboard(whiteboardsInput.value,
+ commentObj.removeWhiteboard);
+ if ("product" in commentObj)
+ this.selectOption("product", commentObj.product);
+ if ("component" in commentObj)
+ this.selectOption("component", commentObj.component);
+ if ("version" in commentObj)
+ this.selectOption("version", commentObj.version);
+ if ("platform" in commentObj)
+ this.selectOption("rep_platform", commentObj.platform);
+ if ("os" in commentObj)
+ this.selectOption("op_sys", commentObj.os);
+
+ if ("priority" in commentObj)
+ this.selectOption("priority", commentObj.priority);
+ if ("severity" in commentObj)
+ this.selectOption("bug_severity", commentObj.severity);
+ if ("target" in commentObj)
+ this.selectOption("target_milestone", commentObj.target);
if ("assignee" in commentObj) {
this.clickMouse("bz_assignee_edit_action");
@@ -784,15 +787,29 @@ BZPage.prototype.onCommentsDropdownChange = function() {
commentField.value += commentObj.comment;
}
-
// TODO cclist, flags, see also
if (("commit" in commentObj) && commentObj.commit) {
// Directly commit the form
- this.clickMouse("commit");
+ this.doc.forms.namedItem("changeform").submit();
}
};
+BZPage.prototype.createBlankPage = function (ttl, bodyBuildCB) {
+ var title = ttl || "Yet another untitled page";
+ var that = this;
+
+ var logTab = jetpack.tabs.open("about:blank");
+ jetpack.tabs.onReady(function() {
+ var otherDoc = logTab.contentDocument;
+ otherDoc.title = title;
+ otherDoc.body.innerHTML = "<h1>" + title + "</h1>";
+ bodyBuildCB.call(that, otherDoc.body);
+ logTab.focus();
+ });
+};
+
+
/**
* Select option with given label on the <SELECT> element with given id.
*
@@ -808,17 +825,11 @@ BZPage.prototype.onCommentsDropdownChange = function() {
select.val(value);
*/
BZPage.prototype.selectOption = function(id, label) {
- var sel = this.doc.getElementById(id);
- var options = Array.filter(sel.getElementsByTagName("option"), function(x) {
- return x.textContent.trim() == label;
- });
- theOption = options.length ? options[0] : [];
- if (theOption) {
- theOption.selected = true;
- var intEvent = this.doc.createEvent("HTMLEvents");
- intEvent.initEvent("change", true, true);
- theOption.dispatchEvent(intEvent);
- }
+ var sel = this.doc.getElementById(id);
+ sel.value = label;
+ var intEvent = this.doc.createEvent("HTMLEvents");
+ intEvent.initEvent("change", true, true);
+ sel.dispatchEvent(intEvent);
};
/**
@@ -1026,7 +1037,25 @@ BZPage.prototype.getLogin = function () {
var loginStr = loginArr[loginArr.length - 1].trim();
console.log("loginStr = " + loginStr);
return loginStr;
-}
+};
+
+/**
+ * collect the list of attachments in a structured format
+ *
+ * @return Array of arrays, one for each attachments;
+ * each record has string name of the attachment, integer its id number,
+ * string of MIME type, integer of size in kilobytes, and the whole
+ * element itself
+ */
+BZPage.prototype.getAttachments = function() {
+ let outAtts = [];
+ let atts = this.doc.getElementById("attachment_table")
+ .getElementsByTagName("tr");
+ for ( var i = 1, ii = atts.length - 1; i < ii; i++) {
+ outAtts.push(this.parseAttachmentLine(atts[i]));
+ }
+ return outAtts;
+};
/**
* returns password from the current storage, or if there isn't
@@ -1038,8 +1067,8 @@ BZPage.prototype.getLogin = function () {
* - more importantly, we should use jetpack.storage.settings
*/
BZPage.prototype.getPassword = function() {
- if (myStorage.BZpassword) {
- return myStorage.BZpassword;
+ if (jetpack.storage.settings.BZpassword) {
+ return jetpack.storage.settings.BZpassword;
} else {
var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Components.interfaces.nsIPromptService);
@@ -1055,28 +1084,178 @@ BZPage.prototype.getPassword = function() {
// password.value is
// set if OK was pressed. The checkbox is not displayed.
if (result) {
- this.password = password.value;
- myStorage.BZpassword = this.password;
+ let passwordText = password.value;
+ jetpack.storage.settings.BZpassword = passwordText;
jetpack.storage.simple.sync();
- return password.value;
+ return passwordText;
}
}
return null;
-}
+};
+
+/**
+ *
+ */
+BZPage.prototype.setUpLoggingButtons = function() {
+ // For adding additional buttons to the top toolbar
+ let additionalButtons = this.doc.getElementById("bugzilla-body")
+ .getElementsByClassName("related_actions")[0];
+ let that = this;
+
+ // logging all submits for timesheet
+ this.doc.forms.namedItem("changeform").addEventListener("submit",
+ function(evt) {
+ if (that.addLogRecord() === null) {
+ // FIXME doesn't work ... still submitting'
+ evt.stopPropagation();
+ evt.preventDefault();
+ }
+ }, false);
+
+ var generateTimeSheetUI = this.doc.createElement("li");
+ generateTimeSheetUI.innerHTML = "\u00A0-\u00A0<a href='#' id='generateTSButton'>"
+ + "Generate timesheet</a>";
+ additionalButtons.appendChild(generateTimeSheetUI);
+ this.doc.getElementById("generateTSButton").addEventListener(
+ "click",
+ function(evt) {
+ that.createBlankPage.call(that, "TimeSheet",
+ that.generateTimeSheet);
+ evt.stopPropagation();
+ evt.preventDefault();
+ }, false);
+
+ var clearLogsUI = this.doc.createElement("li");
+ clearLogsUI.innerHTML = "\u00A0-\u00A0<a href='#' id='clearLogs'>"
+ + "Clear logs</a>";
+ additionalButtons.appendChild(clearLogsUI);
+ var clearLogAElem = this.doc.getElementById("clearLogs");
+ clearLogAElem.addEventListener("click", function() {
+ myStorage.logs = {};
+ jetpack.storage.simple.sync();
+ this.style.color = that.EmptyLogsColor;
+ clearLogAElem.style.fontWeight = "normal";
+ console.log("mystorage.logs wiped out!");
+ }, false);
+
+ if (!myStorage.logs) {
+ console.log("No myStorage.logs defined!");
+ myStorage.logs = {};
+ }
+
+ if (myStorage.logs) {
+ clearLogAElem.style.color = this.FullLogsColor;
+ clearLogAElem.style.fontWeight = "bolder";
+ } else {
+ clearLogAElem.style.color = this.EmptyLogsColor;
+ clearLogAElem.style.fontWeight = "normal";
+ }
+};
+
+/**
+ *
+ */
+BZPage.prototype.markBadAttachments = function() {
+ let badMIMEArray = [ "application/octet-stream", "text/x-log", "undefined" ];
+
+ let badAttachments = this.attachments.filter(function(att, idx, arr) {
+ return (hlpr.isInList(att[2], badMIMEArray));
+ });
+
+ if (badAttachments.length > 0) {
+ var titleElement = this.doc
+ .getElementsByClassName("bz_alias_short_desc_container")[0];
+ titleElement.style.backgroundColor = "olive";
+ titleElement.appendChild(this.createFixAllButton(badAttachments));
+ badAttachments.forEach(function(x, i, a) {
+ this.addTextLink(x);
+ }, this);
+ }
+};
+
+/**
+ * a collect a list of emails on CC list
+ *
+ * @return Array with email addresses as Strings.
+ */
+BZPage.prototype.getCCList = function() {
+ let CCListSelect = this.doc.getElementById("cc");
+ outCCList = [];
+ if (CCListSelect) {
+ outCCList = Array.map(CCListSelect.options, function(item) {
+ return item.value;
+ });
+ }
+ return outCCList;
+};
+
+BZPage.prototype.pasteBacktraceInComments = function() {
+ // FIXME This paragraph looks suspicous ... what is it?
+ // Does it belong to this function?
+ var notedLabel = this.doc.querySelector("label[for='newcc']");
+ while (notedLabel.firstChild) {
+ var node = notedLabel.removeChild(notedLabel.firstChild);
+ notedLabel.parentNode.insertBefore(node, notedLabel);
+ }
+ notedLabel.parentNode.removeChild(notedLabel);
+
+ var mainTitle = this.doc
+ .getElementsByClassName("bz_alias_short_desc_container")[0];
+ var abrtButton = this.doc.createElement("a");
+ abrtButton.setAttribute("accesskey", "a");
+ abrtButton.setAttribute("href", abrtQueryURL);
+ abrtButton.textContent = "Abrt bugs";
+ mainTitle.appendChild(abrtButton);
+
+ if (this.idContainsWord("cf_devel_whiteboard", 'btparsed')) {
+ this.addTextToTextBox('status_whiteboard', 'btparsed');
+ }
+
+ if (!(this.isTriaged() || this.idContainsWord("status_whiteboard",
+ 'btparsed'))) {
+ var btAttachments = this.attachments
+ .filter(function(att, idx, arr) {
+ return (/backtrace/.test(att[0]));
+ });
+ // TODO we need to go through all backtrace attachments, but
+ // just the first one will do for now, we would need to do async
+ // parsing
+ btAttachments.forEach(function(x) {
+ attURL = "https://bugzilla.redhat.com/attachment.cgi?id="
+ + x[1];
+ console.log("attURL = " + attURL);
+ console.log("btSnippet = " + this.btSnippet);
+ if (!this.btSnippet) {
+ var btRaw = hlpr.loadText(attURL, function(ret) {
+ this.btSnippet = this.parseBacktrace(ret);
+ if (this.btSnippet) {
+ this.addTextToTextBox("comment", this.btSnippet);
+ this.addTextToTextBox("status_whiteboard",
+ "btparsed");
+ }
+ }, this);
+ }
+ }, this);
+ }
+};
// ====================================================================================
// MozillaBugzilla object
-MozillaBugzilla = function () {
-
+MozillaBugzilla = function (doc) {
+ BZPage.call(this, doc)
};
-MozillaBugzilla.prototype = new BZPage();
+
+MozillaBugzilla.prototype = hlpr.heir(BZPage);
MozillaBugzilla.prototype.constructor = MozillaBugzilla;
// ====================================================================================
// RHBugzillaPage object
RHBugzillaPage = function(doc) {
+ // inheritance ... call superobject's constructor
+ BZPage.call(this,doc);
+
// For identification of graphics card
const manuChipStrs = [ [ "ATI Radeon", "ATI", "1002" ],
[ "ATI Mobility Radeon", "ATI", "1002" ],
@@ -1091,17 +1270,11 @@ RHBugzillaPage = function(doc) {
// HSL
// 120, 0, 23
this.RHITColor = new Color(102, 0, 102); // RGB 102, 0, 102; HSL 300, 0, 20
- this.SalmonPink = new Color(255, 224, 176); // RGB 255, 224, 176; HSL 36, 2,
- // 85
- this.ReporterColor = new Color(255, 255, 166); // RGB 255, 255, 166; HSL 60, 2,
- // 83
- this.EmptyLogsColor = new Color(0, 255, 0);
- this.FullLogsColor = this.FedoraColor;
// END OF CONSTANTS
- this.doc = doc;
var that = this;
this.originalButton = this.doc.getElementById("commit");
+ this.reqCounter = 0;
this.login = this.getLogin();
this.password = this.getPassword();
@@ -1116,9 +1289,8 @@ RHBugzillaPage = function(doc) {
this.title = this.doc.getElementById("short_desc_nonedit_display").textContent;
var ITbutton = this.doc.getElementById("cf_issuetracker");
this.its = ITbutton ? ITbutton.value.trim() : "";
- this.CCList = Array.map(this.doc.getElementById("cc"), function(item) {
- return item.value;
- });
+ this.CCList = this.getCCList();
+
// TODO be careful about this, seems breaking for non-RH BugZappers,
// but I cannot see why
this.owner = this.doc.getElementById("bz_assignee_edit_container")
@@ -1126,82 +1298,19 @@ RHBugzillaPage = function(doc) {
this.defaultAssignee = this.filterByRegexp(defAssigneeList, this.component)
.toLowerCase();
this.maintCCAddr = this.filterByRegexp(AddrArray, this.component).toLowerCase();
-
+
+ // getBadAttachments
this.XorgLogAttList = [];
this.XorgLogAttListIndex = 0;
- this.attachments = [];
- this.reqCounter = 0;
- var atts = this.doc.getElementById("attachment_table")
- .getElementsByTagName("tr");
- for ( var i = 1, ii = atts.length - 1; i < ii; i++) {
- this.attachments.push(this.parseAttachmentLine(atts[i]));
- }
-
- var badAttachments = this.attachments.filter(function(att, idx, arr) {
- return (hlpr.isInList(att[2], badMIMEArray));
- });
-
- if (badAttachments.length > 0) {
- var titleElement = this.doc
- .getElementsByClassName("bz_alias_short_desc_container")[0];
- titleElement.style.backgroundColor = "olive";
- titleElement.appendChild(this.createFixAllButton(badAttachments));
- badAttachments.forEach(function(x, i, a) {
- this.addTextLink(x);
- }, this);
- }
+ this.attachments = this.getAttachments();
+ this.markBadAttachments();
// Dig out backtrace
this.btSnippet = "";
console.log("parseAbrtBacktraces = " + parseAbrtBacktraces);
if (parseAbrtBacktraces && AbrtRE.test(this.title)) {
-
- var notedLabel = this.doc.querySelector("label[for='newcc']");
- while (notedLabel.firstChild) {
- var node = notedLabel.removeChild(notedLabel.firstChild);
- notedLabel.parentNode.insertBefore(node, notedLabel);
- }
- notedLabel.parentNode.removeChild(notedLabel);
-
- var mainTitle = this.doc
- .getElementsByClassName("bz_alias_short_desc_container")[0];
- var abrtButton = this.doc.createElement("a");
- abrtButton.setAttribute("accesskey", "a");
- abrtButton.setAttribute("href", abrtQueryURL);
- abrtButton.textContent = "Abrt bugs";
- mainTitle.appendChild(abrtButton);
-
- if (this.idContainsWord("cf_devel_whiteboard", 'btparsed')) {
- this.addTextToTextBox('status_whiteboard', 'btparsed');
- }
-
- if (!(this.isTriaged() || this.idContainsWord("status_whiteboard",
- 'btparsed'))) {
- var btAttachments = this.attachments
- .filter(function(att, idx, arr) {
- return (/backtrace/.test(att[0]));
- });
- // TODO we need to go through all backtrace attachments, but
- // just the first one will do for now, we would need to do async
- // parsing
- btAttachments.forEach(function(x) {
- attURL = "https://bugzilla.redhat.com/attachment.cgi?id="
- + x[1];
- console.log("attURL = " + attURL);
- console.log("btSnippet = " + this.btSnippet);
- if (!this.btSnippet) {
- var btRaw = hlpr.loadText(attURL, function(ret) {
- this.btSnippet = this.parseBacktrace(ret);
- if (this.btSnippet) {
- this.addTextToTextBox("comment", this.btSnippet);
- this.addTextToTextBox("status_whiteboard",
- "btparsed");
- }
- }, this);
- }
- }, this);
- }
+ this.pasteBacktraceInComments();
}
// Take care of signature for Fedora bugzappers
@@ -1216,25 +1325,6 @@ RHBugzillaPage = function(doc) {
this.checkComments();
this.buildButtons(topRow, bottomRow);
- // UI for the customization JSON URL
- var additionalButtons = this.doc.getElementById("bugzilla-body")
- .getElementsByClassName("related_actions")[0];
- var customJSONURLUI = this.doc.createElement("li");
- customJSONURLUI.innerHTML = "\u00A0-\u00A0<a href='#' id='customJSONbutton'>"
- + "BugZap config</a>";
- additionalButtons.appendChild(customJSONURLUI);
- this.doc.getElementById("customJSONbutton").addEventListener(
- "click",
- function() {
- var newURL = jetpack.tabs.focused.contentWindow
- .prompt("URL for your JSON customization file");
- if (newURL) {
- myStorage.JSONURL = newURL;
- jetpack.storage.simple.sync();
- jetpack.tabs.focused.contentWindow.location.reload();
- }
- }, false);
-
// set default assignee on change of the component
this.doc.getElementById("component").addEventListener(
"change",
@@ -1250,61 +1340,13 @@ RHBugzillaPage = function(doc) {
function(evt) {
that.submitCallback.call(that, evt);
}, false);
-
- // logging all submits for timesheet
- console.log("logSubmits = " + logSubmits);
- if (logSubmits) {
- this.doc.forms.namedItem("changeform").addEventListener("submit",
- function(evt) {
- if (that.addLogRecord() === null) {
- // FIXME doesn't work ... still submitting'
- evt.stopPropagation();
- evt.preventDefault();
- }
- }, false);
-
- var generateTimeSheetUI = this.doc.createElement("li");
- generateTimeSheetUI.innerHTML = "\u00A0-\u00A0<a href='#' id='generateTSButton'>"
- + "Generate timesheet</a>";
- additionalButtons.appendChild(generateTimeSheetUI);
- this.doc.getElementById("generateTSButton").addEventListener(
- "click",
- function(evt) {
- hlpr.createBlankPage.call(that, "TimeSheet",
- that.generateTimeSheet);
- evt.stopPropagation();
- evt.preventDefault();
- }, false);
-
- var clearLogsUI = this.doc.createElement("li");
- clearLogsUI.innerHTML = "\u00A0-\u00A0<a href='#' id='clearLogs'>"
- + "Clear logs</a>";
- additionalButtons.appendChild(clearLogsUI);
- var clearLogAElem = this.doc.getElementById("clearLogs");
- clearLogAElem.addEventListener("click", function() {
- myStorage.logs = {};
- jetpack.storage.simple.sync();
- this.style.color = that.EmptyLogsColor;
- clearLogAElem.style.fontWeight = "normal";
- console.log("mystorage.logs wiped out!");
- }, false);
-
- if (!myStorage.logs) {
- console.log("No myStorage.logs defined!");
- myStorage.logs = {};
- }
-
- if (myStorage.logs) {
- clearLogAElem.style.color = this.FullLogsColor;
- clearLogAElem.style.fontWeight = "bolder";
- } else {
- clearLogAElem.style.color = this.EmptyLogsColor;
- clearLogAElem.style.fontWeight = "normal";
- }
- }
+
+ if (logSubmits) {
+ this.setUpLoggingButtons();
+ }
} // END OF RHBugzillaPage CONSTRUCTOR
-RHBugzillaPage.prototype = new BZPage();
+RHBugzillaPage.prototype = hlpr.heir(BZPage);
RHBugzillaPage.prototype.constructor = RHBugzillaPage;
/* Offline supporting functions */
@@ -1760,7 +1802,7 @@ RHBugzillaPage.prototype.fillInChipMagic = function () {
interestingArray = ChipsetRE.exec(interestingLineArr[0]);
interestingLine = interestingArray[2].
replace(/[\s"]+/g," ").trim();
- var whiteboardInput = that.dok.
+ var whiteboardInput = that.doc.
getElementById("status_whiteboard");
that.addNewButton(whiteboardInput,"chipmagic","Fill In",
"","CHIPMAGIC",
@@ -1866,7 +1908,7 @@ RHBugzillaPage.prototype.sendBugUpstream = function() {
jetpack.tabs.onReady(function() {
var otherDoc = ret.contentDocument;
var otherElems = otherDoc.forms.namedItem("Create").elements;
- otherElems.namedItem("short_desc").value = that.dok
+ otherElems.namedItem("short_desc").value = that.doc
.getElementById("short_desc_nonedit_display").textContent
.trim();
otherElems.namedItem("comment").value = that.collectComments();
@@ -1877,8 +1919,7 @@ RHBugzillaPage.prototype.sendBugUpstream = function() {
/**
* Parse the row with the attachment
*
- * @param
- * <tr> DOM element to be parsed
+ * @param DOM element to be parsed
* @return array with string name of the attachment, integer its id number,
* string of MIME type, integer of size in kilobytes, and the whole
* element itself
@@ -2398,13 +2439,6 @@ RHBugzillaPage.prototype.buildButtons = function(above, below) {
"SENDUPSTREAM", "", false);
}
- // var brElement2BMoved = this.doc.querySelector("#comment_status_commit
- // br:last-of-type");
- // var brWhereMove = this.doc.getElementsByClassName("status")[0];
- // brWhereMove.parentNode.insertBefore(brElement2BMoved.cloneNode(true),
- // brWhereMove);
- // brElement2BMoved.parentNode.removeChild(brElement2BMoved);
-
// TODO Get compiz bugs as well
if ((chipIDsGroupings.length > 0)
&& this.maintCCAddr === "xgl-maint@redhat.com") {