diff --git a/assets/javascripts/reporting.js b/assets/javascripts/reporting.js index 452df225b7..36568151f8 100644 --- a/assets/javascripts/reporting.js +++ b/assets/javascripts/reporting.js @@ -62,3 +62,6 @@ Reporting.require("filters"); Reporting.require("group_bys"); Reporting.require("restore_query"); Reporting.require("controls"); +Reporting.require("progressbar"); + + diff --git a/assets/javascripts/reporting/controls.js b/assets/javascripts/reporting/controls.js index 7d0411c092..faa6c447fe 100644 --- a/assets/javascripts/reporting/controls.js +++ b/assets/javascripts/reporting/controls.js @@ -115,6 +115,7 @@ Reporting.Controls = { update_result_table: function (response) { $('result-table').update(response.responseText); + Reporting.Progress.attach_listeners(); }, default_failure_callback: function (response) { diff --git a/assets/javascripts/reporting/progressbar.js b/assets/javascripts/reporting/progressbar.js new file mode 100644 index 0000000000..51165a2f64 --- /dev/null +++ b/assets/javascripts/reporting/progressbar.js @@ -0,0 +1,23 @@ +/*jslint white: false, nomen: true, devel: true, on: true, debug: false, evil: true, onevar: false, browser: true, white: false, indent: 2 */ +/*global window, $, $$, Reporting, Effect, Ajax */ + +Reporting.Progress = { + + attach_listeners: function () { + if ($('progressbar') !== null && $('progressbar') !== undefined) { + $('progressbar').select('span[data-load]').each(function (element) { + element.observe("click", function (e) { + if (this.getAttribute("data-load") === "true") { + Reporting.Controls.send_settings_data(this.getAttribute("data-target"), Reporting.Controls.update_result_table); + } else { + $('progressbar').toggle(); + } + }); + }); + } + } +}; + +Reporting.onload(function () { + Reporting.Progress.attach_listeners(); +}); diff --git a/assets/stylesheets/reporting.css b/assets/stylesheets/reporting.css index 9bffd0b6ab..6dc008cb46 100644 --- a/assets/stylesheets/reporting.css +++ b/assets/stylesheets/reporting.css @@ -472,6 +472,13 @@ div.button_form p * { z-index: 999; } +#progressbar { + border: 2px solid #ddd; + padding: 2px; + width: 45%; + background-color: #ededed; +} + /***** Ajax indicator ******/ #ajax-indicator { font-family: Verdana, sans-serif; diff --git a/lib/report/controller.rb b/lib/report/controller.rb index 3804220df9..9abbf2bc2f 100644 --- a/lib/report/controller.rb +++ b/lib/report/controller.rb @@ -14,21 +14,24 @@ module Report::Controller end end - ## - # Render the report. Renders either the complete index or the table only def index table end ## - # Render the table partial, if we are setting filters/groups + # Render the report. Renders either the complete index or the table only def table - if set_filter? - render :partial => 'table' - session[report_engine.name.underscore.to_sym].delete(:name) + if params[:immediately] + table_without_progress_info + else + render :partial => "table", :locals => { :query => @query } if set_filter? end end + def table_without_progress_info + render :partial => 'table_without_progress_info' if set_filter? + end + ## # Create a new saved query. Returns the redirect url to an XHR or redirects directly def create