myexperiment-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[myexperiment-hackers] [3654] branches/packs: added hardware / software


From: noreply
Subject: [myexperiment-hackers] [3654] branches/packs: added hardware / software requirements annotations
Date: Mon, 2 Sep 2013 01:37:12 +0000 (UTC)

Revision
3654
Author
dgc
Date
2013-09-02 01:37:12 +0000 (Mon, 02 Sep 2013)

Log Message

added hardware / software requirements annotations

Modified Paths

Diff

Modified: branches/packs/app/controllers/packs_controller.rb (3653 => 3654)


--- branches/packs/app/controllers/packs_controller.rb	2013-09-02 01:34:10 UTC (rev 3653)
+++ branches/packs/app/controllers/packs_controller.rb	2013-09-02 01:37:12 UTC (rev 3654)
@@ -499,6 +499,9 @@
     unless @item.is_folder
       @title = @statements.query(address@hidden, RDF::DC.title, nil]).first_value || @item.folder_entry.entry_name
       @description = @statements.query(address@hidden, RDF::DC.description, nil]).first_value
+      @input_files_for_this_workflow = @statements.query(address@hidden, RDF::URI("http://purl.org/wf4ever/roterms#inputSelected"), nil]).objects
+      @requires_hardware = @statements.query(address@hidden, RDF::URI("http://purl.org/wf4ever/roterms#requiresHardware"), nil]).objects
+      @requires_software = @statements.query(address@hidden, RDF::URI("http://purl.org/wf4ever/roterms#requiresSoftware"), nil]).objects
     end
 
     unless @item

Modified: branches/packs/app/views/annotations/_form.html.erb (3653 => 3654)


--- branches/packs/app/views/annotations/_form.html.erb	2013-09-02 01:34:10 UTC (rev 3653)
+++ branches/packs/app/views/annotations/_form.html.erb	2013-09-02 01:37:12 UTC (rev 3654)
@@ -8,12 +8,19 @@
   <% annotation_template["parameters"].each do |parameter| %>
     <tr>
       <td><%= parameter["label"] -%></td>
-      <% case parameter["type"] ; when "string" %>
-        <td><%= text_field_tag(parameter["symbol"], values[parameter["symbol"]]) -%></td>
-      <% when "textarea" %>
-        <td><%= text_area_tag(parameter["symbol"], values[parameter["symbol"]]) -%></td>
-      <% when "resource" %>
-        <td><%= text_field_tag(parameter["symbol"], values[parameter["symbol"]]) -%></td>
+      <% if values[parameter["symbol"]] %>
+        <td>
+          <%=h values[parameter["symbol"]] -%>
+          <%= hidden_field_tag(parameter["symbol"], values[parameter["symbol"]]) -%>
+        </td>
+      <% else %>
+        <% case parameter["type"] ; when "string" %>
+          <td><%= text_field_tag(parameter["symbol"], values[parameter["symbol"]]) -%></td>
+        <% when "textarea" %>
+          <td><%= text_area_tag(parameter["symbol"], values[parameter["symbol"]]) -%></td>
+        <% when "resource" %>
+          <td><%= select_tag(parameter["symbol"], options_for_select(research_object.ore_resources.map { |r| [r[:name], r[:ore_path]] })) -%></td>
+        <% end %>
       <% end %>
     </tr>
   <% end %>

Modified: branches/packs/app/views/annotations/new.html.erb (3653 => 3654)


--- branches/packs/app/views/annotations/new.html.erb	2013-09-02 01:34:10 UTC (rev 3653)
+++ branches/packs/app/views/annotations/new.html.erb	2013-09-02 01:37:12 UTC (rev 3654)
@@ -2,6 +2,7 @@
 
 <% form_tag(pack_annotations_path(@pack)) do |f| -%>
   <%= render(:partial => "form", :locals => {
+      :research_object => @pack.research_object,
       :template => params[:template],
       :annotation_template => @annotation_template,
       :values => params } ) -%>

Modified: branches/packs/app/views/packs/item_show.html.erb (3653 => 3654)


--- branches/packs/app/views/packs/item_show.html.erb	2013-09-02 01:34:10 UTC (rev 3653)
+++ branches/packs/app/views/packs/item_show.html.erb	2013-09-02 01:37:12 UTC (rev 3654)
@@ -7,7 +7,7 @@
     <td>Title</td>
     <td>
       <%=h @title -%>
-      <%= link_to('[Add title]', new_pack_annotation_path(@pack, { :template => 'title', :resource => @item.ore_path })) -%>
+      [<%= link_to('Add title', new_pack_annotation_path(@pack, { :template => 'title', :resource => @item.ore_path })) -%>]
     </td>
   </tr>
   <tr>
@@ -28,16 +28,49 @@
   </tr>
 </table>
 
-<h2>Description</h2>
-
 <% if @description %>
+  <h2>Description</h2>
   <p><%=h simple_format(@description) -%></p>
 <% end %>
 
-<p><%= link_to('[Add description]', new_pack_annotation_path(@pack, { :template => 'description', :resource => @item.ore_path })) -%></p>
+<% unless @input_files_for_this_workflow.empty? %>
+  <h2>Input files</h2>
+  <ul>
+    <% @input_files_for_this_workflow.each do |input| %>
+      <li><%= link_to(h(input.to_s), input.to_s) -%></li>
+    <% end %>
+  </ul>
+<% end %>
 
-<h1>Debug</h1>
+<% unless @requires_hardware.empty? %>
+  <h2>Hardware requirements</h2>
+  <ul>
+    <% @requires_hardware.each do |hardware| %>
+      <li><%=h hardware -%></li>
+    <% end %>
+  </ul>
+<% end %>
 
+<% unless @requires_software.empty? %>
+  <h2>Software requirements</h2>
+  <ul>
+    <% @requires_software.each do |software| %>
+      <li><%=h software -%></li>
+    <% end %>
+  </ul>
+<% end %>
+
+<h2>Actions</h2>
+
+<ul>
+<li>[<%= link_to('Add description', new_pack_annotation_path(@pack, { :template => 'description', :resource => @item.ore_path })) -%>]</li>
+<li>[<%= link_to("Select an input file", new_pack_annotation_path(@pack, { :template => 'input_selection_relationship', :workflow => @item.ore_path })) -%>]</li>
+<li>[<%= link_to("Add new hardware requirement", new_pack_annotation_path(@pack, { :template => 'requires_hardware', :resource => @item.ore_path })) -%>]</li>
+<li>[<%= link_to("Add new software requirement", new_pack_annotation_path(@pack, { :template => 'requires_software', :resource => @item.ore_path })) -%>]</li>
+</ul>
+
+<h2>Debug</h2>
+
 <div id="tabsContainer" class="tabsContainer"></div>
   
 <div class="tabContainer">

Modified: branches/packs/config/default_settings.yml (3653 => 3654)


--- branches/packs/config/default_settings.yml	2013-09-02 01:34:10 UTC (rev 3653)
+++ branches/packs/config/default_settings.yml	2013-09-02 01:37:12 UTC (rev 3654)
@@ -1500,18 +1500,18 @@
 
     - label:  Workflow
       type:   resource
-      symbol: :subject
+      symbol: :workflow
 
     - label:  Input file
       type:   resource
-      symbol: :object
+      symbol: :input
 
     required_statements:
-    - [:subject, "<http://purl.org/wf4ever/roterms#inputSelected>", :object]
+    - [:workflow, "<http://purl.org/wf4ever/roterms#inputSelected>", :input]
 
     targets:
-    - :subject
-    - :object
+    - :workflow
+    - :input
 
   title:
 
@@ -1553,6 +1553,46 @@
     targets:
     - :resource
 
+  requires_hardware:
+
+    label: requires hardware
+
+    parameters:
+
+    - label:  Resource
+      type:   resource 
+      symbol: :resource
+
+    - label:  Hardware
+      type:   string 
+      symbol: :hardware
+
+    required_statements:
+    - [:resource, "<http://purl.org/wf4ever/roterms#requiresHardware>", :hardware]
+
+    targets:
+    - :resource
+
+  requires_software:
+
+    label: requires software
+
+    parameters:
+
+    - label:  Resource
+      type:   resource 
+      symbol: :resource
+
+    - label:  Software
+      type:   string 
+      symbol: :software
+
+    required_statements:
+    - [:resource, "<http://purl.org/wf4ever/roterms#requiresSoftware>", :software]
+
+    targets:
+    - :resource
+
 wf_ro_service_uri: "http://www.example.com/wf-ro/jobs"
 wf_ro_service_bearer_token: "bearer-token"
 

Modified: branches/packs/lib/authorization.rb (3653 => 3654)


--- branches/packs/lib/authorization.rb	2013-09-02 01:34:10 UTC (rev 3653)
+++ branches/packs/lib/authorization.rb	2013-09-02 01:37:12 UTC (rev 3654)
@@ -385,6 +385,11 @@
 
         case action
 
+          when "create"
+
+            # Only users that can edit the pack can create RO resources
+            return Authorization.check('edit', context, user)
+
           when "view"
 
             # You can only view a pack resource if you can view the pack
@@ -399,11 +404,6 @@
 
             return true
 
-          when "create"
-
-            # Only users that can edit the pack can create RO resources
-            return Authorization.check('edit', object.research_object.pack, user)
-
           when "destroy"
 
             # Only users that can edit the pack can delete RO resources

reply via email to

[Prev in Thread] Current Thread [Next in Thread]