diff options
author | Matěj Cepl <mcepl@redhat.com> | 2010-07-18 23:55:17 +0200 |
---|---|---|
committer | Matěj Cepl <mcepl@redhat.com> | 2010-07-18 23:55:17 +0200 |
commit | 6bfea9fe58a028de3262f04275149b3495654ef8 (patch) | |
tree | 50b8180bca77c67ec9b135a047b6748c022fba53 /lib/rhbzpage.js | |
parent | d61189a4f67a321c8181f5e5ffaf50cc57e3b4c1 (diff) | |
download | bugzilla-triage-6bfea9fe58a028de3262f04275149b3495654ef8.tar.gz |
Make chip magic working again0.14
This was tough, but finally this fixes #24.
Diffstat (limited to 'lib/rhbzpage.js')
-rw-r--r-- | lib/rhbzpage.js | 99 |
1 files changed, 49 insertions, 50 deletions
diff --git a/lib/rhbzpage.js b/lib/rhbzpage.js index ddee250..84ca094 100644 --- a/lib/rhbzpage.js +++ b/lib/rhbzpage.js @@ -33,7 +33,7 @@ var RHBugzillaPage = function RHBugzillaPage(win, config) { } // For identification of graphics card - var manuChipStrs = [ [ "ATI Radeon", "ATI", "1002" ], + this.manuChipStrs = [ [ "ATI Radeon", "ATI", "1002" ], [ "ATI Mobility Radeon", "ATI", "1002" ], [ "Intel Corporation", "INTEL", "8086" ], [ "NVIDIA", "NV", "10de" ] ]; @@ -57,7 +57,8 @@ var RHBugzillaPage = function RHBugzillaPage(win, config) { 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") + frameNo: new RegExp("^\\s*#([0-9]*)\\s"), + soughtLines: new RegExp("^\\s*(\\[[0-9 .]*\\])?\\s*\\((EE|WW)\\)|\\s*Backtrace") }; this.constantData.XMLRPCData = JSON.parse(self.data.load("XMLRPCdata.json")); @@ -80,6 +81,11 @@ var RHBugzillaPage = function RHBugzillaPage(win, config) { this.password = this.getPassword(this.login); } + if (!this.constantData.ProfessionalProducts) { + this.constantData.ProfessionalProducts = + JSON.parse(self.data.load("professionalProducts.json")); + } + // getBadAttachments this.XorgLogAttList = []; this.XorgLogAttListIndex = 0; @@ -97,6 +103,23 @@ var RHBugzillaPage = function RHBugzillaPage(win, config) { this.pasteBacktraceInComments(); } + // Find out Xorg.0.log attachment URL + this.XorgLogAttList = this.attachments.filter(function (value, index, array) { + // Xorg.0.log must be text, otherwise we cannot parse it + return (/[xX].*log/.test(value[0]) && /text/.test(value[2])); + }); + this.addCheckXorgLogLink(); + + // TODO Get compiz bugs as well + if (config.PCI_ID_Array && + (this.maintCCAddr == "xgl-maint@redhat.com")) { + // Add find chip magic button + var whiteboard_string = this.doc.getElementById("status_whiteboard").value; + if (!/card_/.test(whiteboard_string)) { + this.fillInChipMagic(); + } + } + // Take care of signature for Fedora bugzappers if (config.gJSONData.configData.signature.length > 0) { var signatureFedoraString = config.gJSONData.configData.signature; @@ -112,16 +135,6 @@ var RHBugzillaPage = function RHBugzillaPage(win, config) { this.setBranding(); this.checkComments(); - // TODO Get compiz bugs as well - if (config.PCI_ID_Array && - (this.maintCCAddr == "xgl-maint@redhat.com")) { - // Add find chip magic button - var whiteboard_string = this.doc.getElementById("status_whiteboard").value; - if (!/card_/.test(whiteboard_string)) { - this.fillInChipMagic(); - } - } - // set default assignee on change of the component this.doc.getElementById("component").addEventListener("change", function() { @@ -220,7 +233,6 @@ RHBugzillaPage.prototype.centralCommandDispatch = function(cmdLabel, cmdParams) this.markBugTriaged(); break; case "chipMagic": - // it's true, not array ??? FIXME var splitArr = cmdParams.split("\t"); this.fillInWhiteBoard(splitArr[0], splitArr[1]); break; @@ -233,12 +245,6 @@ RHBugzillaPage.prototype.centralCommandDispatch = function(cmdLabel, cmdParams) /* Bugzilla functions. */ - -RHBugzillaPage.prototype.ProfessionalProducts = [ - "Red Hat Enterprise Linux", - "Red Hat Enterprise MRG" -]; - /** * */ @@ -329,7 +335,7 @@ RHBugzillaPage.prototype.markBadAttachments = function() { */ RHBugzillaPage.prototype.isEnterprise = function() { var prod = this.product; - var result = this.ProfessionalProducts.some(function(elem,idx,arr) { + var result = this.constantData.ProfessionalProducts.some(function(elem,idx,arr) { return new RegExp(elem).test(prod); }); return result; @@ -424,6 +430,20 @@ RHBugzillaPage.prototype.setBranding = function() { } }; +RHBugzillaPage.prototype.addCheckXorgLogLink = function addCheckXorgLogLink() { + var that = this; + if (this.xorglogAnalysis) { + this.XorgLogAttList.forEach(function (row) { + var elemS = row[4].getElementsByTagName("td"); + var elem = elemS[elemS.length - 1]; + elem.innerHTML += "<br/><a href='#'>check</a>"; + elem.addEventListener("click", function(x) { + that.analyzeXorgLog(row[1]); + }, false); + }, this); + }; +}; + /** * Given line to be parsed, find out which chipset it is and fill in the * whiteboard @@ -481,7 +501,7 @@ RHBugzillaPage.prototype.fillInWhiteBoard = function(iLine, driverStr) { } } else { // Intel Corporation, NVIDIA - cardIDArr = manuChipStrs.filter(function(el, ind, arr) { + cardIDArr = this.manuChipStrs.filter(function(el, ind, arr) { return new RegExp(el[0], "i").test(iLine); }); if (cardIDArr && (cardIDArr.length > 0)) { @@ -501,7 +521,7 @@ RHBugzillaPage.prototype.fillInWhiteBoard = function(iLine, driverStr) { } } this.addStuffToTextBox("status_whiteboard", ("card_" + outStr).trim()); - this.doc.getElementById("chipmagic").style.display = "none"; + this.doc.getElementById("chipMagic_btn").style.display = "none"; }; /** @@ -511,7 +531,7 @@ RHBugzillaPage.prototype.fillInWhiteBoard = function(iLine, driverStr) { * * @return None */ -RHBugzillaPage.prototype.fillInChipMagic = function () { +RHBugzillaPage.prototype.fillInChipMagic = function fillInChipMagic() { var that = this; var XorgLogURL = ""; var XorgLogAttID = ""; @@ -519,29 +539,10 @@ RHBugzillaPage.prototype.fillInChipMagic = function () { var attURL = "", interestingLine = ""; var interestingArray = []; - - // Find out Xorg.0.log attachment URL - this.XorgLogAttList = this.attachments.filter(function (value, index, array) { - // Xorg.0.log must be text, otherwise we cannot parse it - return (/[xX].*log/.test(value[0]) && /text/.test(value[2])); - }); if (this.XorgLogAttList.length === 0) { return; } - // FIXME add this.XorgLogAttList.forEach(addCheckButton) when configured so - // in this.config - if (this.xorglogAnalysis) { - this.XorgLogAttList.forEach(function (row) { - var elemS = row[4].getElementsByTagName("td"); - var elem = elemS[elemS.length - 1]; - elem.innerHTML += "<br/><a href='#'>cX</a>"; - elem.addEventListener("click", function(x) { - that.analyzeXorgLog(row[1]); - }, false); - }, this); - }; - XorgLogAttID = this.XorgLogAttList[this.XorgLogAttListIndex][1]; attURL = "https://bugzilla.redhat.com/attachment.cgi?id="+XorgLogAttID; @@ -561,7 +562,7 @@ RHBugzillaPage.prototype.fillInChipMagic = function () { // Persuade createNewButton to have mercy and to actually add // non-default button that.constantData.chipMagicTrigger = true; - that.chipMagicInterestingLine = interestingLine+"\t"+interestingArray[1] + that.packages["rh-xorg"].chipMagic.chipMagic = interestingLine+"\t"+interestingArray[1] .toUpperCase(); that.createNewButton("status_whiteboard", true, "rh-xorg", "chipMagic"); } @@ -711,19 +712,17 @@ RHBugzillaPage.prototype.analyzeXorgLog = function analyzeXorgLog(attachID) { var doc = infoWin.document; doc.body.innerHTML = "<pre id='textPre'></pre>"; var preElem = doc.getElementById("textPre"); - var soughtLinesRE = /^\s*(\[[0-9 .]*\])?\s*\((EE|WW)\)|\s*Backtrace"/; attURL = "https://bugzilla.redhat.com/attachment.cgi?id=" + attachID; var that = this; Request({ url: attURL, onComplete: function() { - var logArr = this.response.text.split("\n"); - logArr.forEach(function (line) { - if (soughtLinesRE.test(line)) { - preElem.innerHTML += line+"\n"; - } - }); + this.response.text.split("\n").filter(function(line) { + return (that.RE.soughtLines.test(line)); + }).forEach(function(l) { + preElem.innerHTML += l + "\n"; + }); } }).get(); }; |