Skip to content

Business intelligence made simple

Show dashboards at top of home page

Andrew56b9657e735e
diff --git a/app/assets/stylesheets/blazer/application.css b/app/assets/stylesheets/blazer/application.css
index 095e3cb7..680c50aa 100644
--- a/app/assets/stylesheets/blazer/application.css
+++ b/app/assets/stylesheets/blazer/application.css
@@ -83,3 +83,7 @@ input.search:focus {
overflow: scroll;
text-align: left;
}
+
+.dashboard a {
+ font-weight: bold;
+}
diff --git a/app/controllers/blazer/queries_controller.rb b/app/controllers/blazer/queries_controller.rb
index 6f3a392e..5399ac6a 100644
--- a/app/controllers/blazer/queries_controller.rb
+++ b/app/controllers/blazer/queries_controller.rb
@@ -169,6 +169,7 @@ module Blazer
@queries = @queries.includes(:creator) if Blazer.user_class
@trending_queries = Blazer::Audit.group(:query_id).where("created_at > ?", 2.days.ago).having("COUNT(DISTINCT user_id) >= 3").uniq.count(:user_id)
@checks = Blazer::Check.group(:query_id).count
+ @dashboards = Blazer::Dashboard.order(:name)
end
def set_query
diff --git a/app/views/blazer/queries/_index.html.erb b/app/views/blazer/queries/_index.html.erb
index 9c2c13f7..d48097c5 100644
--- a/app/views/blazer/queries/_index.html.erb
+++ b/app/views/blazer/queries/_index.html.erb
@@ -1,18 +1,21 @@
-<% @queries.each do |query| %>
+<% (@dashboards + @queries).each do |query| %>
+ <% is_query = query.is_a?(Blazer::Query) %>
<tr>
- <td class="query">
+ <td class="query <%= "dashboard" unless is_query %>">
<%= link_to query.name, query %>
- <span style="color: #ccc;"><%= extract_vars(query.statement).join(", ") %></span>
- <% if @queries.size < 1000 && query.created_at > 2.days.ago %>
- <small style="font-weight: bold; color: #5cb85c;">NEW</small>
- <% end %>
- <% if @trending_queries[query.id] %>
- <small style="font-weight: bold; color: #f60;">TRENDING</small>
- <% end %>
- <% if @checks[query.id] %>
- <small style="font-weight: bold; color: #f60;">CHECK</small>
+ <% if is_query %>
+ <span style="color: #ccc;"><%= extract_vars(query.statement).join(", ") %></span>
+ <% if @queries.size < 1000 && query.created_at > 2.days.ago %>
+ <small style="font-weight: bold; color: #5cb85c;">NEW</small>
+ <% end %>
+ <% if @trending_queries[query.id] %>
+ <small style="font-weight: bold; color: #f60;">TRENDING</small>
+ <% end %>
+ <% if @checks[query.id] %>
+ <small style="font-weight: bold; color: #f60;">CHECK</small>
+ <% end %>
+ <div class="hide"><%= query.name.gsub(/\s+/, "") %></div>
<% end %>
- <div class="hide"><%= query.name.gsub(/\s+/, "") %></div>
</td>
<td class="creator text-right text-muted">
<% if query.respond_to?(:creator) && (creator = query.creator) && creator.respond_to?(Blazer.user_name) %>
diff --git a/app/views/blazer/queries/home.html.erb b/app/views/blazer/queries/home.html.erb
index 75492167..e9d9296c 100644
--- a/app/views/blazer/queries/home.html.erb
+++ b/app/views/blazer/queries/home.html.erb
@@ -20,7 +20,7 @@
<table class="table">
<thead>
<tr>
- <th>Query</th>
+ <th>Name</th>
<th style="width: 20%; text-align: right;">Mastermind</th>
</tr>
</thead>