[ARVADOS] created: cc6c230a91c01c03c9d7455bead45715037b4b95

Git user git at public.curoverse.com
Fri Aug 19 13:55:21 EDT 2016


        at  cc6c230a91c01c03c9d7455bead45715037b4b95 (commit)


commit cc6c230a91c01c03c9d7455bead45715037b4b95
Author: radhika <radhika at curoverse.com>
Date:   Fri Aug 19 13:54:19 2016 -0400

    9767: include workflows in the template chooser.

diff --git a/apps/workbench/app/controllers/work_unit_templates_controller.rb b/apps/workbench/app/controllers/work_unit_templates_controller.rb
new file mode 100644
index 0000000..b9a92b0
--- /dev/null
+++ b/apps/workbench/app/controllers/work_unit_templates_controller.rb
@@ -0,0 +1,30 @@
+class WorkUnitTemplatesController < ApplicationController
+  def find_objects_for_index
+    return if !params[:partial]
+
+    @limit = 20
+    @filters = @filters || []
+
+    # get next page of pipeline_templates
+    filters = @filters + [["uuid", "is_a", ["arvados#pipelineTemplate"]]]
+    pipelines = PipelineTemplate.limit(@limit).order(["created_at desc"]).filter(filters)
+
+    # get next page of workflows
+    filters = @filters + [["uuid", "is_a", ["arvados#workflow"]]]
+    workflows = Workflow.limit(@limit).order(["created_at desc"]).filter(filters)
+
+    @objects = (pipelines.to_a + workflows.to_a).sort_by(&:created_at).reverse.first(@limit)
+ 
+    if @objects.any?
+      @next_page_filters = next_page_filters('<=')
+      @next_page_href = url_for(partial: :choose_rows,
+                                filters: @next_page_filters.to_json)
+    else
+      @next_page_href = nil
+    end
+  end
+
+  def next_page_href with_params={}
+    @next_page_href
+  end
+end
diff --git a/apps/workbench/app/views/application/_choose_rows.html.erb b/apps/workbench/app/views/application/_choose_rows.html.erb
new file mode 100644
index 0000000..9b96b47
--- /dev/null
+++ b/apps/workbench/app/views/application/_choose_rows.html.erb
@@ -0,0 +1,8 @@
+<% @objects.each do |object| %>
+  <div class="row filterable selectable" data-object-uuid="<%= object.uuid %>" data-preview-href="<%= url_for object %>?tab_pane=chooser_preview">
+    <div class="col-sm-12" style="overflow-x:hidden">
+      <i class="fa fa-fw fa-gear"></i>
+      <%= object.name %>
+    </div>
+  </div>
+<% end %>
diff --git a/apps/workbench/app/views/projects/_show_dashboard.html.erb b/apps/workbench/app/views/projects/_show_dashboard.html.erb
index afca246..0b0b7e8 100644
--- a/apps/workbench/app/views/projects/_show_dashboard.html.erb
+++ b/apps/workbench/app/views/projects/_show_dashboard.html.erb
@@ -7,6 +7,18 @@
             <span class="pull-right recent-processes-actions">
               <span>
                 <%= link_to(
+                choose_work_unit_templates_path(
+                  title: 'Choose a process to run:',
+                  action_name: 'Next: choose inputs <i class="fa fa-fw fa-arrow-circle-right"></i>',
+                  action_href: pipeline_instances_path,
+                  action_method: 'post',
+                  action_data: {'selection_param' => 'pipeline_instance[pipeline_template_uuid]', 'pipeline_instance[owner_uuid]' => current_user.uuid, 'success' => 'redirect-to-created-object'}.to_json),
+                { class: "btn btn-primary btn-xs", remote: true }) do %>
+                  <i class="fa fa-fw fa-gear"></i> Run a process...
+                <% end %>
+              </span>
+              <span>
+                <%= link_to(
                 choose_pipeline_templates_path(
                   title: 'Choose a pipeline to run:',
                   action_name: 'Next: choose inputs <i class="fa fa-fw fa-arrow-circle-right"></i>',
diff --git a/apps/workbench/app/views/workflows/_show_chooser_preview.html.erb b/apps/workbench/app/views/workflows/_show_chooser_preview.html.erb
new file mode 100644
index 0000000..ebdd0ba
--- /dev/null
+++ b/apps/workbench/app/views/workflows/_show_chooser_preview.html.erb
@@ -0,0 +1,4 @@
+<div class="col-sm-11 col-sm-push-1 arv-description-in-table">
+  <%= @object.description %>
+</div>
+<%= render partial: 'show_workflow' %>
diff --git a/apps/workbench/app/views/workflows/_show_workflow.html.erb b/apps/workbench/app/views/workflows/_show_workflow.html.erb
new file mode 100644
index 0000000..1215864
--- /dev/null
+++ b/apps/workbench/app/views/workflows/_show_workflow.html.erb
@@ -0,0 +1,3 @@
+<div>
+  <span class="editable editable-done-setup editable-pre-wrapped" data-emptytext="(none)" data-type="textarea"><%=@object.workflow%></span>
+</div>
diff --git a/apps/workbench/config/routes.rb b/apps/workbench/config/routes.rb
index 5d02e57..bc45a4b 100644
--- a/apps/workbench/config/routes.rb
+++ b/apps/workbench/config/routes.rb
@@ -14,6 +14,7 @@ ArvadosWorkbench::Application.routes.draw do
   post "report_issue" => 'actions#report_issue', :as => :report_issue
   get "star" => 'actions#star', :as => :star
   get "all_processes" => 'work_units#index', :as => :all_processes
+  get "choose_work_unit_templates" => 'work_unit_templates#choose', :as => :choose_work_unit_templates
   resources :nodes
   resources :humans
   resources :traits

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list