diff options
Diffstat (limited to 'data/lib')
-rw-r--r-- | data/lib/addNewLinks.js | 17 | ||||
-rw-r--r-- | data/lib/jumpNextBug.js | 3 | ||||
-rw-r--r-- | data/lib/rhbzpage.js | 45 | ||||
-rw-r--r-- | data/lib/util.js | 6 |
4 files changed, 58 insertions, 13 deletions
diff --git a/data/lib/addNewLinks.js b/data/lib/addNewLinks.js index 735a0fc..02bd658 100644 --- a/data/lib/addNewLinks.js +++ b/data/lib/addNewLinks.js @@ -36,9 +36,6 @@ * ***** END LICENSE BLOCK ***** */ function addNewLinks(d) { - // Why we are using d.querySelector for something which could be - // getElementById().value? FIXME - // console.log("addNewLinks : product = " + document.getElementById("product").value); var product = d.querySelector("#field_container_product option[selected]"); var component = d.querySelector("#component option[selected]"); @@ -58,11 +55,15 @@ function addNewLinks(d) { '&component=' + encodeURIComponent(component.value); if (label) { var componentElement = document.getElementById("bz_component_input"); - var computedStyle = window.getComputedStyle(componentElement); - console.log("computedStyle.display = " + computedStyle.display); - if (computedStyle.display == "none") { - label = document.getElementById("bz_component_edit_container"); - }; + if (componentElement) { // We are in the Red Hat bugzilla + // do we have components list visible? + if (document.getElementById('bz_component_input'). + classList.contains("bz_default_hidden")) { + label = document.getElementById("bz_component_edit_container"); + } + } else { + label = document.getElementById('component').parentNode; + } createDeadLink("file_new_bug_component", "new", label, url, [], "parens"); } } diff --git a/data/lib/jumpNextBug.js b/data/lib/jumpNextBug.js index 8f64b0d..76e6657 100644 --- a/data/lib/jumpNextBug.js +++ b/data/lib/jumpNextBug.js @@ -35,7 +35,8 @@ labelToRelation[labelText].href = elem.getAttribute("href"); }; }); - console.log("labelToRelation = " + labelToRelation.toSource()); + console.myDebug("labelToRelation = " + labelToRelation.toSource()); + for (var key in labelToRelation) { if (labelToRelation.hasOwnProperty(key)) { relation = labelToRelation[key]; diff --git a/data/lib/rhbzpage.js b/data/lib/rhbzpage.js index 8831b24..3cffbb9 100644 --- a/data/lib/rhbzpage.js +++ b/data/lib/rhbzpage.js @@ -1,6 +1,9 @@ // Released under the MIT/X11 license // http://www.opensource.org/licenses/mit-license.php +// Are we debugging? +var debugFlag = false; + // For identification of graphics card var manuChipStrs = [ [ "ATI Radeon", "ATI", "1002" ], [ "ATI Mobility Radeon", "ATI", "1002" ], @@ -131,6 +134,7 @@ function RHcentralCommandDispatch(cmdLabel, cmdParams) { markBugTriaged(); break; case "chipMagic": + console.myDebug("cmdParams = " + cmdParams.toSource()); fillInWhiteBoard(cmdParams); break; // If we don't have it here, call superclass method @@ -149,7 +153,7 @@ function RHcentralCommandDispatch(cmdLabel, cmdParams) { function markBadAttachments(atts) { var badMIMEArray = [ "application/octet-stream", "text/x-log", "undefined" ]; if (!constantData.passwordState.passAvailable) { - console.log("markBadAttachments : No password, no XML-RPC calls; sorry"); + console.myDebug("markBadAttachments : No password, no XML-RPC calls; sorry"); return null; } @@ -214,9 +218,10 @@ function addCheckXorgLogLink(attList) { * * @param PCIidArrObj object with two fields * id Array manufacturer-ID and product-ID (PCI IDs) - * chipsetLine RE + * chipsetLine whole line containing PCI ID. * @param driverStr String with the driver name * @return None + * */ function fillInWhiteBoard(PCIidArrObj) { var outStr = ""; @@ -225,7 +230,13 @@ function fillInWhiteBoard(PCIidArrObj) { var cardName = ""; var PCIid = (PCIidArrObj.id[0] + "," + PCIidArrObj.id[1]).toUpperCase(); + console.myDebug("PCIidArrObj = " + PCIidArrObj.toSource()); + console.myDebug("PCIid = " + PCIid); + + // Nvidia driver provides good code in the if (PCIidArrObj.id[0].toLowerCase() == "10de") { + // The following is wrong ... chipsetLine is String, not an array + console.myDebug("fillInWhiteBoard: chipsetLine = " + PCIidArrObj.chipsetLine); cardName = PCIidArrObj.chipsetLine[2].replace(/\s*nvidia\s*/ig,""). replace('"','','g'); } @@ -242,6 +253,7 @@ function fillInWhiteBoard(PCIidArrObj) { } } + console.myDebug("fillInWhiteBoard: cardName = " + cardName); clickMouse("editme_action"); var titleElem = document.getElementById('short_desc'); titleElem.value = '[' + cardName + ']\u00A0' + titleElem.value; @@ -260,17 +272,34 @@ function fillInChipMagic(XlogID) { analyzeXorgLog(XlogID, "AnalyzeInterestingLine"); } +/** + * Creates a button to change summary by adding a graphic chip label + * + * @param Array with matching results of re.exec() + */ function chipsetMagic (interestingLineArr) { // parse Xorg.0.log + var chipsetLine = ""; + console.myDebug("interestingLineArr = " + interestingLineArr.toSource()); + console.myDebug("interestingLineArr[1] = " + interestingLineArr[1]); if (interestingLineArr.length >0) { var interestingArray = interestingLineArr[0]; if (interestingArray.length > 1) { var interestingPCIID = interestingArray[2].trim().split(":"); + // If we have Chipset line, we should parse it as well and + // add to the button + if (interestingLineArr.length > 1) { + chipsetLine = interestingLineArr[1]; + console.myDebug("chipsetLine = " + chipsetLine.toSource()); + } else { + chipsetLine = null; + console.myDebug("chipsetLine = " + chipsetLine); + } createNewButton("short_desc_nonedit_display", false, { "name": "Fill In", "chipMagic": { "id": interestingPCIID, - "chipsetLine": interestingLineArr[1] + "chipsetLine": chipsetLine }, }); } @@ -319,15 +348,23 @@ function findInterestingLine(wholeLog, backMsg) { return new RegExp(reone); }); } + console.myDebug("Current REs:"); + REarr.forEach(function (re) { + console.myDebug("re: " + re.source); + }); + var results = []; wholeLog.split("\n"). forEach(function(line) { REarr.forEach(function (re, reIdx) { if (re.test(line)) { + console.myDebug("Found match on line:\n" + line); + console.myDebug("Result: " + re.exec(line).toSource()); results.push(re.exec(line)); } }); }); + console.myDebug("results = " + results.toSource()); logAnalyzeLogic[backMsg].func(results); } @@ -379,7 +416,7 @@ function addClosingUpstream() { centralCommandDispatch("resolution", "UPSTREAM"); } else { - console.log("No external bug specified among the External References!"); + console.myDebug("No external bug specified among the External References!"); } } diff --git a/data/lib/util.js b/data/lib/util.js index 6256171..51f3704 100644 --- a/data/lib/util.js +++ b/data/lib/util.js @@ -351,3 +351,9 @@ var NotLoggedinException = function NotLoggedinException (message) { NotLoggedinException.prototype.toString = function () { return this.name + ': "' + this.message + '"'; }; + +console.myDebug = function myDebug(str) { + if (debugFlag) { + console.log(str); + } +}; |