aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2010-05-31 19:17:19 +0200
committerMatěj Cepl <mcepl@redhat.com>2010-05-31 19:17:19 +0200
commit475c2df048fa5c42ba913ceeba3e6201938031f7 (patch)
tree5a77c7f6c5bff188ce96020d6186fcb2f07696e5 /lib
parent2447e31a804eb7d7fe5ef01b974cba3b615e0594 (diff)
downloadbugzilla-triage-475c2df048fa5c42ba913ceeba3e6201938031f7.tar.gz
rewrite util.js to be more compliant with SDK usage.
Diffstat (limited to 'lib')
-rw-r--r--lib/bzpage.js9
-rw-r--r--lib/logger.js15
-rw-r--r--lib/main.js9
-rw-r--r--lib/mozillabzpage.js5
-rw-r--r--lib/rhbzpage.js11
-rw-r--r--lib/util.js2
6 files changed, 30 insertions, 21 deletions
diff --git a/lib/bzpage.js b/lib/bzpage.js
index c4c88f3..bad7b5e 100644
--- a/lib/bzpage.js
+++ b/lib/bzpage.js
@@ -3,6 +3,7 @@
// Released under the MIT/X11 license
// http://www.opensource.org/licenses/mit-license.php
"use strict";
+var utilMod = require("util");
var TriagedDistro = 13;
var NumberOfFrames = 7;
@@ -55,7 +56,7 @@ exports.BZPage = function BZPage(doc) {
}
this.submitHandlerInstalled = false;
- this.bugNo = hlpr.getBugNo(this.doc.location.toString());
+ this.bugNo = utilMod.getBugNo(this.doc.location.toString());
this.reporter = this.getReporter();
this.product = this.getOptionValue("product");
this.component = this.getOptionValue("component");
@@ -486,7 +487,7 @@ BZPage.prototype.addStuffToTextBox = function(id, stuff) {
stuff = textBox.value ? "\n\n" + stuff : stuff;
textBox.value += stuff;
} else {
- textBox.value = hlpr.addCSVValue(textBox.value,stuff);
+ textBox.value = utilMod.addCSVValue(textBox.value,stuff);
}
};
@@ -498,7 +499,7 @@ BZPage.prototype.addStuffToTextBox = function(id, stuff) {
*/
BZPage.prototype.removeStuffFromTextBox = function(id, stuff) {
let changedElement = this.getElementById(id);
- changedElement.value = hlpr.removeCSVValue(changedElement.value,stuff);
+ changedElement.value = utilMod.removeCSVValue(changedElement.value,stuff);
}
/**
@@ -723,7 +724,7 @@ BZPage.prototype.addToCCList = function(who) {
this.doc.getElementById("addselfcc").checked = true;
} else {
this.clickMouse("cc_edit_area_showhide");
- if (!hlpr.isInList(who, this.CCList)) {
+ if (!utilMod.isInList(who, this.CCList)) {
this.addStuffToTextBox("newcc",who);
}
}
diff --git a/lib/logger.js b/lib/logger.js
index ba9afc8..6bd8142 100644
--- a/lib/logger.js
+++ b/lib/logger.js
@@ -1,8 +1,10 @@
// Released under the MIT/X11 license
// http://www.opensource.org/licenses/mit-license.php
"use strict";
+var urlMod = require("url");
+var urilMod = require("util");
-exports.Logger = function Logger(store, abbsMap) {
+var Logger = exports.Logger = function Logger(store, abbsMap) {
this.EmptyLogsColor = new Color(0, 255, 0);
this.FullLogsColor = new Color(0, 40, 103);
@@ -20,7 +22,8 @@ Logger.prototype.addLogRecord = function(that) {
if (comment && comment.length > 0) {
comment = comment.trim();
rec.comment = comment;
- let recKey = hlpr.getISODate(rec.date) + "+" + hlpr.getHost(rec.url)
+ let recKey = utilMod.getISODate(rec.date) + "+"
+ + urlMod.parse(rec.url).host
+ "+" + that.bugNo;
let clearLogAElem = that.doc.getElementById("clearLogs");
clearLogAElem.style.color = this.FullLogsColor;
@@ -40,7 +43,7 @@ Logger.prototype.addLogRecord = function(that) {
Logger.prototype.getBugzillaAbbr = function(url) {
// for https://bugzilla.redhat.com/show_bug.cgi?id=579123 get RH
// for https://bugzilla.mozilla.org/show_bug.cgi?id=579123 get MoFo
- var abbr = this.abbsMap[hlpr.getHost(url)];
+ var abbr = this.abbsMap[urlMod.parse(url).host];
return abbr;
}
@@ -63,10 +66,10 @@ Logger.prototype.timeSheetRecordsPrinter = function(body, records) {
// now print the array
tmpArr.forEach(function(rec) {
let x = rec[1];
- let dayStr = hlpr.getISODate(x.date);
- let host = hlpr.getHost(x.url);
+ let dayStr = utilMod.getISODate(x.date);
+ let host = urlMod.parse(x.url).host;
let BZName = that.getBugzillaAbbr(x.url);
- let bugNo = hlpr.getBugNo(x.url);
+ let bugNo = utilMod.getBugNo(x.url);
if (dayStr != currentDay) {
currentDay = dayStr;
body.innerHTML += "<hr/><p><strong>" + currentDay
diff --git a/lib/main.js b/lib/main.js
index 1a2dd7e..ac01868 100644
--- a/lib/main.js
+++ b/lib/main.js
@@ -3,6 +3,9 @@
// Released under the MIT/X11 license
// http://www.opensource.org/licenses/mit-license.php
"use strict";
+var utilMod = require("util");
+var logMod = require("logger");
+
jetpack.future.import("pageMods");
jetpack.future.import("storage.simple");
jetpack.future.import("selection");
@@ -55,7 +58,7 @@ config.matches = [
"https://bugzilla.redhat.com/show_bug.cgi",
"https://bugzilla.mozilla.org/show_bug.cgi"
];
-hlpr.loadJSON(jetpack.storage.settings.JSONURL, function(parsedData) {
+utilMod.loadJSON(jetpack.storage.settings.JSONURL, function(parsedData) {
config.gJSONData = parsedData;
// Get card translation table
@@ -64,12 +67,12 @@ hlpr.loadJSON(jetpack.storage.settings.JSONURL, function(parsedData) {
keys += key + " ";
}
if ("PCIIDsURL" in config.gJSONData.configData) {
- hlpr.loadJSON(config.gJSONData.configData.PCIIDsURL, function(response) {
+ utilMod.loadJSON(config.gJSONData.configData.PCIIDsURL, function(response) {
config.PCI_ID_Array = response;
});
}
- config.logger = new Logger(myStorage.logs,
+ config.logger = new logMod.Logger(myStorage.logs,
config.gJSONData.constantData.bugzillalabelAbbreviations);
let callback = function(doc) {
diff --git a/lib/mozillabzpage.js b/lib/mozillabzpage.js
index 5a864f9..6eaa869 100644
--- a/lib/mozillabzpage.js
+++ b/lib/mozillabzpage.js
@@ -1,13 +1,14 @@
// Released under the MIT/X11 license
// http://www.opensource.org/licenses/mit-license.php
"use strict";
+var utilMod = require("util");
-// ====================================================================================
+// ============================================================================
// MozillaBugzilla object
exports.MozillaBugzilla = function MozillaBugzilla (doc) {
BZPage.call(this, doc)
};
-MozillaBugzilla.prototype = hlpr.heir(BZPage);
+MozillaBugzilla.prototype = utilMod.heir(BZPage);
MozillaBugzilla.prototype.constructor = MozillaBugzilla;
diff --git a/lib/rhbzpage.js b/lib/rhbzpage.js
index f43c1be..b007982 100644
--- a/lib/rhbzpage.js
+++ b/lib/rhbzpage.js
@@ -3,6 +3,7 @@
// Released under the MIT/X11 license
// http://www.opensource.org/licenses/mit-license.php
"use strict";
+var utilMod = require("util");
// var TriagedDistro = 13;
// var NumberOfFrames = 7;
// var XMLRPCurl = "https://bugzilla.redhat.com/xmlrpc.cgi";
@@ -101,7 +102,7 @@ exports.RHBugzillaPage = function RHBugzillaPage(doc) {
}
} // END OF RHBugzillaPage CONSTRUCTOR
-RHBugzillaPage.prototype = hlpr.heir(BZPage);
+RHBugzillaPage.prototype = utilMod.heir(BZPage);
RHBugzillaPage.prototype.constructor = RHBugzillaPage;
/**
@@ -391,7 +392,7 @@ RHBugzillaPage.prototype.pasteBacktraceInComments = function() {
attURL = "https://bugzilla.redhat.com/attachment.cgi?id="
+ x[1];
if (!this.btSnippet) {
- let btRaw = hlpr.loadText(attURL, function(ret) {
+ let btRaw = utilMod.loadText(attURL, function(ret) {
this.btSnippet = this.parseBacktrace(ret);
if (this.btSnippet) {
this.addStuffToTextBox("comment", this.btSnippet);
@@ -411,7 +412,7 @@ RHBugzillaPage.prototype.markBadAttachments = function() {
let badMIMEArray = [ "application/octet-stream", "text/x-log", "undefined" ];
let badAttachments = this.attachments.filter(function(att, idx, arr) {
- return (hlpr.isInList(att[2], badMIMEArray));
+ return (utilMod.isInList(att[2], badMIMEArray));
});
if (badAttachments.length > 0) {
@@ -511,7 +512,7 @@ RHBugzillaPage.prototype.setBranding = function() {
}
// we should make visible whether maintCCAddr is in CCList
- if (hlpr.isInList(this.maintCCAddr, this.CCList)) {
+ if (utilMod.isInList(this.maintCCAddr, this.CCList)) {
let ccEditBoxElem = this.doc.getElementById("cc_edit_area_showhide");
// ccEditBoxElem.textContent = "*"+ccEditBoxElem.textContent;
ccEditBoxElem.style.color = "navy";
@@ -523,7 +524,7 @@ RHBugzillaPage.prototype.setBranding = function() {
let compElems;
let suspiciousComponents = config.gJSONData.configData.suspiciousComponents;
if (suspiciousComponents
- && hlpr.isInList(this.component, suspiciousComponents)
+ && utilMod.isInList(this.component, suspiciousComponents)
&& (compElems = this.doc
.getElementById("bz_component_edit_container"))) {
compElems.style.background = "red none";
diff --git a/lib/util.js b/lib/util.js
index 66976fd..3416b7b 100644
--- a/lib/util.js
+++ b/lib/util.js
@@ -23,7 +23,7 @@ var urlMod = require("url");
* Father.call(this,x);
* this.wife = w;
* }
- * Son.prototype = hlpr.heir(Father);
+ * Son.prototype = heir(Father);
* Son.prototype.constructor = Son;
* </pre>
*/