# HG changeset patch # User Atul Varma # Date 1272329102 25200 # Node ID ee0a4597c06792a2d61248bc5253c02960481bd4 # Parent 392fd25a6e2160ec59ce3e773c9ee372c30890cd Added a really basic error log that gets populated when the wrong username/pass is entered. Also, the username/password prompt for login now emphasizes the fact that it is a bugzilla login. diff -r 392fd25a6e21 -r ee0a4597c067 css/main.css --- a/css/main.css Mon Apr 26 16:41:32 2010 -0700 +++ b/css/main.css Mon Apr 26 17:45:02 2010 -0700 @@ -116,6 +116,16 @@ padding: 0.5em; } +#errors { + display: none; + position: fixed; + left: 0px; + bottom: 0px; + padding: 1em; + background: #cc0033; + color: white; +} + .P1.critical, .P1.blocker { color: red; } diff -r 392fd25a6e21 -r ee0a4597c067 index.html --- a/index.html Mon Apr 26 16:41:32 2010 -0700 +++ b/index.html Mon Apr 26 17:45:02 2010 -0700 @@ -44,11 +44,11 @@ page's awesome functionality.

- + - +
UsernameBugzilla Username
PasswordBugzilla Password
@@ -102,7 +102,14 @@ +
+
+
I had trouble talking to Bugzilla. + Perhaps you entered the wrong username/password, or I + messed up.
+
An unknown error occurred.
+
Done. Try reloading this page and see if your problem is fixed.
Hey, that wasn't the right text.
diff -r 392fd25a6e21 -r ee0a4597c067 js/modules/app.js --- a/js/modules/app.js Mon Apr 26 16:41:32 2010 -0700 +++ b/js/modules/app.js Mon Apr 26 17:45:02 2010 -0700 @@ -54,7 +54,43 @@ }; }; +Require.modules["errors"] = function(exports, require) { + var $ = require("jQuery"); + + var errors = $("#errors"); + var messages = $("#templates .errors"); + var lastError = null; + + exports.log = function log(name) { + var message = messages.find("." + name); + if (!message.length) { + exports.log("unknown-error"); + return; + } + if (lastError == message.get(0)) + return; + lastError = message.get(0); + + message = message.clone(); + errors.append(message); + if (errors.children().length == 1) + errors.fadeIn(); + else + message.fadeIn(); + }; +}; + Require.modules["app/bugzilla-auth"] = function(exports, require) { + function onLoad(event) { + var xhr = event.target; + console.log("load", xhr); + } + + function onError(event) { + var xhr = event.target; + require("errors").log("bugzilla-api-error"); + } + exports.create = function(Bugzilla) { function AuthenticatedBugzilla() { this.ajax = function ajax(options) { @@ -67,7 +103,12 @@ options.data.password = user.password; } - return Bugzilla.ajax.call(this, options); + var xhr = Bugzilla.ajax.call(this, options); + + xhr.addEventListener("load", onLoad, false); + xhr.addEventListener("error", onError, false); + + return xhr; }; }