incubator-deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lut...@apache.org
Subject svn commit: r962318 - /incubator/deltacloud/trunk/server/server.rb
Date Thu, 08 Jul 2010 23:45:55 GMT
Author: lutter
Date: Thu Jul  8 23:45:55 2010
New Revision: 962318

URL: http://svn.apache.org/viewvc?rev=962318&view=rev
Log:
Added JSON support for instance_states

Modified:
    incubator/deltacloud/trunk/server/server.rb

Modified: incubator/deltacloud/trunk/server/server.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/server.rb?rev=962318&r1=962317&r2=962318&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/server.rb (original)
+++ incubator/deltacloud/trunk/server/server.rb Thu Jul  8 23:45:55 2010
@@ -156,6 +156,16 @@ collection :instance_states do
       @machine = driver.instance_state_machine
       respond_to do |format|
         format.xml { haml :'instance_states/show', :layout => false }
+        format.json do
+          out = []
+          @machine.states.each do |state|
+            transitions = state.transitions.collect do |t|
+              t.automatically? ? {:to => t.destination, :auto => 'true'} : {:to =>
t.destination, :action => t.action}
+            end
+            out << { :name => state, :transitions => transitions }
+          end
+          out.to_json
+        end
         format.html { haml :'instance_states/show'}
         format.gv { erb :"instance_states/show" }
         format.png do



Mime
View raw message