10645: container request mounts display
[arvados.git] / apps / workbench / app / helpers / application_helper.rb
index 21879a57a7d90aa77ba0f90e6a325f9ae9d5f00c..411280293529ad6eb2c191407aaf3217a895c7d6 100644 (file)
@@ -274,10 +274,10 @@ module ApplicationHelper
       "data-placement" => "bottom",
       "data-type" => input_type,
       "data-title" => "Edit #{attr.to_s.gsub '_', ' '}",
-      "data-name" => attr,
+      "data-name" => htmloptions['selection_name'] || attr,
       "data-object-uuid" => object.uuid,
       "data-toggle" => "manual",
-      "data-value" => attrvalue,
+      "data-value" => htmloptions['data-value'] || attrvalue,
       "id" => span_id,
       :class => "editable #{is_textile?( object, attr ) ? 'editable-textile' : ''}"
     }.merge(htmloptions).merge(ajax_options)
@@ -584,6 +584,30 @@ module ApplicationHelper
     end
   end
 
+  # yields collection id (pdh or uuid), and full file_path
+  def cwl_input_collections(path, &b)
+    case path
+    when ArvadosBase
+      path.class.columns.each do |c|
+        cwl_input_collections(path[c.name.to_sym], &b)
+      end
+    when Hash
+      path.each do |k, v|
+        cwl_input_collections(v, &b)
+      end
+    when Array
+      path.each do |v|
+        cwl_input_collections(v, &b)
+      end
+    when String
+      if m = /[a-f0-9]{32}\+\d+/.match(path)
+        yield m[0], path.split('keep:')[-1]
+      elsif m = /[0-9a-z]{5}-4zz18-[0-9a-z]{15}/.match(path)
+        yield m[0], path.split('keep:')[-1]
+      end
+    end
+  end
+
   def render_arvados_object_list_start(list, button_text, button_href,
                                        params={}, *rest, &block)
     show_max = params.delete(:show_max) || 3
@@ -607,6 +631,7 @@ module ApplicationHelper
 
   RESOURCE_CLASS_ICONS = {
     "Collection" => "fa-archive",
+    "ContainerRequest" => "fa-gears",
     "Group" => "fa-users",
     "Human" => "fa-male",  # FIXME: Use a more inclusive icon.
     "Job" => "fa-gears",
@@ -621,6 +646,7 @@ module ApplicationHelper
     "Trait" => "fa-clipboard",
     "User" => "fa-user",
     "VirtualMachine" => "fa-terminal",
+    "Workflow" => "fa-gears",
   }
   DEFAULT_ICON_CLASS = "fa-cube"