9767: add a link to workflow in the container_request#show page.
authorradhika <radhika@curoverse.com>
Tue, 30 Aug 2016 14:45:20 +0000 (10:45 -0400)
committerradhika <radhika@curoverse.com>
Tue, 30 Aug 2016 14:45:20 +0000 (10:45 -0400)
apps/workbench/app/models/container_work_unit.rb
apps/workbench/app/views/application/_name_and_description.html.erb
apps/workbench/app/views/application/_object_description.html.erb [new file with mode: 0644]
apps/workbench/app/views/application/_object_name.html.erb [new file with mode: 0644]
apps/workbench/app/views/container_requests/_name_and_description.html.erb [new file with mode: 0644]
apps/workbench/test/integration/application_layout_test.rb

index 1ed182c35f8482e39537e0591c849f8538d5934f..e56c0655234cb598aecaf917abb3c3cca59f3156 100644 (file)
@@ -145,7 +145,7 @@ class ContainerWorkUnit < ProxyWorkUnit
   def template_uuid
     properties = get(:properties)
     if properties
-      properties[:workflow_uuid]
+      properties[:template_uuid]
     end
   end
 
index 68a201f19542d71b1fa78e662b3ddcea4b0603fe..78b6f8b135f9e1424bc00c46262a47da71c03b9f 100644 (file)
@@ -1,11 +1,2 @@
-<% if @object.respond_to? :name %>
-  <h2>
-    <%= render_editable_attribute @object, 'name', nil, { 'data-emptytext' => "New #{controller.model_class.to_s.underscore.gsub("_"," ")}" } %>
-  </h2>
-<% end %>
-
-<% if @object.respond_to? :description %>
-  <div class="arv-description-as-subtitle">
-    <%= render_editable_attribute @object, 'description', nil, { 'data-emptytext' => "(No description provided)", 'data-toggle' => 'manual' } %>
-  </div>
-<% end %>
+<%= render partial: 'object_name' %>
+<%= render partial: 'object_description' %>
diff --git a/apps/workbench/app/views/application/_object_description.html.erb b/apps/workbench/app/views/application/_object_description.html.erb
new file mode 100644 (file)
index 0000000..7260940
--- /dev/null
@@ -0,0 +1,5 @@
+<% if @object.respond_to? :description %>
+  <div class="arv-description-as-subtitle">
+    <%= render_editable_attribute @object, 'description', nil, { 'data-emptytext' => "(No description provided)", 'data-toggle' => 'manual' } %>
+  </div>
+<% end %>
diff --git a/apps/workbench/app/views/application/_object_name.html.erb b/apps/workbench/app/views/application/_object_name.html.erb
new file mode 100644 (file)
index 0000000..b303853
--- /dev/null
@@ -0,0 +1,5 @@
+<% if @object.respond_to? :name %>
+  <h2>
+    <%= render_editable_attribute @object, 'name', nil, { 'data-emptytext' => "New #{controller.model_class.to_s.underscore.gsub("_"," ")}" } %>
+  </h2>
+<% end %>
diff --git a/apps/workbench/app/views/container_requests/_name_and_description.html.erb b/apps/workbench/app/views/container_requests/_name_and_description.html.erb
new file mode 100644 (file)
index 0000000..f409519
--- /dev/null
@@ -0,0 +1,21 @@
+<%
+  wu = @object.work_unit
+  template_uuid = wu.template_uuid
+  template = Workflow.find?(template_uuid) if template_uuid
+  div_class = "col-sm-12"
+  div_class = "col-sm-6" if template
+%>
+
+<div class="<%=div_class%>">
+  <%= render partial: 'object_name' %>
+  <%= render partial: 'object_description' %>
+</div>
+
+<% if template %>
+  <div class="alert alert-info <%=div_class%>">
+     This container request was created from the workflow <%= link_to_if_arvados_object template, friendly_name: true %><br />
+     <% if template.modified_at && (template.modified_at > @object.created_at) %>
+        Note: This workflow has been modified since this container request was created.
+     <% end %>
+  </div>
+<% end %>
index 686b63b526aaeadd9a04508ed87e2b6a93cfa214..f4221a91d868c719f74506be9789a2ad3703cc46 100644 (file)
@@ -358,6 +358,7 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
 
       # in the process page now
       assert_text process_txt
+      assert_selector 'a', text: template_name
     end
   end
 end