Merge pull request #25 from rishabhnambiar/show_total_results
Show the number of results after running a query and increase limit to 1000
This commit is contained in:
commit
8f4bb53ac4
|
@ -1,6 +1,7 @@
|
|||
import { ajax } from 'discourse/lib/ajax';
|
||||
import Badge from 'discourse/models/badge';
|
||||
import { getOwner } from 'discourse-common/lib/get-owner';
|
||||
import { default as computed } from 'ember-addons/ember-computed-decorators';
|
||||
|
||||
function randomIdShort() {
|
||||
return 'xxxxxxxx'.replace(/[xy]/g, function() {
|
||||
|
@ -29,8 +30,17 @@ const QueryResultComponent = Ember.Component.extend({
|
|||
columns: Em.computed.alias('content.columns'),
|
||||
params: Em.computed.alias('content.params'),
|
||||
explainText: Em.computed.alias('content.explain'),
|
||||
|
||||
hasExplain: Em.computed.notEmpty('content.explain'),
|
||||
|
||||
@computed('content.result_count')
|
||||
resultCount: function(count) {
|
||||
if (count === 1000) {
|
||||
return I18n.t('explorer.max_result_count', { count });
|
||||
} else {
|
||||
return I18n.t('explorer.result_count', { count });
|
||||
}
|
||||
},
|
||||
|
||||
colCount: function() {
|
||||
return this.get('content.columns').length;
|
||||
}.property('content.columns.length'),
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
</div>
|
||||
|
||||
<div class="result-about">
|
||||
{{resultCount}}
|
||||
{{duration}}
|
||||
</div>
|
||||
|
||||
|
|
|
@ -52,6 +52,12 @@ en:
|
|||
download_csv: "CSV"
|
||||
others_dirty: "A query has unsaved changes that will be lost if you navigate away."
|
||||
run_time: "Query completed in {{value}} ms."
|
||||
result_count:
|
||||
one: "%{count} result."
|
||||
other: "%{count} results."
|
||||
max_result_count:
|
||||
one: "Showing top %{count} results."
|
||||
other: "Showing top %{count} results."
|
||||
query_name: "Query"
|
||||
query_description: "Description"
|
||||
query_time: "Last run"
|
||||
|
|
|
@ -99,7 +99,7 @@ after_initialize do
|
|||
WITH query AS (
|
||||
#{query.sql}
|
||||
) SELECT * FROM query
|
||||
LIMIT #{opts[:limit] || 250}
|
||||
LIMIT #{opts[:limit] || 1000}
|
||||
SQL
|
||||
|
||||
time_start = Time.now
|
||||
|
@ -939,7 +939,7 @@ SQL
|
|||
|
||||
def create
|
||||
# guardian.ensure_can_create_explorer_query!
|
||||
|
||||
|
||||
query = DataExplorer::Query.from_hash params.require(:query)
|
||||
query.created_at = Time.now
|
||||
query.created_by = current_user.id.to_s
|
||||
|
@ -1050,6 +1050,7 @@ SQL
|
|||
success: true,
|
||||
errors: [],
|
||||
duration: (result[:duration_secs].to_f * 1000).round(1),
|
||||
result_count: pg_result.values.length || 0,
|
||||
params: query_params,
|
||||
columns: cols,
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue