[ARVADOS] updated: 906a7cae1fc6545750fa0557ea4a055d95f385e8

git at public.curoverse.com git at public.curoverse.com
Fri Mar 7 17:05:11 EST 2014


Summary of changes:
 .../assets/stylesheets/pipeline_templates.css.scss |   27 +++++++
 .../workbench/app/assets/stylesheets/selection.css |   29 +++++++
 .../controllers/pipeline_templates_controller.rb   |   13 +++
 apps/workbench/app/helpers/application_helper.rb   |   35 +++++----
 .../app/helpers/pipeline_instances_helper.rb       |   20 +++++-
 .../app/helpers/pipeline_templates_helper.rb       |   22 ++++++
 .../pipeline_instances/_show_components.html.erb   |   80 +-------------------
 .../pipeline_templates/_show_attributes.html.erb   |   38 ++--------
 .../pipeline_templates/_show_components.html.erb   |    8 ++
 .../_show_components_template.html.erb             |   54 +++++++++++++
 .../pipeline_templates/_show_pipelines.html.erb    |    2 +
 11 files changed, 203 insertions(+), 125 deletions(-)
 create mode 100644 apps/workbench/app/assets/stylesheets/selection.css
 create mode 100644 apps/workbench/app/views/pipeline_templates/_show_components.html.erb
 create mode 100644 apps/workbench/app/views/pipeline_templates/_show_components_template.html.erb
 create mode 100644 apps/workbench/app/views/pipeline_templates/_show_pipelines.html.erb

       via  906a7cae1fc6545750fa0557ea4a055d95f385e8 (commit)
       via  535c58d7e2415a10a81d2d53b41c51709bd7e04f (commit)
       via  ac2db7d4aa32a772d9f21db3f1a8a63b1ad0ca2f (commit)
      from  ec89d136c5ba9beee861391cedb3ec93f28c9109 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 906a7cae1fc6545750fa0557ea4a055d95f385e8
Merge: 535c58d ec89d13
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Fri Mar 7 17:05:59 2014 -0500

    Merge branch '2049-run-job-from-workbench-correct' of git.clinicalfuture.com:arvados into 2049-run-job-from-workbench-correct
    
    # Please enter a commit message to explain why this merge is necessary,
    # especially if it merges an updated upstream into a topic branch.
    #
    # Lines starting with '#' will be ignored, and an empty message aborts
    # the commit.


commit 535c58d7e2415a10a81d2d53b41c51709bd7e04f
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Fri Mar 7 17:04:54 2014 -0500

    render_editable_subattribute() uses link_to_if_arvados_object() if the field is not editable.

diff --git a/apps/workbench/app/helpers/application_helper.rb b/apps/workbench/app/helpers/application_helper.rb
index 6aaa70f..e608572 100644
--- a/apps/workbench/app/helpers/application_helper.rb
+++ b/apps/workbench/app/helpers/application_helper.rb
@@ -137,8 +137,17 @@ module ApplicationHelper
       end
     end
 
-    return template if !object
-    return attrvalue if !object.attribute_editable? attr
+    rsc = template
+    if template.is_a? Hash
+      if template[:value]
+        rsc = template[:value]
+      elsif template[:default]
+        rsc = template[:default]
+      end
+    end
+
+    return link_to_if_arvados_object(rsc) if !object
+    return link_to_if_arvados_object(attrvalue) if !object.attribute_editable? attr
 
     if dataclass
       begin
@@ -146,15 +155,6 @@ module ApplicationHelper
       rescue NameError
       end
     else
-      rsc = template
-      if template.is_a? Hash
-        if template[:value]
-          rsc = template[:value]
-        elsif template[:default]
-          rsc = template[:default]
-        end
-      end
-
       dataclass = ArvadosBase.resource_class_for_uuid(rsc)
     end
 

commit ac2db7d4aa32a772d9f21db3f1a8a63b1ad0ca2f
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Fri Mar 7 16:55:42 2014 -0500

    * Pipeline components are topologically sorted based on :output_of, then sorted lexically.
    * Refactored code to render pipeline components to be consistent across pipeline instance page and pipeline template page.
    * Added "pipelines" tab that shows pipelines that were created from the current template.  Uses the pipeline_instances/show_recent partial.

diff --git a/apps/workbench/app/assets/stylesheets/pipeline_templates.css.scss b/apps/workbench/app/assets/stylesheets/pipeline_templates.css.scss
index 35d2946..c70377a 100644
--- a/apps/workbench/app/assets/stylesheets/pipeline_templates.css.scss
+++ b/apps/workbench/app/assets/stylesheets/pipeline_templates.css.scss
@@ -1,3 +1,30 @@
 // Place all the styles related to the PipelineTemplates controller here.
 // They will automatically be included in application.css.
 // You can use Sass (SCSS) here: http://sass-lang.com/
+
+.pipeline_color_legend {
+    padding-left: 1em;
+    padding-right: 1em;
+}
+
+table.pipeline-components-table {
+  width: 100%;
+  table-layout: fixed;
+  overflow: hidden;
+}
+
+table.pipeline-components-table thead th {
+  text-align: bottom;
+}
+table.pipeline-components-table div.progress {
+  margin-bottom: 0;
+}
+
+table.pipeline-components-table td {
+  overflow: hidden;
+  text-overflow: ellipsis;
+}
+
+td.required {
+  background: #ffdddd;
+}
diff --git a/apps/workbench/app/assets/stylesheets/selection.css b/apps/workbench/app/assets/stylesheets/selection.css
new file mode 100644
index 0000000..147d6fe
--- /dev/null
+++ b/apps/workbench/app/assets/stylesheets/selection.css
@@ -0,0 +1,29 @@
+#persistent-selection-list {
+    width: 500px;
+}
+
+#selection-form-content > li > a, #selection-form-content > li > input {
+    display: block;
+    padding: 3px 20px;
+    clear: both;
+    font-weight: normal;
+    line-height: 1.42857;
+    color: rgb(51, 51, 51);
+    white-space: nowrap;    
+    border: none;
+    background: transparent;
+    width: 100%;
+    text-align: left;
+}
+
+#selection-form-content li table tr {
+    padding: 3px 20px;
+    line-height: 1.42857;
+    border-top: 1px solid rgb(221, 221, 221);
+}
+
+#selection-form-content a:hover, #selection-form-content a:focus, #selection-form-content input:hover, #selection-form-content input:focus, #selection-form-content tr:hover {
+    text-decoration: none;
+    color: rgb(38, 38, 38);
+    background-color: whitesmoke;
+}
\ No newline at end of file
diff --git a/apps/workbench/app/controllers/pipeline_templates_controller.rb b/apps/workbench/app/controllers/pipeline_templates_controller.rb
index fdbebcf..98101b5 100644
--- a/apps/workbench/app/controllers/pipeline_templates_controller.rb
+++ b/apps/workbench/app/controllers/pipeline_templates_controller.rb
@@ -1,2 +1,15 @@
 class PipelineTemplatesController < ApplicationController
+  
+  def show
+    @objects = [] 
+    PipelineInstance.where(pipeline_template_uuid: @object.uuid).each do |pipeline|
+      @objects.push(pipeline)
+    end
+    super
+  end
+
+  def show_pane_list
+    %w(Components Pipelines Attributes Metadata JSON API)
+  end
+
 end
diff --git a/apps/workbench/app/helpers/application_helper.rb b/apps/workbench/app/helpers/application_helper.rb
index 0b78843..6aaa70f 100644
--- a/apps/workbench/app/helpers/application_helper.rb
+++ b/apps/workbench/app/helpers/application_helper.rb
@@ -106,12 +106,14 @@ module ApplicationHelper
   end
 
   def render_editable_subattribute(object, attr, subattr, template, htmloptions={})
-    attrvalue = object.send(attr)
-    subattr.each do |k|
-      if attrvalue and attrvalue.is_a? Hash
-        attrvalue = attrvalue[k]
-      else
-        break
+    if object
+      attrvalue = object.send(attr)
+      subattr.each do |k|
+        if attrvalue and attrvalue.is_a? Hash
+          attrvalue = attrvalue[k]
+        else
+          break
+        end
       end
     end
 
@@ -135,6 +137,7 @@ module ApplicationHelper
       end
     end
 
+    return template if !object
     return attrvalue if !object.attribute_editable? attr
 
     if dataclass
diff --git a/apps/workbench/app/helpers/pipeline_instances_helper.rb b/apps/workbench/app/helpers/pipeline_instances_helper.rb
index d0caf12..c52d339 100644
--- a/apps/workbench/app/helpers/pipeline_instances_helper.rb
+++ b/apps/workbench/app/helpers/pipeline_instances_helper.rb
@@ -28,7 +28,25 @@ module PipelineInstancesHelper
   def pipeline_jobs_newschool object
     ret = []
     i = -1
-    object.components.each do |cname, c|
+
+    comp = []
+
+    template = PipelineTemplate.find(@object.pipeline_template_uuid) rescue nil
+    if template
+      order = PipelineTemplatesHelper::sort_components(template.components)
+      order.each do |k|
+        if object.components[k]
+          comp.push([k, object.components[k]])
+        end
+      end
+    else
+      object.components.each do |k, v|
+        comp.push([k, v])
+      end
+    end
+
+    comp.each do |cname, c|
+      puts cname, c
       i += 1
       pj = {index: i, name: cname}
       pj[:job] = c[:job].is_a?(Hash) ? c[:job] : {}
diff --git a/apps/workbench/app/helpers/pipeline_templates_helper.rb b/apps/workbench/app/helpers/pipeline_templates_helper.rb
index be82878..0540047 100644
--- a/apps/workbench/app/helpers/pipeline_templates_helper.rb
+++ b/apps/workbench/app/helpers/pipeline_templates_helper.rb
@@ -1,2 +1,24 @@
+require 'tsort'
+
+class Hash
+  include TSort
+  def tsort_each_node(&block)
+    keys.sort.each(&block)
+  end
+
+  def tsort_each_child(node)
+    if self[node]
+      self[node][:script_parameters].sort.map do |k, v|
+        if v.is_a? Hash and v[:output_of]
+          yield v[:output_of].to_sym
+        end
+      end
+    end
+  end
+end
+
 module PipelineTemplatesHelper
+  def self.sort_components(components)
+    components.tsort
+  end
 end
diff --git a/apps/workbench/app/views/pipeline_instances/_show_components.html.erb b/apps/workbench/app/views/pipeline_instances/_show_components.html.erb
index 170e3f5..638fb8e 100644
--- a/apps/workbench/app/views/pipeline_instances/_show_components.html.erb
+++ b/apps/workbench/app/views/pipeline_instances/_show_components.html.erb
@@ -1,38 +1,13 @@
 <% content_for :css do %>
-  .pipeline_color_legend {
-    padding-left: 1em;
-    padding-right: 1em;
-  }
-table.pipeline-components-table {
-  width: 100%;
-  table-layout: fixed;
-  overflow: hidden;
-}
-
-table.pipeline-components-table thead th {
-  text-align: bottom;
-}
-table.pipeline-components-table div.progress {
-  margin-bottom: 0;
-}
-
-table.pipeline-components-table td {
-  overflow: hidden;
-  text-overflow: ellipsis;
-}
-
-td.required {
-  background: #ffdddd;
-}
 
 <% end %>
 
-<% template = PipelineTemplate.find(@object.pipeline_template_uuid) %>
+<% template = PipelineTemplate.find(@object.pipeline_template_uuid) rescue nil %>
+
 <%= content_for :content_top do %>
   <% if template %>
     <h2><%= template.name %></h2>
   <% end %>
-  
 <% end %>
 
 <% if @object.active != nil %>
@@ -108,55 +83,6 @@ setInterval(function(){$('a.refresh').click()}, 15000);
     <% end %>
   <% end %>
 
-<table class="table pipeline-components-table" style="margin-top: -.1em">
-  <colgroup>
-    <col style="width: 15%" />
-    <col style="width: 20%" />
-    <col style="width: 20%" />
-    <col style="width: 45%" />
-  </colgroup>
-
-  <thead>
-    <tr>
-      <th>
-        component
-      </th><th>
-        script
-      </th><th>
-        parameter
-      </th><th>
-        value
-      </th>
-    </tr>
-  </thead>
-  <tbody>
-    <% template.components.each do |k, template_value| %>
-
-    <tr>
-      <td><span class="label label-default"><%= k %></span></td>
-
-      <td><%= render_editable_subattribute @object, :components, [k, :script], template_value[:script] %></td>
-
-      <td>script version</td>
-
-      <td>
-        <%= render_editable_subattribute @object, :components, [k, :script_version], template_value[:script_version] %>
-      </td>
-    </tr>
-
-    <% if template_value[:script_parameters].length > 0 %>
-      <% template_value[:script_parameters].each do |p, tv| %>
-        <tr>
-          <td style="border-top: none"></td>
-          <td style="border-top: none"></td>
-          
-          <td class="property-edit-row"><%= p %></td>
-          <td class="property-edit-row"><%= render_editable_subattribute @object, :components, [k, :script_parameters, p.to_sym], tv %></td>
-      <% end %>
-      </tr>
-    <% end %>
-  <% end %>
-  </tbody>
-  </table>
+  <%= render partial: 'pipeline_templates/show_components_template', locals: {:template => template, :obj => @object} %>
   
 <% end %>
diff --git a/apps/workbench/app/views/pipeline_templates/_show_attributes.html.erb b/apps/workbench/app/views/pipeline_templates/_show_attributes.html.erb
index c16229a..cc95b9d 100644
--- a/apps/workbench/app/views/pipeline_templates/_show_attributes.html.erb
+++ b/apps/workbench/app/views/pipeline_templates/_show_attributes.html.erb
@@ -1,39 +1,15 @@
+<%= content_for :content_top do %>
+  <h2>Template '<%= @object.name %>'</h2>
+<% end %>
+
 <table class="table topalign">
   <thead>
   </thead>
   <tbody>
     <% @object.attributes_for_display.each do |attr, attrvalue| %>
-    <% if attr == 'components' and attrvalue.is_a? Hash and attrvalue[:steps].is_a? Array %>
-
-    <tr><td>components[steps]</td><td>
-        <table class="table">
-          <% attrvalue[:steps].each_with_index do |s, i| %>
-          <tr>
-            <td><%= i %></td>
-            <% %w(name function min_revision max_steps_per_node params).each do |key| %>
-            <td>
-              <% if key == 'params' %>
-              <% s[key.to_sym].each do |p| %>
-              <%= p[:name] %>
-              <% if p[:data_locator] || p[:value] %>
-              ← <%= p[:data_locator] || p[:value] %>
-              <% end %>
-              <%= '(optional)' if p[:optional] %>
-              <br />
-              <% end %>
-              <% else %>
-              <%= s[key.to_sym] %>
-              <% end %>
-            </td>
-            <% end %>
-          </tr>
-          <% end %>
-        </table>
-    </td></tr>
-
-    <% else %>
-    <%= render partial: 'application/arvados_object_attr', locals: { attr: attr, attrvalue: attrvalue } %>
-    <% end %>
+      <% if attr != 'components' %>
+        <%= render partial: 'application/arvados_object_attr', locals: { attr: attr, attrvalue: attrvalue } %>
+      <% end %>
     <% end %>
   </tbody>
 </table>
diff --git a/apps/workbench/app/views/pipeline_templates/_show_components.html.erb b/apps/workbench/app/views/pipeline_templates/_show_components.html.erb
new file mode 100644
index 0000000..0d34ba0
--- /dev/null
+++ b/apps/workbench/app/views/pipeline_templates/_show_components.html.erb
@@ -0,0 +1,8 @@
+<% content_for :tab_line_buttons do %>
+  <%= form_tag '/pipeline_instances' do |f| %>
+  <%= hidden_field :pipeline_instance, :pipeline_template_uuid, :value => @object.uuid %>
+  <%= button_tag "Create pipeline", {class: 'btn btn-primary pull-right', id: "run-pipeline-button"} %>
+<% end %>
+<% end %>
+
+<%= render partial: 'pipeline_templates/show_components_template', locals: {:template => @object, :obj => nil} %>
diff --git a/apps/workbench/app/views/pipeline_templates/_show_components_template.html.erb b/apps/workbench/app/views/pipeline_templates/_show_components_template.html.erb
new file mode 100644
index 0000000..718c8c8
--- /dev/null
+++ b/apps/workbench/app/views/pipeline_templates/_show_components_template.html.erb
@@ -0,0 +1,54 @@
+<table class="table pipeline-components-table" style="margin-top: -.1em">
+  <colgroup>
+    <col style="width: 15%" />
+    <col style="width: 20%" />
+    <col style="width: 20%" />
+    <col style="width: 45%" />
+  </colgroup>
+
+  <thead>
+    <tr>
+      <th>
+        component
+      </th><th>
+        script
+      </th><th>
+        parameter
+      </th><th>
+        value
+      </th>
+    </tr>
+  </thead>
+  <tbody>
+    <% order = PipelineTemplatesHelper::sort_components(template.components) %>
+    <% puts "order is #{order}" %>
+    <% order.each do |k| %>
+      <% template_value = template.components[k] %>
+      <% puts "#{k} #{template_value}" %>
+      <% if not template_value then next end %>
+    <tr>
+      <td><span class="label label-default"><%= k %></span></td>
+
+      <td><%= render_editable_subattribute obj, :components, [k, :script], template_value[:script] %></td>
+
+      <td>script version</td>
+
+      <td>
+        <%= render_editable_subattribute obj, :components, [k, :script_version], template_value[:script_version] %>
+      </td>
+    </tr>
+
+    <% if template_value[:script_parameters].length > 0 %>
+      <% template_value[:script_parameters].each do |p, tv| %>
+        <tr>
+          <td style="border-top: none"></td>
+          <td style="border-top: none"></td>
+          
+          <td class="property-edit-row"><%= p %></td>
+          <td class="property-edit-row"><%= render_editable_subattribute obj, :components, [k, :script_parameters, p.to_sym], tv %></td>
+      <% end %>
+      </tr>
+    <% end %>
+  <% end %>
+  </tbody>
+</table>
diff --git a/apps/workbench/app/views/pipeline_templates/_show_pipelines.html.erb b/apps/workbench/app/views/pipeline_templates/_show_pipelines.html.erb
new file mode 100644
index 0000000..8ff42a7
--- /dev/null
+++ b/apps/workbench/app/views/pipeline_templates/_show_pipelines.html.erb
@@ -0,0 +1,2 @@
+
+  <%= render partial: 'pipeline_instances/show_recent' %>

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list