diff options
Diffstat (limited to 'data/rhbzpage.js')
-rw-r--r-- | data/rhbzpage.js | 94 |
1 files changed, 63 insertions, 31 deletions
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() { |