Use a set of datastore objects for all API communication in the JavaScript code

Review Request #1082 — Created Sept. 17, 2009 and submitted — Latest diff uploaded


Review Board


This change introduces datastore.js, which contains all of the actual communication code for our JavaScript (with two exceptions, which I will note in a second).

These new objects give us actual APIs for communicating with objects server-side. The communication logic is hidden inside of these objects, and the rest of the JavaScript code doesn't know a thing about the communication. In the future, this will allow us to add offline support (using either the new client-side storage as part of HTML 5 or Google Gears) much easier.

This is not a complete transition, but it's close. We still have actual queries for two things:

1) Fetching the review form. I plan to rewrite all this separately so it's generated client-side instead of server-side, so this won't be a problem too much longer.

2) Auto-completion of users and groups. We currently go through jQuery.ui.autocomplete, which communicates directly with the server. We may need to write our own autocomplete class, or modify the existing one. As this is no longer shipping with jQuery.ui, we can probably just fork it. This too will happen in a future change.

This also introduces a replacement for our current error banners. We no longer show the error banners on the page, but rather the activity indicator at the top of the screen now turns a reddish color on error and stays on the screen until dismissed or until another operation takes place that would show the banner. The user can click "Show Details" and a form much like the current Server Error Details form will appear. This new form is similar to the old, except it also shows the request data, URL, response code, and response error text.
Tested the following:

* Starring/unstarring review requests and groups
* Modifying review requests
* Publishing and discarding review requests
* Commenting on diffs
* Reading existing comments on diffs
* Publishing new reviews
* Uploading screenshots
* Review request update bubbles
* The new error dialog, accessed from the activity indicator.