aboutsummaryrefslogtreecommitdiffstats
path: root/data/rhlib
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2011-07-19 14:30:39 +0200
committerMatěj Cepl <mcepl@redhat.com>2011-07-19 15:22:49 +0200
commitd75f36db36c442ae9621dc128fbd916c25d5735f (patch)
treec9ed3fcd6f86d28a9434b95e5060f3f64be17917 /data/rhlib
parente06a2341056cabd82fae8527d30a9ec97b24dc10 (diff)
parent4ef203c974e889b74e4064ee04eddc55ba7b8c08 (diff)
downloadbugzilla-triage-d75f36db36c442ae9621dc128fbd916c25d5735f.tar.gz
Merge branch 'bugzillatweaks' into next.
This is a horribly botched branch merged. Conflicts: chip-data/chipNames.json data/lib/bugzillaDOMFunctions.js data/lib/bzpage.js data/lib/jumpNextBug.js data/lib/otherButtons.js data/lib/queries.js data/lib/util.js data/rhlib/addAttachmentRow.js data/rhlib/fixingAttMIME.js data/rhlib/rhbzpage.js data/tweaks/bug-page-mod.js data/tweaks/viewSource.js lib/libbugzilla.js lib/main.js package.json
Diffstat (limited to 'data/rhlib')
-rw-r--r--data/rhlib/addAttachmentRow.js1
-rw-r--r--data/rhlib/fixingAttMIME.js6
-rw-r--r--data/rhlib/rhbzpage.js159
3 files changed, 64 insertions, 102 deletions
diff --git a/data/rhlib/addAttachmentRow.js b/data/rhlib/addAttachmentRow.js
index 63babcd..c8724e3 100644
--- a/data/rhlib/addAttachmentRow.js
+++ b/data/rhlib/addAttachmentRow.js
@@ -6,7 +6,6 @@
function addAttachmentCallback(resp) {
var newAttachID = parseInt(
resp.params.param.value.array.data.value.int, 10);
- console.log("attachID = " + newAttachID);
// FIXME callback.call(param, newAttachID, data.length);
}
diff --git a/data/rhlib/fixingAttMIME.js b/data/rhlib/fixingAttMIME.js
index 9834cfa..f61ddbd 100644
--- a/data/rhlib/fixingAttMIME.js
+++ b/data/rhlib/fixingAttMIME.js
@@ -78,11 +78,11 @@ function fixAttachById(id, XMLRPCURL, type, email) {
* <TR> DOM jQuery element with a bad attachment
* @return none
*/
-function addTextLink(row, xmlRpcUrl) {
- var elemS = row[4].getElementsByTagName("td");
+function addTextLink(att, xmlRpcUrl) {
+ var elemS = att.element.getElementsByTagName("td");
var elem = elemS[elemS.length - 1];
createDeadLink("addFix2TextLink", "text", elem, fixAttachById,
[
- row[1], xmlRpcUrl
+ att.id, xmlRpcUrl
], "br");
}
diff --git a/data/rhlib/rhbzpage.js b/data/rhlib/rhbzpage.js
index f74556c..cbd8665 100644
--- a/data/rhlib/rhbzpage.js
+++ b/data/rhlib/rhbzpage.js
@@ -55,7 +55,7 @@ var ProfessionalProducts = [
// END OF CONSTANTS
var btSnippet = null;
-
+var localThings = null; // I don't like it, but we need to store it somewhere for now
function RHOnMessageHandler(msg, nextHandlerList) {
switch (msg.cmd) {
@@ -143,7 +143,10 @@ function RHcentralCommandDispatch(cmdLabel, cmdParams) {
case "chipMagic":
fillInWhiteBoard(cmdParams);
break;
- // If we don't have it here, call superclass method
+ case "addExternalBugID":
+ addExternalBug();
+ break;
+ // If we don't have it here, call superclass method
default:
if (MozCentralCommandDispatch) {
MozCentralCommandDispatch(cmdLabel, cmdParams);
@@ -155,76 +158,35 @@ function RHcentralCommandDispatch(cmdLabel, cmdParams) {
}
}
-/**
- * Make it sailent that the some attachments with bad MIME type are present
- *
- * @param atts
- * Array of attachments subarrays
- * @return none
- */
-function markBadAttachments(atts) {
- var badMIMEArray = [ "application/octet-stream", "text/x-log", "undefined" ];
- if (!constantData.passwordState.passAvailable) {
- console.myDebug("markBadAttachments : No password, no XML-RPC calls; sorry");
- return null;
- }
-
- var badAttachments = atts.filter(function(att) {
- return (isInList(att[2], badMIMEArray));
- });
-
- if (badAttachments.length > 0) {
- var titleElement = document.
- getElementsByClassName("bz_alias_short_desc_container")[0];
- titleElement.style.backgroundColor = "olive";
-
- createDeadLink("fixAllButton", "Fix all", titleElement, function() {
- Array.forEach(badAttachments, function(x) {
- fixAttachById(x[1], constantData.XMLRPCData[window.location.hostname].url);
- });
- }, [], false, null, "f");
- badAttachments.forEach(function(x, i, a) {
- addTextLink(x, constantData.XMLRPCData[window.location.hostname].url);
- });
- }
-}
+/* === Bugzilla functions === */
/**
* Open a tab in the upstream bugzilla to create a new bug
*
* @return none
*/
-function sendBugUpstream() {
- var admitMsg = "(originally filed as " + window.location.href + ")\n\n";
- var urlStr = filterByRegexp(constantData.newUpstreamBug, getComponent());
- if (!urlStr) {
- return null;
+function sendBugUpstream(thgs) {
+ if (thgs) {
+ localThings = thgs;
+ return;
}
+ if (localThings) {
+ var admitMsg = "(originally filed as " + window.location.href + ")\n\n";
+ var urlStr = filterByRegexp(constantData.newUpstreamBug, getComponent());
+ if (!urlStr) {
+ return null;
+ }
- self.postMessage(new Message("OpenBugUpstream", {
- url: urlStr,
- subject: document.getElementById("short_desc_nonedit_display").
- textContent.trim(),
- comment: admitMsg + collectComments()
- }));
-}
-
-/**
- * Add a link opening selected lines of Xorg.0.log
- *
- * @return none
- */
-function addCheckXorgLogLink(attList) {
- if (config.XorgLogAnalysis) {
- attList.forEach(function (row) {
- var elemS = row[4].getElementsByTagName("td");
- var elem = elemS[elemS.length - 1];
- createDeadLink("xorgLogAnalyzeLink", "check", elem,
- analyzeXorgLog, [row[1], "AnalyzeXorgLogBacktrace"], "br");
- });
+ self.postMessage(new Message("OpenBugUpstream", {
+ url: urlStr,
+ subject: document.getElementById("short_desc_nonedit_display").
+ textContent.trim(),
+ comment: admitMsg + localThings.comments.getAllCommentsText()
+ }));
}
}
+
/**
* Given line to be parsed, find out which chipset it is and fill in the
* whiteboard
@@ -267,7 +229,6 @@ function fillInChipMagic(XlogID) {
function chipsetMagic (interestingLineArr) {
// parse Xorg.0.log
var cardStr = "";
- console.myDebug("interestingLineArr[1] = " + interestingLineArr[1]);
if (interestingLineArr.length >0) {
var interestingArray = interestingLineArr[0];
@@ -374,15 +335,13 @@ function findInterestingLine(wholeLog, backMsg) {
}
/**
- * Add information about the upstream bug upstream, and closing it.
+ * Add an external bug reference from the input box
*
- * @param evt
- * Event which called this handler
- * @return none
+ * @return String with the external bug URL or null
*/
-function addClosingUpstream() {
+function addExternalBug() {
var refs = document.getElementById("external_bugs_table")
- .getElementsByTagName("tr");
+ .getElementsByTagName("tr");
// that's a bad id, if there is a one. :)
var inputBox = document.getElementById("inputbox");
@@ -390,8 +349,8 @@ function addClosingUpstream() {
var wholeURL = "";
// Fix missing ID on the external_id SELECT
- document.getElementsByName("external_id")[0].setAttribute("id",
- "external_id");
+ document.getElementsByName("external_id")[0].
+ setAttribute("id", "external_id");
if (inputBox.value.match(/^http.*/)) {
wholeURL = inputBox.value;
@@ -405,29 +364,40 @@ function addClosingUpstream() {
var bugzillaName = getBugzillaName(parseURL(wholeURL).host,
constantData.bugzillaLabelNames);
selectOptionByLabel("external_id", bugzillaName);
+ return wholeURL;
}
else if (!isNaN(inputBox.value)) {
- externalBugID = parseInt(inputBox.value, 10);
- var bugzillaHostname = document.getElementById("external_id").value;
- wholeURL = bugzillaHostname+"show_bug.cgi?id="+externalBugID;
+ return document.getElementById("external_id").value +
+ "show_bug.cgi?id=" + parseInt(inputBox.value, 10);
}
else {
// no inputBox.value -- maybe there is an external bug from
// the previous commit?
+ return null;
}
+}
- // It is not good to close bug as UPSTREAM, if there is no reference
- // to the upstream bug.
- if ((externalBugID > 0) || (refs.length > 2)) {
- var msgStr = constantData.commentStrings.sentUpstreamString;
- msgStr = msgStr.replace("§§§", wholeURL);
- centralCommandDispatch("comment",msgStr);
- centralCommandDispatch("status", "CLOSED");
- centralCommandDispatch("resolution", "UPSTREAM");
- }
- else {
+/**
+ * Add information about the upstream bug upstream, and closing it.
+ *
+ * @param evt
+ * Event which called this handler
+ * @return none
+ */
+function addClosingUpstream() {
+
+ var newBugURL = addExternalBug();
+
+ if (!newBugURL) {
console.myDebug("No external bug specified among the External References!");
+ return null;
}
+
+ var msgStr = constantData.commentStrings.sentUpstreamString;
+ msgStr = msgStr.replace("§§§", newBugURL);
+ centralCommandDispatch("comment",msgStr);
+ centralCommandDispatch("status", "CLOSED");
+ centralCommandDispatch("resolution", "UPSTREAM");
}
/**
@@ -469,21 +439,21 @@ function parseBacktrace (ret) {
return "";
}
-function RHBZinit(attachments) {
+function RHBZinit(things) {
// inheritance ... call superobject's constructor
var AbrtRE = new RegExp("^\\s*\\[abrt\\]");
var btSnippet = "";
+ sendBugUpstream(things); // FIXME this is not a real call,
+ // just initializing static variable
var chipMagicInterestingLine = "";
// getBadAttachments
var XorgLogAttList = [];
var XorgLogAttListIndex = 0;
- markBadAttachments(attachments);
+ things.attachments.markBadAttachments();
- var parsedAttachments = attachments.filter(function (att) {
- return (new RegExp(titleParsedAttachment).test(att[0]));
- });
+ var parsedAttachments = things.attachments.getParsedAttachments();
if (constantData.defaultAssignee) {
setDefaultAssignee();
@@ -505,21 +475,14 @@ function RHBZinit(attachments) {
// Dig out backtrace protection against double-firing?
btSnippet = "";
- var parseAbrtBacktraces = config.parseAbrtBacktraces;
- if (parseAbrtBacktraces && AbrtRE.test(getSummary())) {
+ if (config.parseAbrtBacktraces && AbrtRE.test(getSummary())) {
pasteBacktraceInComments(parsedAttachments);
}
- // Find out Xorg.0.log attachment URL
- XorgLogAttList = attachments.filter(function (value) {
- // Xorg.0.log must be text, otherwise we cannot parse it
- return (/[xX].*log/.test(value[0]) && /text/.test(value[2]));
- });
-
// Just add a link to every Xorg.0.log link analyzing it.
- addCheckXorgLogLink(XorgLogAttList);
+ things.attachments.addCheckXorgLogLink();
- setBranding(XorgLogAttList);
+ setBranding(things);
// Don't allow to submit a page which would change the bug to 0xFFFF component
document.forms.namedItem("changeform").addEventListener(