2872: Add recent jobs and pipelines to folder index, use as root url.
authorTom Clegg <tom@curoverse.com>
Mon, 2 Jun 2014 07:16:08 +0000 (03:16 -0400)
committerTom Clegg <tom@curoverse.com>
Mon, 2 Jun 2014 07:16:08 +0000 (03:16 -0400)
apps/workbench/app/controllers/application_controller.rb
apps/workbench/app/views/folders/_index_jobs_and_pipelines.html.erb [new file with mode: 0644]
apps/workbench/app/views/folders/index.html.erb
apps/workbench/config/routes.rb

index c1e82eb621617f807187833827b2d7c0036a6c21..4347b9b7185182faefbb661ac04227f879ba43b3 100644 (file)
@@ -496,6 +496,14 @@ class ApplicationController < ActionController::Base
     end
   end
 
+  helper_method :recent_jobs_and_pipelines
+  def recent_jobs_and_pipelines
+    (Job.limit(10) | PipelineInstance.limit(10)).
+      sort_by do |x|
+      x.finished_at || x.started_at || x.created_at rescue x.created_at
+    end
+  end
+
   helper_method :get_object
   def get_object uuid
     if @get_object.nil? and @objects
diff --git a/apps/workbench/app/views/folders/_index_jobs_and_pipelines.html.erb b/apps/workbench/app/views/folders/_index_jobs_and_pipelines.html.erb
new file mode 100644 (file)
index 0000000..fb688b4
--- /dev/null
@@ -0,0 +1,21 @@
+<div class="container-fluid">
+  <% recent_jobs_and_pipelines[0..9].each do |object| %>
+    <% any = true %>
+    <div class="row">
+      <div class="col-sm-4">
+        <%= render :partial => "show_object_button", :locals => {object: object, size: 'xs'} %>
+        <%= render_editable_attribute object, 'name', nil %>
+      </div>
+      <div class="col-sm-8 arv-description-in-table">
+        <%= render_controller_partial(
+            'show_object_description_cell.html',
+            controller_name: object.controller_name,
+            locals: {object: object})
+            %>
+      </div>
+    </div>
+  <% end %>
+  <% if not defined? any %>
+    <span class="deemphasize">No jobs or pipelines to display.</span>
+  <% end %>
+</div>
index 7666e546110199715db2d897e6a1fe754782f4a2..5197f8467716c58f3d21dc27241e64c85e51aabb 100644 (file)
       </div>
     </div>
   </div>
+  <div class="row">
+    <div class="col-sm-12">
+      <div class="panel panel-default">
+        <div class="panel-heading">
+          <div class="pull-right">
+            <%= link_to jobs_path, class: 'btn btn-default btn-xs' do %>
+              All jobs <i class="fa fa-fw fa-arrow-circle-right"></i>
+            <% end %>
+            <%= link_to pipeline_instances_path, class: 'btn btn-default btn-xs' do %>
+              All pipelines <i class="fa fa-fw fa-arrow-circle-right"></i>
+            <% end %>
+          </div>
+          <h3 class="panel-title">
+            Recent jobs and pipelines
+          </h3>
+        </div>
+        <div class="panel-body">
+          <%= render partial: 'index_jobs_and_pipelines' %>
+        </div>
+      </div>
+    </div>
+  </div>
 </div>
index a28cc69b89bd2c0f040017d5a395ab8ac24c2131..94e2a115293a86090a484a74b5516a0c6aba7e40 100644 (file)
@@ -62,7 +62,7 @@ ArvadosWorkbench::Application.routes.draw do
   post 'actions' => 'actions#post'
   get 'websockets' => 'websocket#index'
 
-  root :to => 'users#welcome'
+  root :to => 'folders#index'
 
   # Send unroutable requests to an arbitrary controller
   # (ends up at ApplicationController#render_not_found)