aboutsummaryrefslogtreecommitdiffstats
path: root/lib/main.js
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2011-02-01 16:28:51 +0100
committerMatěj Cepl <mcepl@redhat.com>2011-02-01 16:28:51 +0100
commitc1ec772b104316530f6737340355205398df33af (patch)
tree98385a10209cef7ee528fb2d536ef5c15bdf0d7e /lib/main.js
parentab4f262d119fefe06bea938400ee8ff64bed7ab1 (diff)
downloadbugzilla-triage-c1ec772b104316530f6737340355205398df33af.tar.gz
This actually almost looks like working, so much I can file bugs.
Diffstat (limited to 'lib/main.js')
-rw-r--r--lib/main.js47
1 files changed, 33 insertions, 14 deletions
diff --git a/lib/main.js b/lib/main.js
index 0afa67d..bf34514 100644
--- a/lib/main.js
+++ b/lib/main.js
@@ -16,6 +16,10 @@ var self = require("self");
var Request = require("request").Request;
var pageMod = require("page-mod");
var libbz = require("libbugzilla");
+var tabs = require("tabs");
+var logger = require("logger");
+
+var config = {};
function isOurPage(window, matchingURLs) {
var url = window.location.href;
@@ -50,10 +54,22 @@ var messageHandler = exports.messageHandler = function messageHandler(worker, ms
case "ExecCmd":
libbz.executeCommand(msg.data);
break;
+ case "AddLogRecord":
+ logger.addLogRecord(msg.data);
+ break;
+ case "GenerateTS":
+ logger.generateTimeSheet();
+ break;
+ case "ClearTS":
+ logger.clearTimeSheet();
+ break;
+ case "ImportTS":
+ logger.importTimeSheet();
+ break;
case "GetInstalledPackages":
// send message with packages back
console.log("msg = " + msg.toSource());
- libbz.getInstalledPackages(msg.data, function (pkgsMsg) {
+ libbz.getInstalledPackages(msg.data, config, function (pkgsMsg) {
worker.postMessage(pkgsMsg);
});
break;
@@ -85,17 +101,20 @@ var contentScriptLibraries = {
]
};
-libbz.initialize();
-pageMod.PageMod({
- include: [
- "https://bugzilla.redhat.com/show_bug.cgi?id=*"
- ],
- contentScriptWhen: 'ready',
- contentScriptFile: contentScriptLibraries["bugzilla.redhat.com"],
- onAttach: function onAttach(worker, msg) {
- console.log("worker: " + worker);
- worker.on('message', function (msg) {
- messageHandler(worker, msg);
- });
- }
+libbz.initialize(config, function () {
+ pageMod.PageMod({
+ include: [
+ "https://bugzilla.redhat.com/show_bug.cgi?id=*"
+ ],
+ contentScriptWhen: 'ready',
+ contentScriptFile: contentScriptLibraries["bugzilla.redhat.com"],
+ onAttach: function onAttach(worker, msg) {
+ console.log("worker: " + worker);
+ worker.on('message', function (msg) {
+ messageHandler(worker, msg);
+ });
+ }
+ });
});
+
+tabs.open("https://bugzilla.redhat.com/show_bug.cgi?id=673153");