diff options
author | Matěj Cepl <mcepl@redhat.com> | 2011-01-28 16:38:36 +0100 |
---|---|---|
committer | Matěj Cepl <mcepl@redhat.com> | 2011-01-31 20:33:33 +0100 |
commit | 4a0bcc39b1e1b49dcaa0aa2ab674c6f1ba51e9e5 (patch) | |
tree | 642411d3b3b433e8903e0bbbbf46004a37477b58 /lib/libbugzilla.js | |
parent | 83a7d703cbabd6e514a6d8a948b39325b59e9f58 (diff) | |
download | bugzilla-triage-4a0bcc39b1e1b49dcaa0aa2ab674c6f1ba51e9e5.tar.gz |
Tons of fixes, we are almost in state that the primitive run is possible.
TOOD:
* The most important part is we have to run libbz.initialize() and wait
until it is done.
Diffstat (limited to 'lib/libbugzilla.js')
-rw-r--r-- | lib/libbugzilla.js | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/lib/libbugzilla.js b/lib/libbugzilla.js index ceea270..e074072 100644 --- a/lib/libbugzilla.js +++ b/lib/libbugzilla.js @@ -7,7 +7,7 @@ var preferences = require("preferences-service"); var prompts = require("prompts"); var clipboard = require("clipboard"); var tabs = require("tabs"); -var logger = require("logger"); +//var logger = require("logger"); var passUtils = require("passwords"); var Request = require("request").Request; @@ -18,6 +18,16 @@ var BTSPassRealm = "BTSXMLRPCPass"; var config = {}; +function Message(cmd, data) { + console.log("Message: cmd = " + cmd + ", data = " + data); + this.cmd = cmd; + this.data = data; +} + +function log(msg) { + postMessage(new Message("LogMessage", msg)); +} + /** * parse XML object out of string working around various bugs in Gecko implementation * see https://developer.mozilla.org/en/E4X for more information @@ -115,8 +125,12 @@ exports.changeJSONURL = function changeJSONURL() { exports.getInstalledPackages = function getInstalledPackages(location, callback) { var installedPackages = {}; var enabledPackages = []; + + console.log("location = " + location.toString()); + console.log("location = " + typeof location); // Collect enabled packages per hostname (plus default ones) + console.log("getInstalledPackages: config = " + config.toSource()); if (config.gJSONData && ("commentPackages" in config.gJSONData)) { if ("enabledPackages" in config.gJSONData.configData) { var epObject = config.gJSONData.configData.enabledPackages; @@ -135,9 +149,12 @@ exports.getInstalledPackages = function getInstalledPackages(location, callback) } } + console.log("getInstalledPackages: enabledPackages = " + enabledPackages.toSource()); + // TODO To be decided, whether we cannot just eliminate packages in // installedPackages and having it just as a plain list of all cmdObjects. enabledPackages.forEach(function (pkg, idx, arr) { + console.log("getInstalledPackages: pkg = " + pkg); if (pkg in config.gJSONData.commentPackages) { installedPackages[pkg] = config.gJSONData.commentPackages[pkg]; } @@ -145,14 +162,20 @@ exports.getInstalledPackages = function getInstalledPackages(location, callback) } // Expand commentIdx properties into full comments - installedPackages.forEach(function (pkg) { - pkg.forEach(function (cmdObj) { + console.log("before // installedPackages = " + installedPackages.toSource()); + var cmdObj = {}; + for (var pkgKey in installedPackages) { + for (var cmdObjKey in installedPackages[pkgKey]) { + cmdObj = installedPackages[pkgKey][cmdObjKey]; if ("commentIdx" in cmdObj) { cmdObj.comment = config.commentStrings[cmdObj.commentIdx]; delete cmdObj.commentIdx; } - }); - }); + } + } + + console.log("after // installedPackages = " + installedPackages.toSource()); + callback(new Message("CreateButtons", { instPkgs: installedPackages, constData: config.constantData @@ -264,10 +287,11 @@ function initialize() { if ("killNodes" in config.gJSONData.configData && window.location.hostname in config.gJSONData.configData.killNodes) { var killConf = config.gJSONData.configData.killNodes[window.location.hostname]; - util.killNodes(config.doc, killConf[0], killConf[1]); + killNodes(config.doc, killConf[0], killConf[1]); } } + callback(); } }).get(); } |