Skip to content

Commit

Permalink
Add row_limit settings
Browse files Browse the repository at this point in the history
  • Loading branch information
aki77 committed Nov 17, 2020
1 parent 57e310d commit db9e074
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/controllers/blazer/queries_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ def render_run

respond_to do |format|
format.html do
@rows = @rows.slice(0, Blazer.row_limit) if Blazer.row_limit
render layout: false
end
format.csv do
Expand Down
6 changes: 5 additions & 1 deletion app/views/blazer/queries/run.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@
</p>
<% end %>
<p class="text-muted" style="margin-bottom: 10px;">
<%= pluralize(@rows.size, "row") %>
<% if @result.rows.size != @rows.size %>
<%= pluralize(@rows.size, "row") %> out of <%= pluralize(@result.rows.size, "row") %>
<% else %>
<%= pluralize(@rows.size, "row") %>
<% end %>
<% @checks.select(&:state).each do |check| %>
&middot; <small class="check-state <%= check.state.parameterize.gsub("-", "_") %>"><%= link_to check.state.upcase, edit_check_path(check) %></small>
Expand Down
1 change: 1 addition & 0 deletions lib/blazer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class << self
attr_accessor :override_csp
attr_accessor :slack_webhook_url
attr_accessor :mapbox_access_token
attr_accessor :row_limit
end
self.audit = true
self.user_name = :name
Expand Down
1 change: 1 addition & 0 deletions lib/blazer/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class Engine < ::Rails::Engine
Blazer.from_email = Blazer.settings["from_email"] if Blazer.settings["from_email"]
Blazer.before_action = Blazer.settings["before_action_method"] if Blazer.settings["before_action_method"]
Blazer.check_schedules = Blazer.settings["check_schedules"] if Blazer.settings.key?("check_schedules")
Blazer.row_limit = Blazer.settings["row_limit"] if Blazer.settings["row_limit"]
Blazer.cache ||= Rails.cache

Blazer.anomaly_checks = Blazer.settings["anomaly_checks"] || false
Expand Down
4 changes: 4 additions & 0 deletions lib/generators/blazer/templates/config.yml.tt
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,7 @@ check_schedules:
# url: <%%= ENV["BLAZER_UPLOADS_URL"] %>
# schema: uploads
# data_source: main

# limit of row count in HTML view.
# default is unlimited
# row_limit: 5000

0 comments on commit db9e074

Please sign in to comment.