diff options
Diffstat (limited to 'bugzillaBugTriage.js')
-rw-r--r-- | bugzillaBugTriage.js | 98 |
1 files changed, 58 insertions, 40 deletions
diff --git a/bugzillaBugTriage.js b/bugzillaBugTriage.js index dc20779..9745bdf 100644 --- a/bugzillaBugTriage.js +++ b/bugzillaBugTriage.js @@ -1,4 +1,4 @@ -f/*jslint onevar: false, browser: true, evil: true, laxbreak: true, undef: true, nomen: true, eqeqeq: true, bitwise: true, maxerr: 1000, immed: false, white: false, plusplus: false, regexp: false, undef: false */ +/*jslint onevar: false, browser: true, evil: true, laxbreak: true, undef: true, nomen: true, eqeqeq: true, bitwise: true, maxerr: 1000, immed: false, white: false, plusplus: false, regexp: false, undef: false */ /*global jetpack */ // Released under the MIT/X11 license // http://www.opensource.org/licenses/mit-license.php @@ -23,6 +23,7 @@ var Desaturated = 0.4; var TriagedDistro = 13; var NumberOfFrames = 7; var XMLRPCurl = "https://bugzilla.redhat.com/xmlrpc.cgi"; +var bugURL = "https://bugzilla.redhat.com/show_bug.cgi?id="; var myConfig = jetpack.storage.simple; var badMIMEArray = ["application/octet-stream","text/x-log","undefined"]; @@ -75,7 +76,7 @@ var backTranslateManufacturerPCIID = [{ addr: "10de" }]; // Initialize data from remote URL -var XMLHTTPRequestDone = false; +var XMLHttpRequestDone = false; var hashBugzillaName = []; var hashBugzillaWholeURL = []; var defAssigneeList = []; @@ -91,37 +92,12 @@ var topRow = {}; var bottomRow = {}; // Get JSON configuration data -loadJSON(jsonDataURL, function (response) { - msgStrs = response.strings; - signatureFedoraString = response.signature; - suspiciousComponents = response.suspiciousComponents; - hashBugzillaName = response.bugzillalabelNames; - hashBugzillaWholeURL = response.bugzillaIDURLs; - // [{'regexp to match component':'email address of an universal maintainer'}, ...] - AddrArray = response.CCmaintainer; - defAssigneeList = response.defaultAssignee; - queryButtonAvailable = response.queryButton; - upstreamButtonAvailable = response.upstreamButton; - upstreamBugzillasArray = response.upstreamBugzillas; - chipIDsGroupings = response.chipIDsGroupings; - topRow = response.topRow; - bottomRow = response.bottomRow; -}); - -// Get card translation table -loadJSON(PCIIDsURL, - function (response) { - PCI_ID_Array = response; -}); - -//============================================================== - loadText = function(URL, cb_function,what) { if (what === undefined) { // missing optional argument what = this; } - var req = new XMLHTTPRequest(); + var req = new XMLHttpRequest(); req.open("GET",URL,true); req.onreadystatechange = function (aEvt) { if (req.readyState == 4) { @@ -135,7 +111,7 @@ loadText = function(URL, cb_function,what) { req.send(""); }; -loadJSON = function(URL, cb_function) { +loadJSON = function(URL, cb_function, what) { if (what === undefined) { // missing optional argument what = this; } @@ -143,9 +119,35 @@ loadJSON = function(URL, cb_function) { loadText(URL,function (text) { var data = JSON.parse(text); cb_function.call(what,data); - }); + }, what); }; + +loadJSON(jsonDataURL, function (response) { + msgStrs = response.strings; + signatureFedoraString = response.signature; + suspiciousComponents = response.suspiciousComponents; + hashBugzillaName = response.bugzillalabelNames; + hashBugzillaWholeURL = response.bugzillaIDURLs; + // [{'regexp to match component':'email address of an universal maintainer'}, ...] + AddrArray = response.CCmaintainer; + defAssigneeList = response.defaultAssignee; + queryButtonAvailable = response.queryButton; + upstreamButtonAvailable = response.upstreamButton; + upstreamBugzillasArray = response.upstreamBugzillas; + chipIDsGroupings = response.chipIDsGroupings; + topRow = response.topRow; + bottomRow = response.bottomRow; +}); + +// Get card translation table +loadJSON(PCIIDsURL, + function (response) { + PCI_ID_Array = response; +}); + +//============================================================== + /** * select element of the array where regexp in the first element matches second parameter * of this function @@ -790,7 +792,7 @@ BzPage.prototype.addNewButton = function (originalLocation,newId,newLabel, /** * Get attached Xorg.0.log, parse it and find the value of chip. * Does not fill the whiteboard itself, just adds button to do so,paramList - * so that slow XMLHTTPRequest is done in advance. + * so that slow XMLHttpRequest is done in advance. * * @return None */ @@ -816,7 +818,7 @@ BzPage.prototype.fillInChipMagic = function () { attURL = "https://bugzilla.redhat.com/attachment.cgi?id="+XorgLogAttID; that = this; - var req = new XMLHTTPRequest(); + var req = new XMLHttpRequest(); req.open("GET",attURL,true); req.onreadystatechange = function (aEvt) { if (req.readyState == 4) { @@ -871,10 +873,19 @@ BzPage.prototype.queryInNewTab = function(text,component,product) { // for further investigative searches if (text) { text = encodeURIComponent(text.trim()); - url += "&field1-0-0=longdesc&type1-0-0=substring&value1-0-0="+text+ + var searchText = "&field1-0-0=longdesc&type1-0-0=substring&value1-0-0="+text+ "&field1-0-1=attach_data.thedata&type1-0-1=substring&value1-0-1="+text+ "&field1-0-2=status_whiteboard&type1-0-2=substring&value1-0-2="+text; + url += searchText; jetpack.tabs.open(url); + // Don't do it ... b.m.o is apparently not powerful enough to sustain the weight + // of the search + if (false) { + url = "https://bugzilla.mozilla.org/buglist.cgi?query_format=advanced"+ + "field0-0-0=product;type0-0-0=regexp;"+ + "value0-0-0=thunderbird|firefox|xulrunner" + searchText.replace("&",";"); + jetpack.tabs.open(url); + } } }; @@ -901,8 +912,6 @@ BzPage.prototype.sendBugUpstream = function() { var text = this.dok.getElementById("short_desc_nonedit_display"). textContent.trim() + "\n\n"; - text += "(Originally filed as https://bugzilla.redhat.com/show_bug.cgi?id=" + - this.bugNo + ")\n\n"; text += this.collectComments(); jetpack.clipboard.set(text); var ret = jetpack.tabs.open(url); @@ -938,8 +947,9 @@ BzPage.prototype.parseAttachmentLine = function (inElem) { var aHrefsArr = inElem.getElementsByTagName("a"); var aHref = Array.filter(aHrefsArr,function (x) { return x.textContent.trim() == "Details"; - }); - var id = parseInt(aHrefs.attr("href").replace(/^.*attachment.cgi\?id=/, ""),10); + })[0]; + var id = parseInt(aHref.getAttribute("href"). + replace(/^.*attachment.cgi\?id=/, ""),10); //getting MIME type and size var stringArray = inElem.getElementsByClassName("bz_attach_extra_info")[0]. @@ -1156,7 +1166,7 @@ BzPage.prototype.createXMLRPCMessage = function(login,password,attachId,mimeType */ BzPage.prototype.fixAttachById = function(id,type) { var msg = this.createXMLRPCMessage(this.login,this.password,id,type); - var req = new XMLHTTPRequest(); + var req = new XMLHttpRequest(); req.open("POST",XMLRPCurl,true); req.overrideMimeType("text/xml"); req.setRequestHeader("Content-type","text/xml"); @@ -1209,6 +1219,7 @@ BzPage.prototype.createFixAllButton = function (list) { */ BzPage.prototype.addTextLink = function (row) { var that = this; + console.log("row = " + row); var elemS = row.getElementsByTagName("td"); var elem = elemS[elemS.length-1]; elem.innerHTML = "<br/><a href=''>Text</a>"; @@ -1317,7 +1328,10 @@ BzPage.prototype.generalPurposeCureForAllDisease = function // "Fixed in Version" textbox // otherwise -> NEXTRELEASE this.selectOption("bug_status", nextState); - var text = jetpack.selection.text.trim(); + var text = ""; + if (jetpack.selection.text) { + text = jetpack.select.text.trim(); + } if (text.length > 0) { this.selectOption("resolution","CURRENTRELEASE"); this.dok.getElementById("cf_fixed_in").value = text; @@ -1423,7 +1437,7 @@ BzPage.prototype.parseBacktrace = function (ret) { /** * Main executable functioning actually building all buttons on the page -- * separated into function, so that - * it could be called from onload method of the XMLHTTPRequest. + * it could be called from onload method of the XMLHttpRequest. * * @param jsonList Array created from JSON * @return none @@ -1489,6 +1503,10 @@ function BzPage(doc) { textContent.split("\n"); this.login = loginArr[loginArr.length-1].trim(); this.password = ""; + + // the following is quite awful brutal hack + console.log("on __parent__ navigator.online = " + + jetpack.__parent__.navigator.onLine); if (myConfig.BZpassword) { this.password = myConfig.BZpassword; } else { |