From cb258002ed789c7ecb62a4d4188cd724fe32873c Mon Sep 17 00:00:00 2001 From: aki Date: Sat, 17 Apr 2021 13:39:55 +0900 Subject: [PATCH] Add row_limit settings --- app/controllers/blazer/queries_controller.rb | 1 + lib/blazer.rb | 1 + lib/blazer/engine.rb | 1 + lib/generators/blazer/templates/config.yml.tt | 4 ++++ 4 files changed, 7 insertions(+) diff --git a/app/controllers/blazer/queries_controller.rb b/app/controllers/blazer/queries_controller.rb index d71b33a95..4e2ce8614 100644 --- a/app/controllers/blazer/queries_controller.rb +++ b/app/controllers/blazer/queries_controller.rb @@ -278,6 +278,7 @@ def render_run respond_to do |format| format.html do + @row_limit ||= Blazer.row_limit if Blazer.row_limit render layout: false end format.csv do diff --git a/lib/blazer.rb b/lib/blazer.rb index 9928c9a1f..0bfa0e524 100644 --- a/lib/blazer.rb +++ b/lib/blazer.rb @@ -59,6 +59,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 diff --git a/lib/blazer/engine.rb b/lib/blazer/engine.rb index b01d24068..bb06e0fe2 100644 --- a/lib/blazer/engine.rb +++ b/lib/blazer/engine.rb @@ -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 diff --git a/lib/generators/blazer/templates/config.yml.tt b/lib/generators/blazer/templates/config.yml.tt index 65230e654..0f1084cac 100644 --- a/lib/generators/blazer/templates/config.yml.tt +++ b/lib/generators/blazer/templates/config.yml.tt @@ -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