From 8db90e886bc25f382145a3af543959021851e5cd Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Mon, 19 Jul 2010 16:52:19 +0200 Subject: Allow empty Xorg log analysis --- lib/bzpage.js | 16 ++-------------- lib/logger.js | 8 -------- lib/main.js | 3 --- lib/offline-support.js | 4 ---- lib/rhbzpage.js | 13 +++++++++---- lib/util.js | 2 -- 6 files changed, 11 insertions(+), 35 deletions(-) diff --git a/lib/bzpage.js b/lib/bzpage.js index 9c24256..ff616ea 100644 --- a/lib/bzpage.js +++ b/lib/bzpage.js @@ -82,15 +82,12 @@ var BZPage = function BZPage(win, config) { } if ("XorgLogAnalysis" in config.gJSONData.configData) { - console.log("configData = " + config.gJSONData.configData); - console.log("XorgLogAnalysis = " + config.gJSONData.configData.XorgLogAnalysis); this.xorglogAnalysis = config.gJSONData.configData.XorgLogAnalysis; } if ("submitsLogging" in config.gJSONData.configData && config.gJSONData.configData.submitsLogging) { this.log = config.logger; - console.log("length of this.log.store = " + this.log.getLength()); this.setUpLogging(); } @@ -119,8 +116,6 @@ var BZPage = function BZPage(win, config) { brElementPlacer.parentNode.insertBefore(this.doc.createElement("br"), brElementPlacer); } - } else { - console.log("Cannot find element with 'comment_status_commit' ID!"); } this.generateButtons(); @@ -394,7 +389,6 @@ BZPage.prototype.createNewButton = function createNewButton (location, after, pk // creation of button might be conditional on existence of data in constantData if ("ifExist" in cmdObj) { if (!(cmdObj.ifExist in this.constantData)) { - console.log("Element with id " + newId + " won't be created!"); return ; } } @@ -755,7 +749,6 @@ BZPage.prototype.getPassword = function getPassword (login) { BZPage.prototype.setUpLogging = function setUpLogging () { // Protection against double-call if (this.doc.getElementById("generateTSButton")) { - console.log("Logging has been already set up!"); return ; } @@ -765,14 +758,9 @@ BZPage.prototype.setUpLogging = function setUpLogging () { // logging all submits for timesheet if (!this.submitHandlerInstalled) { - console.log("Installing submit callback!"); this.doc.forms.namedItem("changeform").addEventListener("submit",function (evt) { - console.log("Submit callback!"); - var resp = that.log.addLogRecord(that); if (resp === null) { - console.log("Avoiding submitting!"); - // TODO doesn't work ... still submitting' evt.stopPropagation(); evt.preventDefault(); } @@ -801,7 +789,7 @@ BZPage.prototype.setUpLogging = function setUpLogging () { "click", function(evt) { var otherTS = {}, thisTS = that.log.store; - + jsonPaths = prompts.promptFileOpenPicker(that.win); if (fileMod.exists(jsonPaths)) { otherTS = JSON.parse(fileMod.read(jsonPaths)); @@ -814,7 +802,7 @@ BZPage.prototype.setUpLogging = function setUpLogging () { } } else { console.error("File " + jsonPaths + " doesn't exist!"); - } + } }, false); var clearLogsUI = this.doc.createElement("li"); diff --git a/lib/logger.js b/lib/logger.js index 5926bea..2e8101f 100644 --- a/lib/logger.js +++ b/lib/logger.js @@ -19,28 +19,20 @@ function Logger(store, abbsMap) { exports.Logger = Logger; Logger.prototype.addLogRecord = function(that) { - console.log("Adding log record!"); var rec = {}; rec.date = new Date(); rec.url = that.doc.location.toString(); rec.title = that.title; var comment = prompts.prompt( "Enter comments for this comment"); - console.log("comment = " + comment); if (comment && comment.length > 0) { - console.log("I am in!"); comment = comment.trim(); rec.comment = comment; - console.log("rec.comment = " + rec.comment); var dateStr = utilMod.getISODate(rec.date); - console.log("rec.date = " + rec.date + ", dateStr = " + dateStr); var urlStr = urlMod.URL(rec.url).host; - console.log("rec.url = " + rec.url + ", urlStr = " + urlStr); var recKey = dateStr + "+" + urlStr + "+" + that.bugNo; - console.log("recKey = " + recKey); - console.log("rec = " + rec.toSource()); if (this.store[recKey]) { this.store[recKey].comment += "
\n" + comment; diff --git a/lib/main.js b/lib/main.js index 73ff206..b9476b0 100644 --- a/lib/main.js +++ b/lib/main.js @@ -95,7 +95,6 @@ function initialize(callback) { } if (!myStorage.logs) { - console.log("myStorage.logs empty!"); myStorage.logs = {}; } @@ -126,8 +125,6 @@ exports.main = function main(options, callbacks) { var curPage = new construct(window, config); } else if (isOurPage(window, config.skipMatches)) { skipThisPage(window.document); - } else { - console.log("Not our page: " + window.location.href); } } ); diff --git a/lib/offline-support.js b/lib/offline-support.js index e0b1c3b..d75979d 100644 --- a/lib/offline-support.js +++ b/lib/offline-support.js @@ -47,7 +47,6 @@ RHBugzillaPage.prototype.serializeForm = function(form) { */ function serializeControl(element) { var val = element.value; - // console.log("val.toSource() = " + val.toSource()); /* * on HTMLSelectElement we have an attribute 'type' of type DOMString, * readonly The type of this form control. This is the string @@ -79,12 +78,10 @@ RHBugzillaPage.prototype.serializeForm = function(form) { }; //RHBugzillaPage.prototype.submitCallback = function(evt) { -// console.log("Submit Callback!"); // if (jetpack.__parent__.navigator.onLine) { // var serForm = this // .serializeForm(jetpack.tabs.focused.contentWindow.document.forms // .namedItem("changeform")); -//// console.log("serForm:\n" + serForm.toSource()); // } else { // var serForm = this // .serializeForm(jetpack.tabs.focused.contentWindow.document.forms @@ -134,7 +131,6 @@ RHBugzillaPage.prototype.serializeForm = function(form) { req.onreadystatechange = function(aEvt) { if (req.readyState == 4) { if (req.status == 200) { - console.log("Sent form for bug " + bugID); delete myStorage.forms[bugID]; } else { console.error("Sending form for bug " + bugID + "failed!"); diff --git a/lib/rhbzpage.js b/lib/rhbzpage.js index 340e1fd..f68bf38 100644 --- a/lib/rhbzpage.js +++ b/lib/rhbzpage.js @@ -710,7 +710,7 @@ RHBugzillaPage.prototype.parseAttachmentLine = function(inElem) { RHBugzillaPage.prototype.analyzeXorgLog = function analyzeXorgLog(attachID) { var infoWin = this.win.open("", "Check att. " + attachID, - "width=512,height=640,status=no,location=no"); + "width=640,height=640,status=no,location=no"); var doc = infoWin.document; doc.body.innerHTML = "
";
     var preElem = doc.getElementById("textPre");
@@ -720,11 +720,17 @@ RHBugzillaPage.prototype.analyzeXorgLog = function analyzeXorgLog(attachID) {
     Request({
         url: attURL,
         onComplete: function() {
-            this.response.text.split("\n").filter(function(line) {
+            var results = this.response.text.split("\n").
+                filter(function(line) {
                     return (that.RE.soughtLines.test(line));
-                }).forEach(function(l) {
+                });
+            if (results.length > 0) {
+                results.forEach(function(l) {
                     preElem.innerHTML += l + "\n";
                 });
+            } else {
+                preElem.innerHTML += "No matching lines found!";
+            }
         }
     }).get();
 };
@@ -930,7 +936,6 @@ RHBugzillaPage.prototype.markBugTriaged = function() {
     // for F13 and later, ASSIGNED is "add Triaged keyword" (as well)
     // for