9043: Remove non-existent "Graph" tab. Fix "false" selection dropdown. Use
authorPeter Amstutz <peter.amstutz@curoverse.com>
Thu, 25 Aug 2016 15:25:03 +0000 (11:25 -0400)
committerPeter Amstutz <peter.amstutz@curoverse.com>
Thu, 25 Aug 2016 15:58:11 +0000 (11:58 -0400)
helper function instead of duplicating regex.

apps/workbench/app/controllers/container_requests_controller.rb
apps/workbench/app/helpers/application_helper.rb

index 34f892a8362b597aed4189442b3dc177ee9bd421..54e59144e7873648ac149d4c4898905e9bd260b2 100644 (file)
@@ -5,8 +5,8 @@ class ContainerRequestsController < ApplicationController
   }
 
   def show_pane_list
-    panes = %w(Status Log Graph Advanced)
-    if @object and @object.state == 'Uncommitted'
+    panes = %w(Status Log Advanced)
+    if @object.andand.state == 'Uncommitted'
       panes = %w(Inputs) + panes - %w(Log)
     end
     panes
@@ -27,23 +27,25 @@ class ContainerRequestsController < ApplicationController
     if input_obj
       workflow = @object.mounts[:"/var/lib/cwl/workflow.json"][:content]
       workflow[:inputs].each do |input_schema|
-        if input_obj.include? input_schema[:id]
-          required, primary_type, param_id = cwl_input_info(input_schema)
-          if input_obj[param_id] == ""
-            input_obj[param_id] = nil
-          elsif primary_type == "boolean"
-            input_obj[param_id] = input_obj[param_id] == "true"
-          elsif ["int", "long"].include? primary_type
-            input_obj[param_id] = input_obj[param_id].to_i
-          elsif ["float", "double"].include? primary_type
-            input_obj[param_id] = input_obj[param_id].to_f
-          elsif ["File", "Directory"].include? primary_type
-            input_obj[param_id].match /^([0-9a-z]{5}-([0-9a-z]{5})-[0-9a-z]{15})(\/.*)?$/ do |re|
-              c = display_value = Collection.find(re[1])
-              input_obj[param_id] = {"class" => primary_type,
-                                     "location" => "keep:#{c.portable_data_hash}#{re[3]}",
-                                     "arv:collection" => input_obj[param_id]}
-            end
+        if not input_obj.include? input_schema[:id]
+          next
+        end
+        required, primary_type, param_id = cwl_input_info(input_schema)
+        if input_obj[param_id] == ""
+          input_obj[param_id] = nil
+        elsif primary_type == "boolean"
+          input_obj[param_id] = input_obj[param_id] == "true"
+        elsif ["int", "long"].include? primary_type
+          input_obj[param_id] = input_obj[param_id].to_i
+        elsif ["float", "double"].include? primary_type
+          input_obj[param_id] = input_obj[param_id].to_f
+        elsif ["File", "Directory"].include? primary_type
+          re = CollectionsHelper.match_uuid_with_optional_filepath(input_obj[param_id])
+          if re
+            c = Collection.find(re[1])
+            input_obj[param_id] = {"class" => primary_type,
+                                   "location" => "keep:#{c.portable_data_hash}#{re[4]}",
+                                   "arv:collection" => input_obj[param_id]}
           end
         end
       end
index 27c7504ebbe04a4105907a28b7d4f1cedaca5781..ec2e93fc167aa7f33d674df0507c2000eef644d8 100644 (file)
@@ -503,7 +503,7 @@ module ApplicationHelper
         end
       end
     elsif "boolean" == primary_type
-      return link_to attrvalue, '#', {
+      return link_to attrvalue.to_s, '#', {
                      "data-emptytext" => "none",
                      "data-placement" => "bottom",
                      "data-type" => "select",
@@ -512,7 +512,7 @@ module ApplicationHelper
                      "data-title" => "Set value for #{input_schema[:id]}",
                      "data-name" => dn,
                      "data-pk" => "{id: \"#{object.uuid}\", key: \"#{object.class.to_s.underscore}\"}",
-                     "data-value" => attrvalue,
+                     "data-value" => attrvalue.to_s,
                      # "clear" button interferes with form-control's up/down arrows
                      "data-clear" => false,
                      :class => "editable #{'required' if required} form-control",