DEV: Replace hardcoded result limit with a module constant
This commit is contained in:
parent
f1b33cc64e
commit
8720c2cd5c
|
@ -34,7 +34,7 @@ const QueryResultComponent = Ember.Component.extend({
|
||||||
|
|
||||||
@computed("content.result_count")
|
@computed("content.result_count")
|
||||||
resultCount: function(count) {
|
resultCount: function(count) {
|
||||||
if (count === 1000) {
|
if (count === this.get("content.result_limit")) {
|
||||||
return I18n.t("explorer.max_result_count", { count });
|
return I18n.t("explorer.max_result_count", { count });
|
||||||
} else {
|
} else {
|
||||||
return I18n.t("explorer.result_count", { count });
|
return I18n.t("explorer.result_count", { count });
|
||||||
|
|
|
@ -21,6 +21,8 @@ end
|
||||||
add_admin_route 'explorer.title', 'explorer'
|
add_admin_route 'explorer.title', 'explorer'
|
||||||
|
|
||||||
module ::DataExplorer
|
module ::DataExplorer
|
||||||
|
QUERY_RESULT_MAX_LIMIT = 1000
|
||||||
|
|
||||||
def self.plugin_name
|
def self.plugin_name
|
||||||
'discourse-data-explorer'.freeze
|
'discourse-data-explorer'.freeze
|
||||||
end
|
end
|
||||||
|
@ -109,7 +111,7 @@ after_initialize do
|
||||||
WITH query AS (
|
WITH query AS (
|
||||||
#{query.sql}
|
#{query.sql}
|
||||||
) SELECT * FROM query
|
) SELECT * FROM query
|
||||||
LIMIT #{opts[:limit] || 1000}
|
LIMIT #{opts[:limit] || DataExplorer::QUERY_RESULT_MAX_LIMIT}
|
||||||
SQL
|
SQL
|
||||||
|
|
||||||
time_start = Time.now
|
time_start = Time.now
|
||||||
|
@ -1102,6 +1104,7 @@ SQL
|
||||||
result_count: pg_result.values.length || 0,
|
result_count: pg_result.values.length || 0,
|
||||||
params: query_params,
|
params: query_params,
|
||||||
columns: cols,
|
columns: cols,
|
||||||
|
result_limit: DataExplorer::QUERY_RESULT_MAX_LIMIT
|
||||||
}
|
}
|
||||||
json[:explain] = result[:explain] if opts[:explain]
|
json[:explain] = result[:explain] if opts[:explain]
|
||||||
ext = DataExplorer.add_extra_data(pg_result)
|
ext = DataExplorer.add_extra_data(pg_result)
|
||||||
|
|
Loading…
Reference in New Issue