From 74d98b5f5cfee651eebfd8c63842a08241dcd736 Mon Sep 17 00:00:00 2001 From: radhika Date: Fri, 5 May 2017 15:30:46 -0400 Subject: [PATCH] 10112: add Definition tab to workflow page --- .../app/controllers/workflows_controller.rb | 4 + .../views/workflows/_show_definition.html.erb | 86 +++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 apps/workbench/app/views/workflows/_show_definition.html.erb diff --git a/apps/workbench/app/controllers/workflows_controller.rb b/apps/workbench/app/controllers/workflows_controller.rb index a3ba7d66a5..49dd7ac055 100644 --- a/apps/workbench/app/controllers/workflows_controller.rb +++ b/apps/workbench/app/controllers/workflows_controller.rb @@ -3,4 +3,8 @@ class WorkflowsController < ApplicationController Rails.configuration.anonymous_user_token and 'show' == ctrl.action_name } + + def show_pane_list + %w(Definition Advanced) + end end diff --git a/apps/workbench/app/views/workflows/_show_definition.html.erb b/apps/workbench/app/views/workflows/_show_definition.html.erb new file mode 100644 index 0000000000..f36264783f --- /dev/null +++ b/apps/workbench/app/views/workflows/_show_definition.html.erb @@ -0,0 +1,86 @@ +<% + wf_def = ActiveSupport::HashWithIndifferentAccess.new YAML::load(@object.definition) if @object.definition + wf_def = wf_def[:"$graph"].andand[0] || wf_def if wf_def + + items = {} + baseCommand = wf_def.andand["baseCommand"] + items['baseCommand'] = baseCommand if baseCommand + + args = wf_def.andand["arguments"] + items['arguments'] = args if args + + hints = wf_def.andand["hints"] + items['hints'] = hints if hints + + inputs = wf_def.andand["inputs"] + items['inputs'] = inputs if inputs + + outputs = wf_def.andand["outputs"] + items['outputs'] = outputs if outputs +%> + +
+ + + + + <% items.each do |k, v| %> + <% if ['baseCommand', 'arguments'].include? k %> + + + + + <% end %> + + <% if ['inputs', 'outputs'].include? k %> + + + + + <% end %> + + <% if k == 'hints' %> + + + + + <% end %> + <% end %> +
+ <%= k %>: + +
+ <%=v%> +
+
+ <%= k %>: + + <% val = JSON.pretty_generate(v) %> +
+ <% val.each_line do |l| %> + <% text_part = l %> + <% match = l.match /\"keep:.*?\"/ %> + <% if match %> + <% text_part = l[0..l.index("\"keep:")-1] %> + <% loc_part = match[0][6..-2] %> + <% end %> + <%= text_part %><%= if loc_part then link_to_arvados_object_if_readable(loc_part, loc_part, friendly_name: true) end %> <% if loc_part then %>
<% end %>
+ <% end %> +
+
+ <%= k %>: + + <% val = JSON.pretty_generate(v) %> +
+ <% val.each_line do |l| %> + <% text_part = l %> + <% match = l.match /\"keep:.*?\"/ %> + <% if match %> + <% text_part = l[0..l.index("\"keep:")-1] %> + <% loc_part = match[0][6..-2] %> + <% end %> + <%= text_part %><%= if loc_part then link_to_arvados_object_if_readable(loc_part, loc_part, friendly_name: true) end %> <% if loc_part then %>
<% end %>
+ <% end %> +
+
+
-- 2.30.2