Business intelligence made simple
Show dashboards on home page
Andrew Kanefb19415fe99f
diff --git a/app/controllers/blazer/dashboards_controller.rb b/app/controllers/blazer/dashboards_controller.rbindex 5785f301..607511ff 100644--- a/app/controllers/blazer/dashboards_controller.rb+++ b/app/controllers/blazer/dashboards_controller.rb@@ -3,7 +3,7 @@ module Blazerbefore_action :set_dashboard, only: [:show, :edit, :update, :destroy, :refresh]def index- @dashboards = Blazer::Dashboard.order(:name)+ redirect_to root_path(filter: "dashboards")enddef newdiff --git a/app/controllers/blazer/queries_controller.rb b/app/controllers/blazer/queries_controller.rbindex 682e240e..01ce4bdd 100644--- a/app/controllers/blazer/queries_controller.rb+++ b/app/controllers/blazer/queries_controller.rb@@ -3,9 +3,13 @@ module Blazerbefore_action :set_query, only: [:show, :edit, :update, :destroy, :refresh]def home- set_queries(1000)+ if params[:filter] == "dashboards"+ @queries = []+ else+ set_queries(1000)+ end- if params[:filter]+ if params[:filter] && params[:filter] != "dashboards"@dashboards = [] # TODO show my dashboardselse@dashboards = Blazer::Dashboard.order(:name)diff --git a/app/views/blazer/_nav.html.erb b/app/views/blazer/_nav.html.erbindex a9d76f1f..7a558306 100644--- a/app/views/blazer/_nav.html.erb+++ b/app/views/blazer/_nav.html.erb@@ -5,7 +5,6 @@<span class="sr-only">Toggle Dropdown</span></button><ul class="dropdown-menu">- <li><%= link_to "Dashboards", dashboards_path %></li><li><%= link_to "Checks", checks_path %></li><li role="separator" class="divider"></li><li><%= link_to "New Query", new_query_path %></li>diff --git a/app/views/blazer/dashboards/index.html.erb b/app/views/blazer/dashboards/index.html.erbdeleted file mode 100644index 85c98755..00000000--- a/app/views/blazer/dashboards/index.html.erb+++ /dev/null@@ -1,19 +0,0 @@-<% blazer_title "Dashboards" %>--<p style="float: right;"><%= link_to "New Dashboard", new_dashboard_path, class: "btn btn-info" %></p>-<%= render partial: "blazer/nav" %>--<table class="table">- <thead>- <tr>- <th>Dashboard</th>- </tr>- </thead>- <tbody>- <% @dashboards.each do |dashboard| %>- <tr>- <td><%= link_to dashboard.name, dashboard %></td>- </tr>- <% end %>- </tbody>-</table>diff --git a/app/views/blazer/queries/home.html.erb b/app/views/blazer/queries/home.html.erbindex ed8bd53e..6cb07a1c 100644--- a/app/views/blazer/queries/home.html.erb+++ b/app/views/blazer/queries/home.html.erb@@ -10,6 +10,7 @@<%= link_to "Mine", root_path(filter: "mine"), class: params[:filter] == "mine" ? "active" : nil, style: "margin-right: 40px;" %><% end %>+ <%= link_to "Dashboards", root_path(filter: "dashboards"), class: params[:filter] == "dashboards" ? "active" : nil, style: "margin-right: 40px;" %><div class="btn-group"><%= link_to "New Query", new_query_path, class: "btn btn-info" %><button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">@@ -17,11 +18,10 @@<span class="sr-only">Toggle Dropdown</span></button><ul class="dropdown-menu">- <li><%= link_to "Dashboards", dashboards_path %></li>- <li><%= link_to "Checks", checks_path %></li>- <li role="separator" class="divider"></li><li><%= link_to "New Dashboard", new_dashboard_path %></li><li><%= link_to "New Check", new_check_path %></li>+ <li role="separator" class="divider"></li>+ <li><%= link_to "Checks", checks_path %></li></ul></div></div>