aboutsummaryrefslogtreecommitdiffstats
path: root/data/rhbzpage.js
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2011-02-09 10:56:33 +0100
committerMatěj Cepl <mcepl@redhat.com>2011-02-09 10:56:33 +0100
commitba0b4d6110e5b50c15ce722a5a123bcf26bafe3e (patch)
treef3605fc899db3152068f9c4bfc6f840ea198b11d /data/rhbzpage.js
parentcc50408c9661d35a81f921ff6347eee3c1781d0f (diff)
downloadbugzilla-triage-ba0b4d6110e5b50c15ce722a5a123bcf26bafe3e.tar.gz
Mainly add XML-RPC handling
In details: * add libbugzilla.makeXMLRPCCall * rewrite addAttachment and fixAttachById to use it * add RHOnMessageHandler to process RHBZ-specific RPC messages * fix the mess around getting passwords and not-provided passwords (there should be no password in a content script) * add libbugzilla.openURLinPanel and make showAttachment to use it * fix indentation of switch statements * remove JSLint strings, we need to fix the script, no screw up my ones
Diffstat (limited to 'data/rhbzpage.js')
-rw-r--r--data/rhbzpage.js474
1 files changed, 233 insertions, 241 deletions
diff --git a/data/rhbzpage.js b/data/rhbzpage.js
index ee10466..484fbff 100644
--- a/data/rhbzpage.js
+++ b/data/rhbzpage.js
@@ -3,6 +3,65 @@
// http://www.opensource.org/licenses/mit-license.php
"use strict";
var titleParsedAttachment = "Part of the thread where crash happened";
+
+
+// For identification of graphics card
+var manuChipStrs = [ [ "ATI Radeon", "ATI", "1002" ],
+ [ "ATI Mobility Radeon", "ATI", "1002" ],
+ [ "Intel Corporation", "INTEL", "8086" ], [ "NVIDIA", "NV", "10de" ] ];
+
+// http://en.wikipedia.org/wiki/HSL_color_space
+// when only the value of S is changed
+// stupido!!! the string is value in hex for each color
+var RHColor = new Color(158, 41, 43); // RGB 158, 41, 43; HSL 359, 1, 39
+var FedoraColor = new Color(0, 40, 103); // RGB 0, 40, 103; HSL 359, 1, 39
+var RawhideColor = new Color(0, 119, 0); // or "green", or RGB 0, 119, 0, or
+ // HSL
+// 120, 0, 23
+var RHITColor = new Color(102, 0, 102); // RGB 102, 0, 102; HSL 300, 0, 20
+
+var RE = {
+ Comment: new RegExp("^\\s*#"), // unsused
+ BlankLine: new RegExp("^\\s*$"), // unused
+ // new line
+ // [ 65.631] (--) intel(0): Chipset: "845G"
+ Chipset: new RegExp("^\\s*\\[?[ 0-9.]*\\]?\\s*\\(--\\) "+
+ "([A-Za-z]+)\\([0-9]?\\): Chipset: (.*)$"),
+ ATIgetID: new RegExp("^.*\\(ChipID = 0x([0-9a-fA-F]+)\\).*$"),
+ Abrt: new RegExp("^\\s*\\[abrt\\]"),
+ soughtLines: new RegExp("^\\s*(\\[[0-9 .]*\\])?\\s*(\\((EE|WW)\\)|.* [cC]hipsets?: )|\\s*Backtrace")
+};
+
+var ProfessionalProducts = [
+ "Red Hat Enterprise Linux",
+ "Red Hat Enterprise MRG"
+];
+
+// END OF CONSTANTS
+
+var btSnippet = null;
+var reqCounter = 0; // TODO should be probably a dict indexed by called method
+
+function RHOnMessageHandler(msg) {
+ switch (msg.cmd) {
+ case "Error":
+ alert("Error " + msg.data);
+ break;
+ case "Unhandled":
+ break;
+ case "AddAttachmentCallback":
+ addAttachmentCallback(msg.data);
+ break;
+ case "FixAttachmentMIMECallback":
+ XMLRPCcallback();
+ break;
+ default:
+ console.error("Error: unknown RPC call " + msg.toSource());
+ }
+}
+
+
+
// ====================================================================================
// RHBugzillaPage object
@@ -13,7 +72,7 @@ var titleParsedAttachment = "Part of the thread where crash happened";
* we haven't set it up.
*/
nonTestedFunction getDefaultAssignee() {
- return util.filterByRegexp(this.constantData.defaultAssignee,
+ return filterByRegexp(this.constantData.defaultAssignee,
this.getComponent()).toLowerCase();
}
@@ -35,124 +94,109 @@ function removeDuplicates (arr) {
* @return none
* sets this.defaultAssignee property according to defaultAssignee list
*/
-nonTestedFunction setDefaultAssignee() {
- this.defaultAssignee = this.getDefaultAssignee();
- var defAss = this.defaultAssignee;
+function setDefaultAssignee() {
+ var defAss = getDefaultAssignee();
// Add setting default assignee
- if ((defAss.length > 0) && (defAss !== this.getOwner())) {
- this.constantData.defaultAssigneeTrigger = true;
- this.createNewButton("bz_assignee_edit_container",true,"rh-common","setDefaultAssignee");
+ if ((defAss.length > 0) && (defAss !== getOwner())) {
+ constantData.defaultAssigneeTrigger = true;
+ createNewButton("bz_assignee_edit_container",true,"rh-common","setDefaultAssignee");
}
}
/**
* Auxiliary function to compute more complicated resolution
*/
-nonTestedFunction closeSomeRelease() {
+function closeSomeRelease() {
// for RAWHIDE close as RAWHIDE,
// if active selection -> CURRENTRELEASE
// and put the release version to
// "Fixed in Version" textbox
// otherwise -> NEXTRELEASE
- this.selectOption("bug_status", "CLOSED");
- var text = "";
+ selectOption("bug_status", "CLOSED");
+ var text = getSelection();
var resolution = "";
- if (selection.text) {
- text = selection.text.trim();
- }
if (text.length > 0) {
resolution = "CURRENTRELEASE";
- this.doc.getElementById("cf_fixed_in").value = text;
- } else if (this.doc.getElementById("version").value === "rawhide") {
+ document.getElementById("cf_fixed_in").value = text;
+ } else if (document.getElementById("version").value === "rawhide") {
resolution = "RAWHIDE";
} else {
resolution = "NEXTRELEASE";
}
- this.centralCommandDispatch("resolution", resolution);
+ centralCommandDispatch("resolution", resolution);
}
/**
* Additional commands specific for this subclass, overriding superclass one.
*/
-nonTestedFunction RHcentralCommandDispatch(cmdLabel, cmdParams) {
+function RHcentralCommandDispatch(cmdLabel, cmdParams) {
console.log("cmdLabel = " + cmdLabel + ", cmdParams = " + cmdParams);
switch (cmdLabel) {
- // Set up our own commands
- case "closeUpstream":
- this.addClosingUpstream();
- break;
- case "computeResolution":
- this.closeSomeRelease();
- break;
- case "queryStringUpstreamBugzilla":
- this.queryUpstream();
- break;
- case "sendBugUpstream":
- this.sendBugUpstream();
- break;
- case "markTriaged":
- this.markBugTriaged();
- break;
- case "chipMagic":
- var splitArr = cmdParams.split("\t");
- this.fillInWhiteBoard(splitArr[0], splitArr[1]);
- break;
- // If we don't have it here, call superclass method
- default:
- centralCommandDispatch.call(this, cmdLabel, cmdParams);
- break;
+ // Set up our own commands
+ case "closeUpstream":
+ addClosingUpstream();
+ break;
+ case "computeResolution":
+ closeSomeRelease();
+ break;
+ case "queryStringUpstreamBugzilla":
+ queryUpstream();
+ break;
+ case "sendBugUpstream":
+ sendBugUpstream();
+ break;
+ case "markTriaged":
+ markBugTriaged();
+ break;
+ case "chipMagic":
+ var splitArr = cmdParams.split("\t");
+ fillInWhiteBoard(splitArr[0], splitArr[1]);
+ break;
+ // If we don't have it here, call superclass method
+ default:
+ console.error("Unknown command:\n" + cmdLabel + "\nparameters:\n" + cmdParams);
+ break;
}
}
+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);
+}
+
/**
*
* This has to stay in RHBugzillaPage because upstream doesn't have addAttachment
* XML-RPC call yet.
*/
-nonTestedFunction addAttachment(data, callback, param) {
- var msg = new xrpc.XMLRPCMessage("bugzilla.addAttachment");
- var that = this;
+function addAttachment(data, callback, param) {
+ var params = [];
- // Get bug no
- var bugNo = getBugNo(window.location.toString());
-
- // deal with aliases
- // FIXME there is no password in content scripts anymore!
- if (isNaN(parseInt(bugNo, 10)) && this.password) {
- getRealBugNo(function(bugN) {
- // Zbytek funkce addAttachment
- });
+ if (!constantData.passwordState.passAvailable) {
+ console.log("No password, no XML-RPC calls; sorry");
+ return null;
}
-
-
- msg.addParameter(this.bugNo);
- msg.addParameter({
+ params.push(getBugNo());
+ params.push({
description: titleParsedAttachment,
filename: "parsed-backtrace.txt",
contenttype: "text/plain",
- data: this.win.btoa(data),
+ data: window.btoa(data),
nomail: true
});
- msg.addParameter(this.login);
- msg.addParameter(this.password);
- Request({
- url: this.constantData.XMLRPCData[this.hostname].url,
- onComplete: function(response) {
- if (response.status == 200) {
- var resp = parseXMLfromString(response.text);
- var newAttachID = parseInt(resp.params.param.value.array.data.value.int, 10);
- console.log("attachID = " + newAttachID);
- callback.call(that, param, newAttachID, data.length);
- }
- },
- content: msg.xml(),
- contentType: "text/xml"
- }).post();
- this.reqCounter++;
+ postMessage(new Message("MakeXMLRPCall", {
+ url: constantData.XMLRPCData[window.location.hostname],
+ login: getLogin(),
+ method: "bugzilla.addAttachment",
+ params: params,
+ callRPC: "AddAttachmentCallback"
+ }));
+ reqCounter++;
}
/* === Bugzilla functions === */
@@ -160,13 +204,11 @@ nonTestedFunction addAttachment(data, callback, param) {
*
*/
nonTestedFunction pasteBacktraceInComments() {
- var that = this;
-
/*
Let's comment it out, and we'll see if anything breaks.
TODO This paragraph looks suspicous ... what is it?
Does it belong to this function?
- var notedLabel = this.doc.querySelector("label[for='newcc']");
+ var notedLabel = document.querySelector("label[for='newcc']");
while (notedLabel.firstChild) {
var node = notedLabel.removeChild(notedLabel.firstChild);
notedLabel.parentNode.insertBefore(node, notedLabel);
@@ -178,41 +220,37 @@ nonTestedFunction pasteBacktraceInComments() {
"cmdtype=dorem&remaction=run&namedcmd=all%20NEW%20abrt%20crashes&"+
"sharer_id=74116";
- var mainTitle = this.doc
+ var mainTitle = document
.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);
+ createDeadLink ("callAbrtQuery_link",
+ "Abrt bugs", mainTitle, abrtQueryURL, [], false, null, "a");
- if (this.idContainsWord("cf_devel_whiteboard", 'btparsed')) {
- this.addStuffToTextBox('status_whiteboard', 'btparsed');
+ if (idContainsWord("cf_devel_whiteboard", 'btparsed')) {
+ addStuffToTextBox('status_whiteboard', 'btparsed');
}
- if (!(this.isTriaged() || this.idContainsWord("status_whiteboard",
- 'btparsed') || (this.parsedAttachments.length > 0))) {
- var btAttachments = this.attachments
+ if (!(isTriaged() || idContainsWord("status_whiteboard",
+ 'btparsed') || (parsedAttachments.length > 0))) {
+ var btAttachments = attachments
.filter(function(att, idx, arr) {
return (/File: 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) {
var attURL = "https://bugzilla.redhat.com/attachment.cgi?id="
+ x[1];
- if ((!this.btSnippet) &&
- (!this.idContainsWord("status_whiteboard", 'btparsed'))) {
- var that = this;
+ if ((!btSnippet) && // ???? FIXME
+ (!idContainsWord("status_whiteboard", 'btparsed'))) {
Request({
url: attURL,
onComplete: function(response) {
if (response.status == 200) {
- that.btSnippet = that.parseBacktrace(response.text);
- if (that.btSnippet) {
- that.addCheckShowLink.call(that,x,that.btSnippet);
+ btSnippet = parseBacktrace(response.text);
+ if (btSnippet) {
+ addCheckShowLink(x,btSnippet);
}
}
}
@@ -234,22 +272,9 @@ nonTestedFunction pasteBacktraceInComments() {
* @param id Number of the attachment id
* @return none
*/
-nonTestedFunction showAttachment(id) {
- var that = this;
- Request({
- url: "https://" + that.hostname + "/attachment.cgi?id=" + id,
- onComplete: function (response) {
- if (response.status == 200) {
- var infoWin = that.win.open("", "Check att. " + id,
- "width=640,height=640,status=no,location=no,"+
- "titlebar=no,scrollbars=yes,resizable=yes"+
- "alwaysRaised=yes");
- var doc = infoWin.document;
- doc.body.innerHTML = "<pre id='textPre'>"+
- response.text + "</pre>";
- }
- }
- }).get();
+function showAttachment(id) {
+ postMessage(new Message("OpenURLinPanel",
+ "https://" + window.location.hostname + "/attachment.cgi?id=" + id));
}
/**
@@ -257,10 +282,10 @@ nonTestedFunction showAttachment(id) {
*
* @param att Attachment object
*/
-nonTestedFunction addShowParsedBTLink(att) {
+function addShowParsedBTLink(att) {
var elem = att[4].querySelector("td:last-of-type");
- this.createDeadLink("showParsedBacktraceWindow-" + att[1], "showBT",
- elem, this.showAttachment, att[1], true);
+ createDeadLink("showParsedBacktraceWindow-" + att[1], "showBT",
+ elem, showAttachment, att[1], true);
}
/**
@@ -269,7 +294,7 @@ nonTestedFunction addShowParsedBTLink(att) {
nonTestedFunction addNewAttachmentRow(origAtt,
newAttId, newAttSize) {
var that = this;
- var oldAddBTLink = this.doc.getElementById("attachBacktraceActivator");
+ var oldAddBTLink = document.getElementById("attachBacktraceActivator");
oldAddBTLink.parentNode.removeChild(oldAddBTLink);
var newTRElem = origAtt[4].cloneNode(true);
@@ -315,13 +340,12 @@ nonTestedFunction addNewAttachmentRow(origAtt,
* @param snippet String with parsed backtrace
* @return none
*/
-nonTestedFunction addCheckShowLink(oldAtt, snippet) {
- var that = this;
+function addCheckShowLink(oldAtt, snippet) {
var elem = oldAtt[4].querySelector("td:last-of-type");
- this.createDeadLink("attachBacktraceActivator", "add parsed BT", elem, function(x) {
+ createDeadLink("attachBacktraceActivator", "add parsed BT", elem, function(x) {
// pass function and parameters as two separate parameters, the function to be called from
// addAttachment
- that.addAttachment.call(that, snippet, this.addNewAttachmentRow, oldAtt);
+ addAttachment(snippet, addNewAttachmentRow, oldAtt);
}, [], true);
}
@@ -334,18 +358,17 @@ nonTestedFunction addCheckShowLink(oldAtt, snippet) {
nonTestedFunction markBadAttachments(atts) {
var that = this;
var badMIMEArray = [ "application/octet-stream", "text/x-log", "undefined" ];
- // FIXME there is no password anymore, we have to fix it somehow else
- if (!this.password) {
- return ; // User didn't provide password, so whole MIME fixing business
- // should be switched off.
+ if (!constantData.passwordState.passAvailable) {
+ console.log("No password, no XML-RPC calls; sorry");
+ return null;
}
var badAttachments = atts.filter(function(att, idx, arr) {
- return (util.isInList(att[2], badMIMEArray));
+ return (isInList(att[2], badMIMEArray));
});
if (badAttachments.length > 0) {
- var titleElement = this.doc
+ var titleElement = document
.getElementsByClassName("bz_alias_short_desc_container")[0];
titleElement.style.backgroundColor = "olive";
@@ -365,10 +388,9 @@ nonTestedFunction markBadAttachments(atts) {
*
* @return Boolean true if it is a RHEL bug
*/
-nonTestedFunction isEnterprise() {
- var prod = this.product;
- var result = this.constantData.ProfessionalProducts.some(function(elem,idx,arr) {
- return new RegExp(elem).test(prod);
+function isEnterprise() {
+ var result = ProfessionalProducts.some(function(elem,idx,arr) {
+ return new RegExp(elem).test(getProduct());
});
return result;
}
@@ -378,8 +400,8 @@ nonTestedFunction isEnterprise() {
*
* @return Boolean whether the bug has been triaged or not
*/
-nonTestedFunction isTriaged() {
- return this.hasKeyword("Triaged");
+function isTriaged() {
+ return hasKeyword("Triaged");
}
/**
@@ -390,70 +412,76 @@ nonTestedFunction isTriaged() {
* @param its String with the IsueTracker numbers
* @return none
*/
-nonTestedFunction setBranding() {
+function setBranding() {
var brandColor = {};
var TriagedColor = {};
- if (this.isEnterprise()) {
- if (this.its && (this.its.length > 0)) {
- brandColor = this.RHITColor;
+ var ITbutton = document.getElementById("cf_issuetracker");
+ var its = ITbutton ? ITbutton.value.trim() : "";
+
+ if (isEnterprise()) {
+ if (its && (its.length > 0)) {
+ brandColor = RHITColor;
} else {
- brandColor = this.RHColor;
+ brandColor = RHColor;
}
- } else if (new RegExp("Fedora").test(this.product)) {
- if (this.doc.getElementById("version").value === "rawhide") {
- brandColor = this.RawhideColor;
+ } else if (new RegExp("Fedora").test(document.getElementById("product").value)) {
+ if (document.getElementById("version").value === "rawhide") {
+ brandColor = RawhideColor;
} else {
- brandColor = this.FedoraColor;
+ brandColor = FedoraColor;
}
}
// Comment each of the following lines to get only partial branding
- this.doc.getElementsByTagName("body")[0].style.background = brandColor
+ document.getElementsByTagName("body")[0].style.background = brandColor
.toString()
+ " none";
- this.doc.getElementById("titles").style.background = brandColor.toString()
+ document.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.doc.getElementsByTagName("title")[0];
+ var titleElem = document.getElementsByTagName("title")[0];
titleElem.textContent = titleElem.textContent.slice(4);
- var bodyTitleParent = this.doc.getElementById("summary_alias_container").parentNode;
+ var bodyTitleParent = document.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")) {
- this.doc.getElementById("bugzilla-body").style.background = this.SalmonPink
+ if (hasKeyword("Security")) {
+ document.getElementById("bugzilla-body").style.background = SalmonPink
.toString() + ' none';
}
// Make it visible whether the bug has been triaged
- if (this.isTriaged()) {
- this.doc.getElementById("bz_field_status").style.background = brandColor
+ if (isTriaged()) {
+ document.getElementById("bz_field_status").style.background = brandColor
.lightColor().toString()
+ " none";
}
+/* TODO this is complicated, because we would need RPC call back and forth.
// we should make visible whether maintCCAddr is in CCList
- if (util.isInList(this.maintCCAddr, getCCList())) {
- var ccEditBoxElem = this.doc.getElementById("cc_edit_area_showhide");
+ if (isInList(this.maintCCAddr, getCCList())) { // FIXME this.maintCCAddr ???
+ var ccEditBoxElem = document.getElementById("cc_edit_area_showhide");
ccEditBoxElem.style.color = "navy";
ccEditBoxElem.style.fontWeight = "bolder";
ccEditBoxElem.style.textDecoration = "underline";
}
+*/
- // mark suspicious components
+/* // mark suspicious components FIXME
var compElems;
- if (this.suspiciousComponents
- && util.isInList(this.getComponent(), this.suspiciousComponents)
- && (compElems = this.doc
+ if (suspiciousComponents
+ && isInList(getComponent(), suspiciousComponents)
+ && (compElems = document
.getElementById("bz_component_edit_container"))) {
compElems.style.background = "red none";
}
+*/
}
/**
@@ -465,7 +493,7 @@ nonTestedFunction queryUpstream() {
var text = this.getSelectionOrClipboard();
if (text) {
var queryUpstreamBugsURLArray = this.constantData.queryUpstreamBug;
- var searchData = util.filterByRegexp(queryUpstreamBugsURLArray, this.getComponent());
+ var searchData = filterByRegexp(queryUpstreamBugsURLArray, this.getComponent());
var urlBase = searchData.url;
text = searchData.searchBy+":"+searchData.fillIn+" "+text.trim();
if (searchData.fillIn == "$$$") {
@@ -489,7 +517,7 @@ nonTestedFunction queryUpstream() {
*/
nonTestedFunction sendBugUpstream() {
var that = this;
- var urlStr = util.filterByRegexp(JSON.parse(self.data.load("newUpstreamBug.json")), this
+ var urlStr = filterByRegexp(JSON.parse(self.data.load("newUpstreamBug.json")), this
.getComponent());
tabs.open({
@@ -513,7 +541,6 @@ nonTestedFunction sendBugUpstream() {
* @return none
*/
nonTestedFunction addCheckXorgLogLink() {
- var that = this;
if (this.xorglogAnalysis) {
this.XorgLogAttList.forEach(function (row) {
var elemS = row[4].getElementsByTagName("td");
@@ -536,7 +563,7 @@ nonTestedFunction fillInWhiteBoard(iLine, driverStr) {
var that = this;
function groupIDs(manStr, cardStrID) {
- var outStr = util.filterByRegexp(that.constantData.chipIDsGroupings,
+ var outStr = filterByRegexp(that.constantData.chipIDsGroupings,
manStr + "," + cardStrID);
if (outStr.length === 0) {
outStr = "UNGROUPED_" + manStr + "/" + cardStrID;
@@ -602,7 +629,7 @@ nonTestedFunction fillInWhiteBoard(iLine, driverStr) {
}
}
this.addStuffToTextBox("status_whiteboard", ("card_" + outStr).trim());
- this.doc.getElementById("chipMagic_btn").style.display = "none";
+ document.getElementById("chipMagic_btn").style.display = "none";
}
/**
@@ -675,7 +702,7 @@ nonTestedFunction analyzeXorgLog(attachID) {
return (that.RE.soughtLines.test(line));
});
results.sort();
- results = util.removeDuplicates(results);
+ results = removeDuplicates(results);
// Remove headers
if (results.length >= 1) {
results.splice(0, 1);
@@ -722,12 +749,11 @@ nonTestedFunction getBugzillaName(URLhostname) {
* + responseHeaders
* + responseText
*/
-nonTestedFunction XMLRPCcallback() {
- var that = this;
- this.reqCounter--;
- if (this.reqCounter <= 0) {
- timer.setTimeout(function () {
- that.win.location.reload(true);
+function XMLRPCcallback() {
+ reqCounter--;
+ if (reqCounter <= 0) {
+ setTimeout(function () {
+ window.location.reload(true);
}, 1000);
}
}
@@ -755,7 +781,9 @@ nonTestedFunction XMLRPCcallback() {
* this change };
*
*/
-nonTestedFunction fixAttachById(id, type, email) {
+function fixAttachById(id, type, email) {
+ var params = [];
+
if (type === undefined) {
type = "text/plain";
}
@@ -763,30 +791,23 @@ nonTestedFunction fixAttachById(id, type, email) {
email = false;
}
- var that = this;
- var msg = new xrpc.XMLRPCMessage("bugzilla.updateAttachMimeType");
- msg.addParameter( {
+ // https://bugzilla.redhat.com/\
+ // docs/en/html/api/extensions/compat_xmlrpc/code/webservice.html
+ // test on https://bugzilla.redhat.com/show_bug.cgi?id=485145
+ params.push({
'attach_id' : id,
'mime_type' : type,
'nomail' : !email
});
- msg.addParameter(this.login);
- msg.addParameter(this.password);
- // https://bugzilla.redhat.com/\
- // docs/en/html/api/extensions/compat_xmlrpc/code/webservice.html
- // test on https://bugzilla.redhat.com/show_bug.cgi?id=485145
- Request({
- url: this.constantData.XMLRPCData[this.hostname].url,
- onComplete: function(response) {
- if (response.status == 200) {
- that.XMLRPCcallback.call(that);
- }
- },
- content: msg.xml(),
- contentType: "text/xml"
- }).post();
- this.reqCounter++;
+ postMessage(new Message("MakeXMLRPCall", {
+ url: constantData.XMLRPCData[window.location.hostname],
+ login: getLogin(),
+ method: "bugzilla.updateAttachMimeType",
+ params: params,
+ callRPC: "FixAttachmentMIMECallback"
+ }));
+ reqCounter++;
}
/**
@@ -796,11 +817,11 @@ nonTestedFunction fixAttachById(id, type, email) {
* <TR> DOM jQuery element with a bad attachment
* @return none
*/
-nonTestedFunction addTextLink(row) {
+function addTextLink(row) {
var elemS = row[4].getElementsByTagName("td");
var elem = elemS[elemS.length - 1];
- this.createDeadLink("addFix2TextLink", "text", elem,
- this.fixAttachById, row[1], "br");
+ createDeadLink("addFix2TextLink", "text", elem,
+ fixAttachById, row[1], "br");
}
/**
@@ -810,21 +831,21 @@ nonTestedFunction addTextLink(row) {
* @return none
*/
nonTestedFunction addClosingUpstream() {
- var refs = this.doc.getElementById("external_bugs_table")
+ var refs = document.getElementById("external_bugs_table")
.getElementsByTagName("tr");
// that's a bad id, if there is a one. :)
- var inputBox = this.doc.getElementById("inputbox");
+ var inputBox = document.getElementById("inputbox");
var externalBugID = 0;
var wholeURL = "";
// Fix missing ID on the external_id SELECT
- this.doc.getElementsByName("external_id")[0].setAttribute("id",
+ document.getElementsByName("external_id")[0].setAttribute("id",
"external_id");
if (inputBox.value.match(/^http.*/)) {
wholeURL= new url.URL(inputBox.value);
- externalBugID = util.getBugNo(wholeURL);
+ externalBugID = getBugNoFromURL(wholeURL);
if (externalBugID) {
inputBox.value = externalBugID;
}
@@ -833,7 +854,7 @@ nonTestedFunction addClosingUpstream() {
this.selectOptionByLabel("external_id", bugzillaName);
} else if (!isNaN(inputBox.value)) {
externalBugID = parseInt(inputBox.value, 10);
- var bugzillaHostname = this.doc.getElementById("external_id").value;
+ var bugzillaHostname = document.getElementById("external_id").value;
wholeURL = bugzillaHostname+"show_bug.cgi?id="+externalBugID;
} else {
// no inputBox.value -- maybe there is an external bug from
@@ -845,9 +866,9 @@ nonTestedFunction addClosingUpstream() {
if ((externalBugID > 0) || (refs.length > 2)) {
var msgStr = this.commentStrings.sentUpstreamString;
msgStr = msgStr.replace("§§§", wholeURL);
- this.centralCommandDispatch("comment",msgStr);
- this.centralCommandDispatch("status", "CLOSED");
- this.centralCommandDispatch("resolution", "UPSTREAM");
+ centralCommandDispatch("comment",msgStr);
+ centralCommandDispatch("status", "CLOSED");
+ centralCommandDispatch("resolution", "UPSTREAM");
} else {
console.log("No external bug specified among the External References!");
}
@@ -866,7 +887,7 @@ nonTestedFunction markBugTriaged() {
// /fedora-meeting.2009-11-24-15.11.log.html
// for F13 and later, ASSIGNED is "add Triaged keyword" (as well)
// for <F13 it is "add both" (ASSIGNED status and Triaged keyword)
- var ver = this.doc.getElementById("version").value;
+ var ver = document.getElementById("version").value;
if ((!this.isEnterprise()) && (ver <= 12)) {
this.selectOption("bug_status", "ASSIGNED");
}
@@ -877,26 +898,30 @@ nonTestedFunction markBugTriaged() {
*
*/
nonTestedFunction parseBacktrace (ret) {
+ var signalHandler = new RegExp("^\\s*#[0-9]*\\s*<signal handler called>");
+ var frameNo = new RegExp("^\\s*#([0-9]*)\\s");
+
var splitArray = ret.split("\n");
var i = 0, ii = splitArray.length;
var outStr = "", curLine = "", numStr = "";
var lineCounter = 0, endLineNo = 0;
+ // TODO shouldn't we just cut off and analyze whole thread?
while (i < ii) {
- if (this.RE.signalHandler.test(splitArray[i])) {
+ if (signalHandler.test(splitArray[i])) {
break;
}
i++;
}
if (i < ii) {
- lineCounter = parseInt(this.RE.frameNo.exec(splitArray[i])[1], 10);
+ lineCounter = parseInt(frameNo.exec(splitArray[i])[1], 10);
endLineNo = lineCounter + NumberOfFrames;
curLine = splitArray[i];
while ((lineCounter < endLineNo) && (curLine.trim().length > 0)
&& (i < ii)) {
outStr += curLine + '\n';
- numStr = this.RE.frameNo.exec(curLine);
+ numStr = frameNo.exec(curLine);
if (numStr) {
lineCounter = parseInt(numStr[1], 10);
}
@@ -912,51 +937,18 @@ nonTestedFunction RHBugzillaPage(win, config) {
// inheritance ... call superobject's constructor
BZPage.call(this, win, config);
- // For identification of graphics card
- this.manuChipStrs = [ [ "ATI Radeon", "ATI", "1002" ],
- [ "ATI Mobility Radeon", "ATI", "1002" ],
- [ "Intel Corporation", "INTEL", "8086" ], [ "NVIDIA", "NV", "10de" ] ];
-
- // http://en.wikipedia.org/wiki/HSL_color_space
- // when only the value of S is changed
- // stupido!!! the string is value in hex for each color
- this.RHColor = new Color(158, 41, 43); // RGB 158, 41, 43; HSL 359, 1, 39
- this.FedoraColor = new Color(0, 40, 103); // RGB 0, 40, 103; HSL 359, 1, 39
- this.RawhideColor = new Color(0, 119, 0); // or "green", or RGB 0, 119, 0, or
- // HSL
- // 120, 0, 23
- this.RHITColor = new Color(102, 0, 102); // RGB 102, 0, 102; HSL 300, 0, 20
-
- this.RE = {
- Comment: new RegExp("^\\s*#"), // unsused
- BlankLine: new RegExp("^\\s*$"), // unused
- // new line
- // [ 65.631] (--) intel(0): Chipset: "845G"
- Chipset: new RegExp("^\\s*\\[?[ 0-9.]*\\]?\\s*\\(--\\) "+
- "([A-Za-z]+)\\([0-9]?\\): Chipset: (.*)$"),
- ATIgetID: new RegExp("^.*\\(ChipID = 0x([0-9a-fA-F]+)\\).*$"),
- Abrt: new RegExp("^\\s*\\[abrt\\]"),
- signalHandler: new RegExp("^\\s*#[0-9]*\\s*<signal handler called>"),
- frameNo: new RegExp("^\\s*#([0-9]*)\\s"),
- soughtLines: new RegExp("^\\s*(\\[[0-9 .]*\\])?\\s*(\\((EE|WW)\\)|.* [cC]hipsets?: )|\\s*Backtrace")
- };
- // END OF CONSTANTS
-
var that = this;
this.reqCounter = 0;
this.signaturesCounter = 0;
this.chipMagicInterestingLine = "";
- this.product = this.doc.getElementById("product").value;
-
+/* FIXME this would require RPC call
this.maintCCAddr = null;
if (this.constantData.CCmaintainer) {
- this.maintCCAddr = util.filterByRegexp(this.constantData.CCmaintainer,
+ this.maintCCAddr = filterByRegexp(this.constantData.CCmaintainer,
this.getComponent());
}
-
- var ITbutton = this.doc.getElementById("cf_issuetracker");
- this.its = ITbutton ? ITbutton.value.trim() : "";
+*/
if (!this.constantData.ProfessionalProducts) {
this.constantData.ProfessionalProducts =
@@ -997,7 +989,7 @@ nonTestedFunction RHBugzillaPage(win, config) {
(this.XorgLogAttList[0]) &&
(this.maintCCAddr === "xgl-maint@redhat.com")) {
// Add find chip magic button
- var whiteboard_string = this.doc.getElementById("status_whiteboard").value;
+ var whiteboard_string = document.getElementById("status_whiteboard").value;
if (!/card_/.test(whiteboard_string)) {
this.fillInChipMagic();
}
@@ -1006,7 +998,7 @@ nonTestedFunction RHBugzillaPage(win, config) {
// Take care of signature for Fedora bugzappers
if (config.gJSONData.configData.signature.length > 0) {
var signatureFedoraString = config.gJSONData.configData.signature;
- this.doc.forms.namedItem("changeform").addEventListener("submit",
+ document.forms.namedItem("changeform").addEventListener("submit",
function(aEvt) {
if (that.signaturesCounter < 1) {
that.addStuffToTextBox("comment", signatureFedoraString);
@@ -1018,9 +1010,9 @@ nonTestedFunction RHBugzillaPage(win, config) {
this.setBranding();
// set default assignee on change of the component
- var compElement = this.doc.getElementById("component");
+ var compElement = document.getElementById("component");
if (compElement && (compElement.options)) {
- this.doc.getElementById("component").addEventListener("change",
+ document.getElementById("component").addEventListener("change",
function() {
that.changeAssignee("default");
}, false);