aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2010-06-16 10:36:13 +0200
committerMatěj Cepl <mcepl@redhat.com>2010-06-16 10:36:13 +0200
commit21374b14830837fe525046c1a77a4b61f31df6fa (patch)
tree2901376c5b97e82413a1b97e6c187236c047843b /lib
parent9c56aebdc7182fab939c900a6cf9580f38855f32 (diff)
downloadbugzilla-triage-21374b14830837fe525046c1a77a4b61f31df6fa.tar.gz
Port bugfixes from the -prototype branch. simpleStorage is apparently
not that simple and it will need to be fixed.
Diffstat (limited to 'lib')
-rw-r--r--lib/bzpage.js5
-rw-r--r--lib/logger.js12
-rw-r--r--lib/main.js20
-rw-r--r--lib/rhbzpage.js28
4 files changed, 45 insertions, 20 deletions
diff --git a/lib/bzpage.js b/lib/bzpage.js
index 8f11eb5..aebcac6 100644
--- a/lib/bzpage.js
+++ b/lib/bzpage.js
@@ -664,11 +664,6 @@ BZPage.prototype.setUpLogging = function() {
console.log("this.store wiped out!");
}, false);
- if (!this.store) {
- console.log("No this.store defined!");
- this.store = {};
- }
-
if (this.log.store.length > 0) {
clearLogAElem.style.color = this.log.FullLogsColor;
clearLogAElem.style.fontWeight = "bolder";
diff --git a/lib/logger.js b/lib/logger.js
index 6bd8142..8481f66 100644
--- a/lib/logger.js
+++ b/lib/logger.js
@@ -25,19 +25,21 @@ Logger.prototype.addLogRecord = function(that) {
let recKey = utilMod.getISODate(rec.date) + "+"
+ urlMod.parse(rec.url).host
+ "+" + that.bugNo;
+ console.log("rec = " + rec.toSource());
+
let clearLogAElem = that.doc.getElementById("clearLogs");
- clearLogAElem.style.color = this.FullLogsColor;
- clearLogAElem.style.fontWeight = "bolder";
+ if (clearLogAElem.style.color != this.FullLogsColor) {
+ clearLogAElem.style.color = this.FullLogsColor;
+ clearLogAElem.style.fontWeight = "bolder";
+ }
if (this.store[recKey]) {
this.store[recKey].comment += "<br/>\n" + comment;
} else {
this.store[recKey] = rec;
}
jetpack.storage.simple.sync();
- return rec;
- } else {
- return comment;
}
+ return comment;
};
Logger.prototype.getBugzillaAbbr = function(url) {
diff --git a/lib/main.js b/lib/main.js
index 365d445..ac2fd04 100644
--- a/lib/main.js
+++ b/lib/main.js
@@ -15,7 +15,20 @@
var util = require("util");
var logger = require("logger");
var file = require("file");
+
+// FIXME this apparently is not good, properties of the object
+// itself must be set, not variable referring to it
var myStorage = require("simple-storage").storage;
+// FIXME we should follow private browsing state
+/*
+simpleStorage.storage.history = [];
+var privateBrowsing = require("private-browsing");
+if (!privateBrowsing.active) {
+ var url = getSelectedTabURL();
+ simpleStorage.storage.history.push(url);
+}
+
+*/
var TriagedDistro = 13;
var NumberOfFrames = 7;
@@ -83,12 +96,19 @@ util.loadJSON(jetpack.storage.settings.JSONURL, function(parsedData) {
for (let key in config.gJSONData) {
keys += key + " ";
}
+ console.log("keys = " + keys);
+
if ("PCIIDsURL" in config.gJSONData.configData) {
util.loadJSON(config.gJSONData.configData.PCIIDsURL, function(response) {
config.PCI_ID_Array = response;
});
}
+ if (!myStorage.logs) {
+ console.log("No store for logs defined!");
+ myStorage.logs = {};
+ }
+
config.logger = new logger.Logger(myStorage.logs,
config.gJSONData.constantData.bugzillalabelAbbreviations);
diff --git a/lib/rhbzpage.js b/lib/rhbzpage.js
index c9d9b9f..9f8a39f 100644
--- a/lib/rhbzpage.js
+++ b/lib/rhbzpage.js
@@ -7,6 +7,7 @@ var util = require("util");
var xrpc = require("xmlrpc");
var xhr = require("xhr");
var clip = require("clipboard");
+var selection = require("selection");
// var TriagedDistro = 13;
// var NumberOfFrames = 7;
// var XMLRPCurl = "https://bugzilla.redhat.com/xmlrpc.cgi";
@@ -182,6 +183,7 @@ RHBugzillaPage.prototype.closeSomeRelease = function() {
* Additional commands specific for this subclass, overriding superclass one.
*/
RHBugzillaPage.prototype.centralCommandDispatch = function(cmdLabel, cmdParams) {
+ console.log("cmdLabel = " + cmdLabel + ", cmdParams = " + cmdParams);
switch (cmdLabel) {
// Set up our own commands
case "closeUpstream":
@@ -193,7 +195,7 @@ RHBugzillaPage.prototype.centralCommandDispatch = function(cmdLabel, cmdParams)
case "queryStringOurBugzilla":
this.queryForSelection();
break;
- case "queryUpstreamBugzilla":
+ case "queryStringUpstreamBugzilla":
this.queryUpstream();
break;
case "sendBugUpstream":
@@ -586,14 +588,23 @@ RHBugzillaPage.prototype.queryInNewTab = function(text, component, product) {
* Get the text to search for and prepare other things for the real executive
* function this.queryInNewTab, and run it.
*/
-RHBugzillaPage.prototype.queryForSelection = function() {
- let text = jetpack.selection.text;
+RHBugzillaPage.prototype.getSelectionOrClipboard = function() {
+ var text = selection.text;
console.log("selection = " + text);
if (!text) {
text = clip.get();
console.log("clipboard = " + text);
}
console.log("text = " + text);
+ return text;
+};
+
+/**
+ * Get the text to search for and prepare other things for the real executive
+ * function this.queryInNewTab, and run it.
+ */
+RHBugzillaPage.prototype.queryForSelection = function() {
+ var text = this.getSelectionOrClipboard();
if (text) {
this.queryInNewTab(text, this.component);
}
@@ -603,12 +614,9 @@ RHBugzillaPage.prototype.queryForSelection = function() {
* Search simple query in the upstream bugzilla appropriate for the component.
*/
RHBugzillaPage.prototype.queryUpstream = function() {
- let text = jetpack.selection.text;
- if (!text) {
- text = clip.get();
- }
+ var text = this.getSelectionOrClipboard();
if (text) {
- let text = encodeURIComponent(text.trim());
+ text = encodeURIComponent(text.trim());
let queryUpstreamBugsURLArray = this.constantData.queryUpstreamBug;
let url = util.filterByRegexp(queryUpstreamBugsURLArray, this.component);
jetpack.tabs.open(url + text);
@@ -619,8 +627,8 @@ RHBugzillaPage.prototype.queryUpstream = function() {
*
*/
RHBugzillaPage.prototype.sendBugUpstream = function() {
- let url = util.filterByRegexp(this.constantData.newUpstreamBug, this
- .getOptionValue("component"));
+ var url = util.filterByRegexp(this.constantData.newUpstreamBug,
+ this.component);
let ret = jetpack.tabs.open(url);
let that = this;