myexperiment-hackers
[Top][All Lists]
Advanced

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

[myexperiment-hackers] [3395] branches/wf4ever: added wf-ro status page


From: noreply
Subject: [myexperiment-hackers] [3395] branches/wf4ever: added wf-ro status page
Date: Tue, 5 Feb 2013 01:45:38 +0000 (UTC)

Revision
3395
Author
dgc
Date
2013-02-05 01:45:37 +0000 (Tue, 05 Feb 2013)

Log Message

added wf-ro status page

Modified Paths

Added Paths

Diff

Modified: branches/wf4ever/app/controllers/packs_controller.rb (3394 => 3395)


--- branches/wf4ever/app/controllers/packs_controller.rb	2013-02-05 00:51:09 UTC (rev 3394)
+++ branches/wf4ever/app/controllers/packs_controller.rb	2013-02-05 01:45:37 UTC (rev 3395)
@@ -144,6 +144,8 @@
       token = Conf.rodl_bearer_token
       uri = Wf4Ever::TransformationClient.create_job(service_uri, ruri, format, @pack.ro_uri, token)
       puts "################## Transforming at " + uri
+
+      uri
   end
   
   def annotate_resource_type(session, resource_uri, type_uri)
@@ -161,11 +163,13 @@
 
     
     if type == WORKFLOW_DEFINITION
-       transform_wf(ruri)
+       result = transform_wf(ruri)
     end
     if type != RO_RESOURCE
        annotate_resource_type(session, ruri, params[:type])
     end
+
+    result
   end
   
   def create_resource
@@ -178,14 +182,14 @@
          filename = File.basename(file.original_filename)
         ## FIXME: Content type should not always be text/plain!
          c, r, puri, ruri = session.aggregate_internal_resource(@pack.ro_uri, filename, { :body => file.read, :ctype=> 'text/plain' })
-         post_process_created_resource(session, ruri, params[:type])        
+         job_uri = post_process_created_resource(session, ruri, params[:type])        
       end
     end
       
     if params[:uri] and not params[:uri].empty?
          no_item = false
       c, r, puri, ruri = session.aggregate_external_resource(@pack.ro_uri, params[:uri])
-      post_process_created_resource(session, ruri, params[:type])
+      job_uri = post_process_created_resource(session, ruri, params[:type])
     end
 
     if no_item 
@@ -196,12 +200,20 @@
     
     respond_to do |format|
       format.html {
-        redirect_to pack_url(@pack)
+        if job_uri
+          redirect_to check_wfro_job_pack_path(@pack, :job_uri => job_uri)
+        else
+          redirect_to pack_url(@pack)
+        end
       }    
     end
     
   end
 
+  def check_wfro_job
+    @status = Wf4Ever::TransformationClient.check_job(params[:job_uri])
+  end
+
   def reupload_resource
   end
 
@@ -615,6 +627,7 @@
   def find_pack_auth
 
     action_permissions = {
+      "check_wfro_job"     => "edit",
       "create"             => "create",
       "create_item"        => "edit",
       "create_resource"    => "edit",

Added: branches/wf4ever/app/views/packs/check_wfro_job.rhtml (0 => 3395)


--- branches/wf4ever/app/views/packs/check_wfro_job.rhtml	                        (rev 0)
+++ branches/wf4ever/app/views/packs/check_wfro_job.rhtml	2013-02-05 01:45:37 UTC (rev 3395)
@@ -0,0 +1,23 @@
+<h1>Workflow - Research Object Transformation Service</h1>
+
+<h2>Resource</h2>
+
+<p>The following resource has been submitted to the transformation service:</p>
+
+<p><tt><%=h @status["resource"] -%></tt></p>
+
+<h2>Status</h2>
+
+<p>The status is: <%=h @status["status"] -%></p>
+
+<p style="margin: auto">
+  <form style="display: inline-block" action="" check_wfro_job_pack_path(@pack) %>" method="get">
+    <%= hidden_field_tag :authenticity_token, form_authenticity_token -%>
+    <%= hidden_field_tag :job_uri, params[:job_uri] -%>
+    <input id="submit-button" type="submit" value="Check again" />
+  </form>
+  <form style="display: inline-block" action="" pack_path(@pack) %>" method="get">
+    <input id="submit-button" type="submit" value="Return to Pack" />
+  </form>
+</p>
+

Modified: branches/wf4ever/config/routes.rb (3394 => 3395)


--- branches/wf4ever/config/routes.rb	2013-02-05 00:51:09 UTC (rev 3394)
+++ branches/wf4ever/config/routes.rb	2013-02-05 01:45:37 UTC (rev 3395)
@@ -103,6 +103,7 @@
                  :update_annotations => :post,
                  :create_resource => :post,
                  :destroy_resource => :delete,
+                 :check_wfro_job => :get,
                  :items => :get } do |pack|
     pack.resources :comments, :collection => { :timeline => :get }
     pack.resources :relationships, :collection => { :edit_relationships => :get }

reply via email to

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