begin a 'progress' widget implementation for displaying progress and aborting on LARGE commits

pull/6827/head
Tim Felgentreff 14 years ago
parent 6b7a6d9f10
commit 6493c5ed04
  1. 1
      assets/javascripts/reporting.js
  2. 9
      assets/javascripts/reporting/table.js
  3. 8
      lib/report.rb
  4. 4
      lib/report/controller.rb
  5. 20
      lib/widget/table/progressbar.rb

@ -27,6 +27,7 @@ Reporting.require("filters");
Reporting.require("group_bys");
Reporting.require("restore_query");
Reporting.require("controls");
Reporting.require("table");
//
// function hide_category(tr_field) {

@ -0,0 +1,9 @@
/*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.Table = {
};
Reporting.onload(function () {
Reporting.RestoreQuery.restore_group_bys();
});

@ -123,7 +123,7 @@ class Report < ActiveRecord::Base
def_delegators :transformer, :column_first, :row_first
def_delegators :chain, :empty_chain, :top, :bottom, :chain_collect, :sql_statement, :all_group_fields, :child, :clear, :result
def_delegators :result, :each_direct_result, :recursive_each, :recursive_each_with_level, :each, :each_row, :count,
:units, :size, :final_number
:units, :final_number
def_delegators :table, :row_index, :colum_index
def to_a
@ -134,6 +134,12 @@ class Report < ActiveRecord::Base
chain.to_s
end
def size
size = 0
recursive_each {|r| size += r.size }
size
end
def hash
report_string = ""

@ -29,6 +29,10 @@ module Report::Controller
render :partial => 'table' if set_filter?
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

@ -0,0 +1,20 @@
class Widget::Table::Progressbar < Widget::Base
attr_accessor :threshhold
def render
@threshhold ||= 5
size = @query.size
content_tag :div, :class => "progressbar", :style => "display:none",
:"data-query-size" => size do
if size > @threshhold
content_tag :div, :id => "progressbar-load-table-question" do
tag(:span, ::I18n.t(:load_query_question, size), :id => "progressbar-text")
tag(:span, ::I18n.t(:label_yes), :id => "progressbar-yes")
tag(:span, ::I18n.t(:label_no), :id => "progressbar-no")
end
else
tag :span, :id => "progressbar-load-table-directly"
end
end
end
end
Loading…
Cancel
Save