Skip to content
mikeycgto edited this page Dec 2, 2012 · 4 revisions

Setting the View Path

You must set the view_path option for the Batsd::Dash.config hash in order to use this feature.

The simplest case is to just define one or more HAML template files in the same directory as your rackup file. For this case the view_path would be set to File.expand_path('..', __FILE__).

Creating Pages

Custom pages must be valid HAML. You can specific graph class elements that will be converted into graphs by the frontend. The code will also look for certain data-attributes to use when building the graphs and requesting the data.

For example:

## requests.haml
%h5 Request Graphs

.graph{'data-counters' => 'requests', 'data-start' => Time.now.to_i - (60*60*1), 'data-stop' => Time.now.to_i}

.graph{'data-counters' => 'requests', 'data-timers' => 'request.time:mean'}

This page is now accessible via /requests route on the dashboard.

These pages can run arbitrary Ruby code (as shown above) and also have access to Sinatra's params hash.

Clone this wiki locally