Fix display order of recent jobs and pipelines. closes #3148
[arvados.git] / apps / workbench / app / controllers / application_controller.rb
index 9eb9978a4bde8436ab316451ddf615046f1b56eb..df57e9e71fa85396d95ee35ed887b466f7d3fb9d 100644 (file)
@@ -145,12 +145,15 @@ class ApplicationController < ActionController::Base
   end
 
   helper_method :next_page_offset
-  def next_page_offset
-    if @objects.respond_to?(:result_offset) and
-        @objects.respond_to?(:result_limit) and
-        @objects.respond_to?(:items_available)
-      next_offset = @objects.result_offset + @objects.result_limit
-      if next_offset < @objects.items_available
+  def next_page_offset objects=nil
+    if !objects
+      objects = @objects
+    end
+    if objects.respond_to?(:result_offset) and
+        objects.respond_to?(:result_limit) and
+        objects.respond_to?(:items_available)
+      next_offset = objects.result_offset + objects.result_limit
+      if next_offset < objects.items_available
         next_offset
       else
         nil
@@ -194,10 +197,7 @@ class ApplicationController < ActionController::Base
         f.json {
           render json: {
             content: render_to_string(partial: "choose_rows.html",
-                                      formats: [:html],
-                                      locals: {
-                                        multiple: params[:multiple]
-                                      }),
+                                      formats: [:html]),
             next_page_href: next_page_href(partial: params[:partial])
           }
         }
@@ -617,8 +617,8 @@ class ApplicationController < ActionController::Base
     (Job.limit(10) |
      PipelineInstance.limit(10)).
       sort_by do |x|
-      x.finished_at || x.started_at || x.created_at rescue x.created_at
-    end
+      (x.finished_at || x.started_at rescue nil) || x.modified_at || x.created_at
+    end.reverse
   end
 
   helper_method :my_project_tree
@@ -880,4 +880,7 @@ class ApplicationController < ActionController::Base
     @objects_for
   end
 
+  def wiselinks_layout
+    'body'
+  end
 end