So, you made a change to your dashboard, and now you have to run all over the building, plugging in a keyboard, and reloading the dashboard on the various TVs in your office. What if you could reload all the dashboard from the comfort of your desk?
Add this widget to the very bottom of your dashboard, after the "gridster" div:
<div class="gridster">
<ul>
<li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
<div data-view="Image" data-image="/benbria/loop.png" style="background-color:#666766"></div>
</li>
<!-- Blah blah blah - widgets go here -->
</ul>
</div>
<!-- Special reload widget, doesn't display on the page. -->
<div data-id="reload" data-view="RemoteReload" style="padding: 0px"></div>
Note the style="padding: 0px"
; this is important to make the widget take up no space on the page. Now you can use curl to remotely force all dashboards to reload their page:
curl -d '{ "auth_token": "YOUR_AUTH_TOKEN" }' \http://mydashboard.server.com/widgets/reload
You can also install this across all your dashboards by modifying layout.erb:
<div id="container">
<%= yield %>
<div data-id="reload" data-view="RemoteReload" style="padding: 0px"></div>
</div>
Ugh. This "command" thing is a bit of a hack. Without it, though, I've run into cases where we see the dashboard reload continuously.
I wonder if we could store a timestamp when "ready()" gets called, and then not do the reload unless onData() is called more than 30 (?) seconds afterwards? This way an onData() from Dashing right at load time would be ignored (you probably don't want to reload the dashboard if it was just reloaded anyways.) I suspect this would mostly work, but likely would force a dashboard reload if the dashing server ever goes down and comes back up (although that's maybe not a bad thing...) Thoughts?