diff options
-rw-r--r-- | data/bzpage.js | 13 | ||||
-rw-r--r-- | data/rhbzpage.js | 94 | ||||
-rw-r--r-- | lib/libbugzilla.js | 6 |
3 files changed, 72 insertions, 41 deletions
diff --git a/data/bzpage.js b/data/bzpage.js index c1ff730..c012e07 100644 --- a/data/bzpage.js +++ b/data/bzpage.js @@ -207,7 +207,6 @@ function killNodes(doc, target, remove) { * @return none */ function changeAssignee (newAssignee) { - console.log("changeAssignee : newAssignee = " + newAssignee); var defAssigneeButton = null; // Previous assignee should know what's going on in his bug addToCCList(getOwner()); @@ -307,7 +306,7 @@ function createDeadLink (id, text, parent, callback, params, before, covered, ac } else { newAElem.setAttribute("href", ""); newAElem.addEventListener("click", function(evt) { - callback(params); + callback.apply(null, params); evt.stopPropagation(); evt.preventDefault(); }, false); @@ -337,8 +336,8 @@ function createNewButton (location, after, cmdObj) { try { var newId = cmdObj.name.toLowerCase().replace(/[^a-z0-9]+/,"","g") + "_btn"; } catch (e) { - console.log("createNewButton : e = " + e); - console.log("createNewButton : cmdObj.toSource() = " + + console.error("createNewButton : e = " + e + + "\ncreateNewButton : cmdObj.toSource() = " + cmdObj.toSource()); } @@ -385,9 +384,9 @@ function generateButtons (pkgs, kNodes) { var topRowPosition = "topRowPositionID"; var bottomRowPosition = "commit"; - setUpLogging(); + setUpLogging(); - // ========================================================= + // ========================================================= if (kNodes && window.location.hostname in kNodes) { var killConf = killNodes[window.location.hostname]; killNodes(document, killConf[0], killConf[1]); @@ -421,7 +420,7 @@ function generateButtons (pkgs, kNodes) { break; } } else { - console.log("generateButtons : rejected cmdObj = " + + console.error("generateButtons : rejected cmdObj = " + cmdObj.toSource()); } } diff --git a/data/rhbzpage.js b/data/rhbzpage.js index 15bbd0c..a374f4e 100644 --- a/data/rhbzpage.js +++ b/data/rhbzpage.js @@ -19,6 +19,19 @@ var RawhideColor = new Color(0, 119, 0); // or "green", or RGB 0, 119, 0, or // 120, 0, 23 var RHITColor = new Color(102, 0, 102); // RGB 102, 0, 102; HSL 300, 0, 20 +var logAnalyzeLogic = { + "AnalyzeInterestingLine": { + "re": "^\\s*\\[?[ 0-9.]*\\]?\\s*\\(--\\) "+ + "([A-Za-z]+)\\([0-9]?\\): Chipset: (.*)$", + "func": chipsetMagic + }, + "AnalyzeXorgLogBacktrace": { + "re": "^\\s*(\\[[0-9 .]*\\])?\\s*(\\((EE|WW)\\)|.*"+ + " [cC]hipsets?: )|\\s*Backtrace", + "func": analyzeXorg + } +}; + var ProfessionalProducts = [ "Red Hat Enterprise Linux", "Red Hat Enterprise MRG" @@ -451,16 +464,6 @@ function setBranding() { + " none"; } -/* TODO this is complicated, because we would need RPC call back and forth. - // we should make visible whether maintCCAddr is in CCList - 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"; - } -*/ - var compElems; if (config.suspiciousComponents && isInList(getComponent(), config.suspiciousComponents) @@ -532,7 +535,7 @@ function addCheckXorgLogLink(attList) { var elemS = row[4].getElementsByTagName("td"); var elem = elemS[elemS.length - 1]; createDeadLink("xorgLogAnalyzeLink", "check", elem, - analyzeXorgLog, row[1], "br"); + analyzeXorgLog, [row[1], "AnalyzeXorgLogBacktrace"], "br"); }); } } @@ -677,15 +680,9 @@ function analyzeXorgLog(attachID) { })); } -function analyzeXorgLogBacktrace(reponseText) { - var soughtLines = new RegExp("^\\s*(\\[[0-9 .]*\\])?\\s*(\\((EE|WW)\\)|.*"+ - " [cC]hipsets?: )|\\s*Backtrace"); +function analyzeXorg(results) { var innerString = ""; - var results = response.text.split("\n"). - filter(function(line) { - return (soughtLines.test(line)); - }); - results.sort(); // FIXME why? + // results.sort(); FIXME should I uncomment it? results = removeDuplicates(results); // Remove headers if (results.length >= 1) { @@ -693,16 +690,35 @@ function analyzeXorgLogBacktrace(reponseText) { } if (results.length > 0) { results.forEach(function(l) { - innerString += l + "\n"; + innerString += l + "<br>\n"; }); // Add a summary - innerString += "----------\n" + + innerString += "----------<br>\n" + results.length + " interesting lines found."; } else { innerString += "No matching lines found!"; } postMessage(new Message("OpenStringInPanel", - "<pre>\n" + innerString.trim() + "\n</pre>")); + '<!DOCTYPE html PUBLIC "-//IETF//DTD HTML 2.0//EN">' + + "<html><head><title>Xorg.0.log analysis</title></head><body><pre>\n" + + innerString.trim() + + "\n</pre></body></html>")); +} + +function analyzeXorgLog(attachID, backMsg) { + postMessage(new Message("GetURL", { + url: "https://" + window.location.hostname + "/attachment.cgi?id=" + attachID, + backMessage: backMsg + })); +} + +function findInterestingLine(wholeLog, backMsg) { + var RE = new RegExp(logAnalyzeLogic[backMsg].re); + var results = wholeLog.split("\n"). + filter(function(line) { + return (RE.test(line)); + }); + logAnalyzeLogic[backMsg].func(results); } /** @@ -944,20 +960,37 @@ function RHBZinit() { // 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); - /* fillInChipMagic needs to be fixed first, but it can wait. - TODO Get compiz bugs as well - if (constantData.PCI_ID_Array && - (XorgLogAttList[0]) && + var maintCCAddr = ""; + if (constantData.CCmaintainer) { + maintCCAddr = filterByRegexp(constantData.CCmaintainer, + getComponent())[0]; // filterByRegexp returns array, not string + } + + // fillInChipMagic needs to be fixed first, but it can wait. + // TODO Get compiz bugs as well + if ((constantData.chipNames !== undefined) && + (XorgLogAttList[0] !== undefined) && (maintCCAddr === "xgl-maint@redhat.com")) { - Add find chip magic button + // Add find chip magic button + console.log("Adding a chip magic button!"); var whiteboard_string = document.getElementById("status_whiteboard").value; + console.log("Whiteboard string = " + whiteboard_string); if (!/card_/.test(whiteboard_string)) { - fillInChipMagic(); // FIXME add parameters of the call + fillInChipMagic(XorgLogAttList[0][1]); } } - */ + + // we should make visible whether maintCCAddr is in CCList + console.log("maintCCAddr = " + maintCCAddr); + if (maintCCAddr && isInList(maintCCAddr, getCCList())) { + var ccEditBoxElem = document.getElementById("cc_edit_area_showhide"); + ccEditBoxElem.style.color = "navy"; + ccEditBoxElem.style.fontWeight = "bolder"; + ccEditBoxElem.style.textDecoration = "underline"; + } // Take care of signature for Fedora bugzappers if (config.signature && config.signature.length > 0) { @@ -970,7 +1003,6 @@ function RHBZinit() { } }, false); } - setBranding(); // set default assignee on change of the component @@ -981,7 +1013,7 @@ function RHBZinit() { changeAssignee("default"); }, false); } - + // Uncheck "set default assignee" when the assignee is changed by other means document.getElementById("assigned_to").addEventListener("change", function() { diff --git a/lib/libbugzilla.js b/lib/libbugzilla.js index d30a025..196dbbe 100644 --- a/lib/libbugzilla.js +++ b/lib/libbugzilla.js @@ -218,10 +218,10 @@ exports.getURL = function getURL(url, callback) { exports.openStringInNewPanel = function openStringInNewPanel(inHTMLStr) { openURLInNewPanel("data:text/html;charset=utf-8," + - dataUtils.base64Encode(inHTMLStr)); + inHTMLStr); }; -exports.openURLInNewPanel = function openURLInNewPanel(url) { +var openURLInNewPanel = exports.openURLInNewPanel = function openURLInNewPanel(url) { var panel = panelMod.Panel({ contentURL: url, width: 640, @@ -230,7 +230,7 @@ exports.openURLInNewPanel = function openURLInNewPanel(url) { panel.show(); }; -exports.openURLInNewTab = function openURLInNewTab(url) { +var openURLInNewTab = exports.openURLInNewTab = function openURLInNewTab(url) { tabs.open({ url: url, inBackground: true, |