From b917e8a2ebf8c51729ecde1d3cc3396d2fcf0034 Mon Sep 17 00:00:00 2001 From: radhika Date: Fri, 7 Nov 2014 09:06:09 -0500 Subject: [PATCH] 4024: add infinite scrolling to pipeline_instances page. --- .../app/controllers/application_controller.rb | 33 ++++++++++----- .../pipeline_instances/_show_recent.html.erb | 42 ++----------------- .../_show_recent_rows.html.erb | 32 ++++++++++++++ 3 files changed, 58 insertions(+), 49 deletions(-) create mode 100644 apps/workbench/app/views/pipeline_instances/_show_recent_rows.html.erb diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb index 751b494bf4..833294b5b0 100644 --- a/apps/workbench/app/controllers/application_controller.rb +++ b/apps/workbench/app/controllers/application_controller.rb @@ -167,16 +167,29 @@ class ApplicationController < ActionController::Base end def render_index - respond_to do |f| - f.json { render json: @objects } - f.html { - if params[:tab_pane] - render_pane params[:tab_pane] - else - render - end - } - f.js { render } + if params[:partial] + respond_to do |f| + f.json { + @next_page_href = next_page_href(partial: params[:partial]) + render json: { + content: render_to_string(partial: "show_#{params[:partial]}.html", formats: [:html]), + next_page_href: @next_page_href + + } + } + end + else + respond_to do |f| + f.json { render json: @objects } + f.html { + if params[:tab_pane] + render_pane params[:tab_pane] + else + render + end + } + f.js { render } + end end end diff --git a/apps/workbench/app/views/pipeline_instances/_show_recent.html.erb b/apps/workbench/app/views/pipeline_instances/_show_recent.html.erb index f918e24e9d..cc4b957d25 100644 --- a/apps/workbench/app/views/pipeline_instances/_show_recent.html.erb +++ b/apps/workbench/app/views/pipeline_instances/_show_recent.html.erb @@ -1,5 +1,3 @@ -<%= render partial: "paging", locals: {results: @objects, object: @object} %> - <%= form_tag do |f| %> @@ -29,45 +27,11 @@ - - - <% @objects.sort_by { |ob| ob.created_at }.reverse.each do |ob| %> - - - - - - - - - <% end %> + +
- <%= check_box_tag 'uuids[]', ob.uuid, false, :class => 'persistent-selection' %> - - <%= render partial: 'pipeline_status_label', locals: {:p => ob} %> - - <%= link_to_if_arvados_object ob, friendly_name: true %> - - <%= link_to_if_arvados_object ob.pipeline_template_uuid, friendly_name: true %> - - <%= link_to_if_arvados_object ob.owner_uuid, friendly_name: true %> - - <%= ob.created_at.to_s %> - - <%= render partial: 'delete_object_button', locals: {object:ob} %> -
- - <% ob.components.each do |cname, c| %> - <% if c.is_a?(Hash) and c[:job] %> - <%= render partial: "job_progress", locals: {:j => c[:job], :title => cname.to_s, :show_progress_bar => false } %> - <% else %> - <%= cname.to_s %> - <% end %> - <% end %> -
<% end %> - -<%= render partial: "paging", locals: {results: @objects, object: @object} %> diff --git a/apps/workbench/app/views/pipeline_instances/_show_recent_rows.html.erb b/apps/workbench/app/views/pipeline_instances/_show_recent_rows.html.erb new file mode 100644 index 0000000000..e8406dc1c7 --- /dev/null +++ b/apps/workbench/app/views/pipeline_instances/_show_recent_rows.html.erb @@ -0,0 +1,32 @@ +<% @objects.sort_by { |ob| ob.created_at }.reverse.each do |ob| %> + + + <%= check_box_tag 'uuids[]', ob.uuid, false, :class => 'persistent-selection' %> + + <%= render partial: 'pipeline_status_label', locals: {:p => ob} %> + + <%= link_to_if_arvados_object ob, friendly_name: true %> + + <%= link_to_if_arvados_object ob.pipeline_template_uuid, friendly_name: true %> + + <%= link_to_if_arvados_object ob.owner_uuid, friendly_name: true %> + + <%= ob.created_at.to_s %> + + <%= render partial: 'delete_object_button', locals: {object:ob} %> + + + + + + + <% ob.components.each do |cname, c| %> + <% if c.is_a?(Hash) and c[:job] %> + <%= render partial: "job_progress", locals: {:j => c[:job], :title => cname.to_s, :show_progress_bar => false } %> + <% else %> + <%= cname.to_s %> + <% end %> + <% end %> + + +<% end %> -- 2.30.2