Open aalpern opened 10 years ago
Client side routing uses the HTML5 browser history API to integrate in-page state changes with the browser history (i.e. "the back button"). Given the in-page nature of transforms, it's necessary to allow linking to a transform (and for generate sanity -- after digging in to a transform, the back button should not take the user back to the dashboard list, but to the pre-transform state)
Here are some random noodlings on what client-side routed URLs should look like:
Base dashboard URL:
/dashboards/3/detailed-overview
/dashboards/:id/:slug
Time-shifting first graph:
/dashboards/3/detailed-overview/d3/transform/time_shift
General transform routing:
/dashboards/:id/:slug/:item-id/transform/:transform-name?from=:from-time
window.location
URL and apply any transform indicated there. A router component can probably handle most of that mechanism for usWe can continue to control visibility using data attributes; can effectively have multi-valent visibility attribute using CSS substring matching operators:
[data-ds-visible-in-mode*="transform"]
for strict substring matching, or use the ~=
operator for whitespace-separated matching.
transform
mode
edit
mode
The behavior described here is now functionally pretty much complete, but the implementation is pretty ad-hoc and a bit messy. Going to leave this open for a while, or punt it to R2 or R3 for later cleanup. I think nearly all the UI needs to come client-side so it's all routed.
Basic layout transforms are in place on the client side - having them as part of the JavaScript model works best. Right now a layout class is super-simple; it takes a dashboard item (such as the definition) and returns another dashboard item with the contents re-arranged. Number of column switching is handled this way.
Notes
Rename layouts to transforms - the one convention can cover basic re-layout (i.e. column switching) and drill-downs, where we take one graph and get more detail on it.Transformed items and Queries
Dashboard items currently have aquery_name
to reference a query stored in thedashboard_definition
.That needs to optionally have an immediate query object instead, as some of the transforms will need to transform the query as well as the presentation (i.e. time-shifting, expanding to multiple time scales, etc...Oh, that means thatds.models.data.Query
needs to have optionsfrom
/until
fields as well) for showing the same metric over multiple time scalesUsage
Add an attribute to transforms indicating whether they apply to individual items or dashboards? (i.e. purely layouts vs. drilldowns)Management
DashboardManager
but cleaner) to handle transforms, and managing browser history API.Navigation
In order to display a proper breadcrumb navigation trail for drilldowns, we're going to need to move the breadcrumb template client-side as well.
(at this point, it looks like almost all the UI will client-side eventually, leaving the server side code to handle API, persistence, and serving static assets).