Skip to content
This repository was archived by the owner on Dec 7, 2021. It is now read-only.

Add a parameter to display graphite source or not #107

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/gdash/sinatra_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ def initialize(graphite_base, graph_templates, options = {})
# Dashboard title
@dash_title = options.delete(:title) || "Graphite Dashboard"

# Display the source of the data, only if explicitly set
@source_displayed = options.delete(:source_displayed) ? true : false

# Time filters in interface
@interval_filters = options.delete(:interval_filters) || Array.new

Expand Down Expand Up @@ -231,7 +234,7 @@ def initialize(graphite_base, graph_templates, options = {})
@graphs = @dashboard.graphs(options)

if !query_params[:print]
erb :dashboard
erb :dashboard, :locals => {:source_displayed => @source_displayed}
else
erb :print_dashboard, :layout => false
end
Expand Down
2 changes: 2 additions & 0 deletions views/dashboard.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
<h1><%= @dashboard.name %>&nbsp;<small><%= @dashboard.description %></small></h1>
</div>
<div class="span4">
<%if @source_displayed %>
<small>Source: <a class="muted" href="<%[email protected]_render.sub("/render","")%>"><%[email protected]_render.sub("/render","")%></a></small>
<% end %>
</div>
</div>
<div class="row-fluid">
Expand Down