juju/juju-gui — pull request #209 by kadams54 (2014-03-28 16:36:46+00:00)
Title: Clean up State API.

Plunk around with the service inspector, hit refresh, ensure that everything re-renders properly (i.e., the inspector is still displaying the proper service). Repeat for view charm details. Give the public API for State extra scrutiny; methods are:

* `current(field)` - get the specified field for the current state
* `previous(field)` - get the specified field for the previous state
* `hasChanged(field)` - check to see if the field differs between previous and current states
* `getUrl(field)` - generate the proper URL based on the current state (not called directly; subscribes to `viewNavigate` event)
* `loadRequest(request)` - set the current state based on the request passed in
* `save()` - save the current state back to the previous state

Note that the API may be further simplified as we move forward with locating State someplace else other than as a field off Browser. Personally, I'd like to see the last two methods dropped so that clients don't need to actively manage State; it should be more intelligent about when it needs to pull in a new request or save off the current state.