diff options
Diffstat (limited to 'data')
-rw-r--r-- | data/lib/collectingMetadata.js | 75 | ||||
-rw-r--r-- | data/lib/otherButtons.js | 2 | ||||
-rw-r--r-- | data/rhlib/rhbzpage.js | 42 |
3 files changed, 68 insertions, 51 deletions
diff --git a/data/lib/collectingMetadata.js b/data/lib/collectingMetadata.js index 6fe57a4..743c812 100644 --- a/data/lib/collectingMetadata.js +++ b/data/lib/collectingMetadata.js @@ -1,26 +1,31 @@ +/*jslint es5: true, vars: true, plusplus: true, maxerr: 50, indent: 2, + devel: true, browser: true, vars: true, forin: true */ +/*global parseMailto, ISODateString, parseBZCommentDate, getReporter, + ReporterColor, constantData, createDeadLink, fixAttachById, addTextLink, + parseURL, isInList, analyzeXorgLog, config */ // Released under the MIT/X11 license // http://www.opensource.org/licenses/mit-license.php "use strict"; function Comment(comment) { - var nameSpan = comment.querySelector(".bz_comment_user a.email"); - var timeSpan = comment.getElementsByClassName("bz_comment_time")[0]; + var nameSpan = comment.querySelector(".bz_comment_user a.email"); + var timeSpan = comment.getElementsByClassName("bz_comment_time")[0]; - this.author = parseMailto(nameSpan).trim(); - this.element = comment; - this.date = parseBZCommentDate(timeSpan.textContent.trim()); - this.timeSpan = timeSpan; + this.author = parseMailto(nameSpan).trim(); + this.element = comment; + this.date = parseBZCommentDate(timeSpan.textContent.trim()); + this.timeSpan = timeSpan; } Comment.prototype.getText = function getText() { - return this.element.getElementsByTagName("pre")[0].textContent.trim(); -} + return (this.element.getElementsByTagName("pre")[0].textContent.trim()); +}; function CommentList(doc) { var commentElems = document.getElementById("comments"). getElementsByClassName("bz_comment"); var comments = {}; - Array.forEach(commentElems, function(item) { + Array.forEach(commentElems, function (item) { var com = new Comment(item); if (com.element) { comments[ISODateString(com.date)] = com; @@ -35,22 +40,22 @@ function CommentList(doc) { */ CommentList.prototype.colorComments = function colorComments() { var reporter = getReporter(); - var com = null; - for (var idx in this.comments) { + var com = null, idx = null; + for (idx in this.comments) { com = this.comments[idx]; if (com.author === reporter) { com.element.style.backgroundColor = ReporterColor.toString(); } } -} +}; CommentList.prototype.getAllCommentsText = function getAllCommentsText() { - var outStr = ""; - for (var idx in this.comments) { + var outStr = "", idx = null; + for (idx in this.comments) { outStr += this.comments[idx].getText() + "\n"; } return outStr; -} +}; // ----------------------------------------------------------- /** @@ -74,7 +79,7 @@ function Attachment(inElem) { // TODO probably could use url.URL object var aHrefsArr = inElem.getElementsByTagName("a"); - var aHref = Array.filter(aHrefsArr, function(x) { + var aHref = Array.filter(aHrefsArr, function (x) { return x.textContent.trim() === "Details"; })[0]; this.id = parseURL(aHref.getAttribute("href")).params.id; @@ -85,18 +90,18 @@ function Attachment(inElem) { this.size = parseInt(stringArray[0], 10); this.mimeType = stringArray[1].split(" ")[0]; this.element = inElem; -}; +} Attachment.prototype.isBadMIME = function isBadMIME() { var badMIMEArray = [ "application/octet-stream", "text/x-log", "undefined" ]; return isInList(this.mimeType, badMIMEArray); }; -Attachment.prototype.checkXorgLink = function checkXorgLink() { +Attachment.prototype.checkAttLink = function checkAttLink(baseIDname, reIdx) { var elemS = this.element.getElementsByTagName("td"); var elem = elemS[elemS.length - 1]; - createDeadLink("xorgLogAnalyzeLink", "check", elem, - analyzeXorgLog, [this.id, "AnalyzeXorgLogBacktrace"], "br"); + createDeadLink(baseIDname + "_" + this.id, "check", elem, + analyzeXorgLog, [this.id, reIdx], "br"); }; Attachment.prototype.isParsed = function isParsed() { @@ -107,13 +112,13 @@ Attachment.prototype.isParsed = function isParsed() { // ---------------------------------------------------------------------------- function AttachList(doc) { this.attachments = []; - var attach = {}; + var attach = {}, i = 0, ii = 0; var attElements = doc.getElementById("attachment_table"). getElementsByTagName("tr"); // FIXME change into list of objects and both comments and // attachments (and something else?) should be properties of one // huge object - for ( var i = 1, ii = attElements.length - 1; i < ii; i++) { + for (i = 1, ii = attElements.length - 1; i < ii; i++) { attach = new Attachment(attElements[i]); if (attach.id) { this.attachments.push(attach); @@ -122,22 +127,26 @@ function AttachList(doc) { } AttachList.prototype.getBadAttachments = function getBadAttachments() { - return this.attachments.filter(function(att) { + return this.attachments.filter(function (att) { return (att.isBadMIME()); }); -} +}; /** * Add a link opening selected lines of Xorg.0.log */ AttachList.prototype.addCheckXorgLogLink = function addCheckXorgLogLink() { if (config.XorgLogAnalysis) { - this.getXorgList(). + this.getAttList(/[xX].*log/). forEach(function (att) { - att.checkXorgLink(); - }); + att.checkAttLink("xorgLogAnalyzeLink", "AnalyzeXorgLogBacktrace"); + }); + this.getAttList(/[dD]mesg/). + forEach(function (att) { + att.checkAttLink("dmesgAnalyzeLink", "AnalyzeDmesgErrors"); + }); } -} +}; /** * Make it sailent that the some attachments with bad MIME type are present @@ -159,12 +168,12 @@ AttachList.prototype.markBadAttachments = function markBadAttachments() { getElementsByClassName("bz_alias_short_desc_container")[0]; titleElement.style.backgroundColor = "olive"; - createDeadLink("fixAllButton", "Fix all", titleElement, function() { - Array.forEach(badAttachments, function(x) { + createDeadLink("fixAllButton", "Fix all", titleElement, function () { + Array.forEach(badAttachments, function (x) { fixAttachById(x.id, constantData.XMLRPCData[window.location.hostname].url); }); }, [], false, null, "f"); - badAttachments.forEach(function(x, i, a) { + badAttachments.forEach(function (x, i, a) { addTextLink(x, constantData.XMLRPCData[window.location.hostname].url); }); } @@ -176,10 +185,10 @@ AttachList.prototype.getParsedAttachments = function getParsedAttachments() { }); }; -AttachList.prototype.getXorgList = function getXorgList() { +AttachList.prototype.getAttList = function getAttList(attRE) { return this.attachments.filter(function (value) { // Xorg.0.log must be text, otherwise we cannot parse it - return (/[xX].*log/.test(value.name) && /text/.test(value.mimeType)); + return (attRE.test(value.name) && /text/.test(value.mimeType)); }); }; diff --git a/data/lib/otherButtons.js b/data/lib/otherButtons.js index 6935b8e..ef04d19 100644 --- a/data/lib/otherButtons.js +++ b/data/lib/otherButtons.js @@ -119,7 +119,7 @@ function setBranding(things) { var TriagedColor = {}; var atts = things.attachments; - var xLogAtts = atts.getXorgList(); + var xLogAtts = atts.getAttList(/[xX].*log/); var ITbutton = document.getElementById("cf_issuetracker"); var its = ITbutton ? ITbutton.value.trim() : ""; diff --git a/data/rhlib/rhbzpage.js b/data/rhlib/rhbzpage.js index cbd8665..34bf906 100644 --- a/data/rhlib/rhbzpage.js +++ b/data/rhlib/rhbzpage.js @@ -26,24 +26,31 @@ var logAnalyzeLogic = { * 0x00001000/128, BIOS @ 0x????????/131072 */ re: [ - "^(\\[[ .0-9]+\\])?\\s*\\(--\\) PCI:\\*\\([0-9:]+\\)\\s*" + - "([0-9a-f:]+).*$", - "^\\s*\\[?[ 0-9.]*\\]?\\s*\\(--\\) "+ - "([A-Za-z]+)\\([0-9]?\\): Chipset: (.*)$", - ], - func: chipsetMagic + "^(\\[[ .0-9]+\\])?\\s*\\(--\\) PCI:\\*\\([0-9:]+\\)\\s*" + + "([0-9a-f:]+).*$", + "^\\s*\\[?[ 0-9.]*\\]?\\s*\\(--\\) "+ + "([A-Za-z]+)\\([0-9]?\\): Chipset: (.*)$", + ], + func: chipsetMagic }, - /* - * [ 126.385] (WW) Falling back to old probe method for vesa [ 126.385] (WW) - * Falling back to old probe method for fbdev [ 126.386] (--) NOUVEAU(0): - * Chipset: "NVIDIA NVaf" Backtrace: [ 33.158] Kernel command line: ro - * root=LABEL=root rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 - * SYSFONT=latarcyrheb-sun16 KEYTABLE=us drm.debug=0x04 - * - */ "AnalyzeXorgLogBacktrace": { - re: "^\\s*(\\[[0-9 .]*\\])?\\s*(\\((EE|WW)\\)|.* [cC]hipset:.*)|\\s*(Backtrace|Kernel command line)", - func: analyzeXorg + /* + * [ 126.385] (WW) Falling back to old probe method for vesa [ 126.385] (WW) + * Falling back to old probe method for fbdev [ 126.386] (--) NOUVEAU(0): + * Chipset: "NVIDIA NVaf" Backtrace: [ 33.158] Kernel command line: ro + * root=LABEL=root rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 + * SYSFONT=latarcyrheb-sun16 KEYTABLE=us drm.debug=0x04 + * + */ + re: "^\\s*(\\[[0-9 .]*\\])?\\s*(\\((EE|WW)\\)|" + + ".* [cC]hipset:.*)|\\s*(Backtrace|Kernel command line)", + func: displayResultsInPanel + }, + "AnalyzeDmesgErrors": { + /* + */ + re: "[fF]ail|[eE]rror|drm", + func: displayResultsInPanel } }; @@ -72,6 +79,7 @@ function RHOnMessageHandler(msg, nextHandlerList) { break; case "AnalyzeInterestingLine": case "AnalyzeXorgLogBacktrace": + case "AnalyzeDmesgErrors": findInterestingLine(msg.data, msg.cmd); break; case "queryUpstream": @@ -272,7 +280,7 @@ function chipsetMagic (interestingLineArr) { } } -function analyzeXorg(results) { +function displayResultsInPanel(results) { var innerString = ""; if (results.length > 0) { |