Dynamically reload the dashboard contents without a page refresh.
Review Request #4175 — Created May 26, 2013 and submitted
Dynamically reload the dashboard contents without a page refresh. The dashboard contents are now dynamically loaded every 5 minutes. We fetch the entire page and just extract the dashboard content (including sidebar) and replace the current content with it. We replace the Edit Columns pencil icon with a spinner during reload. One of the nice advantages to this is that if the server goes down at all while the client is trying to reload, the worst that happens is they get an HTTP 404/500/whatever error in the console log/network inspector. The fetch will be tried again at the next 5 minute mark. The sidebar count calculations have been moved into the view. It's been made a bit smarter there. We don't attempt to calculate if we're only fetching the datagrid (due to reload, reordering of columns, etc.), cutting down on queries.
Tested with a short timer, and saw the two loads. Tested with the server down. No user-facing errors outside of the console log. It kept trying until the server was up. Tested bumping review request counts and updating the dashboard. Saw the updates at the next reload cycle.
- Change Summary:
-
We only do one page load now, instead of two. We just replace the entire dashboard in one go. Also, a spinner was added during load.
- Description:
-
Dynamically reload the dashboard contents without a page refresh.
The dashboard contents are now dynamically loaded every 5 minutes.
~ We first fetch the sidebar contents, and if that succeeds, we trigger ~ a reload of the dashboard contents. ~ We fetch the entire page and just extract the dashboard content ~ (including sidebar) and replace the current content with it. + + We replace the Edit Columns pencil icon with a spinner during reload.
One of the nice advantages to this is that if the server goes down at
all while the client is trying to reload, the worst that happens is they get an HTTP 404/500/whatever error in the console log/network inspector. The fetch will be tried again at the next 5 minute mark. The sidebar count calculations have been moved into the view. It's been
made a bit smarter there. We don't attempt to calculate if we're only fetching the datagrid (due to reload, reordering of columns, etc.), cutting down on queries.
-
This is a review from Review Bot. Tool: PEP8 Style Checker Processed Files: reviewboard/reviews/views.py reviewboard/reviews/templatetags/reviewtags.py reviewboard/reviews/datagrids.py Ignored Files: reviewboard/templates/reviews/dashboard.html