Return-Path: X-Original-To: apmail-deltacloud-commits-archive@www.apache.org Delivered-To: apmail-deltacloud-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6D136F350 for ; Tue, 26 Mar 2013 12:36:23 +0000 (UTC) Received: (qmail 35089 invoked by uid 500); 26 Mar 2013 12:36:23 -0000 Delivered-To: apmail-deltacloud-commits-archive@deltacloud.apache.org Received: (qmail 35041 invoked by uid 500); 26 Mar 2013 12:36:23 -0000 Mailing-List: contact commits-help@deltacloud.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@deltacloud.apache.org Delivered-To: mailing list commits@deltacloud.apache.org Received: (qmail 34888 invoked by uid 99); 26 Mar 2013 12:36:20 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Mar 2013 12:36:20 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 238E7820AD2; Tue, 26 Mar 2013 12:36:20 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: mfojtik@apache.org To: commits@deltacloud.apache.org Date: Tue, 26 Mar 2013 12:36:21 -0000 Message-Id: In-Reply-To: <6123932a33fc4fed9de9956237f340a8@git.apache.org> References: <6123932a33fc4fed9de9956237f340a8@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/7] git commit: XML haml templates use local instead of instance variables XML haml templates use local instead of instance variables Signed-off-by: Michal fojtik Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/b8652ea6 Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/b8652ea6 Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/b8652ea6 Branch: refs/heads/master Commit: b8652ea6c3b77ce503e50cf6fe3f6b7e480ee4d3 Parents: 5c5f7f2 Author: Francesco Vollero Authored: Mon Mar 25 17:57:31 2013 +0100 Committer: Michal fojtik Committed: Tue Mar 26 09:49:29 2013 +0100 ---------------------------------------------------------------------- server/lib/deltacloud/collections/addresses.rb | 4 +- server/lib/deltacloud/collections/buckets.rb | 34 +++---- server/lib/deltacloud/collections/drivers.rb | 8 +- server/lib/deltacloud/collections/firewalls.rb | 10 +- server/lib/deltacloud/collections/images.rb | 4 +- .../lib/deltacloud/collections/instance_states.rb | 8 +- server/lib/deltacloud/collections/instances.rb | 12 +- server/lib/deltacloud/collections/keys.rb | 4 +- .../lib/deltacloud/collections/load_balancers.rb | 10 +- .../deltacloud/collections/storage_snapshots.rb | 6 +- .../lib/deltacloud/collections/storage_volumes.rb | 8 +- server/lib/deltacloud/helpers/deltacloud_helper.rb | 37 ++++---- server/lib/deltacloud/server.rb | 8 +- server/views/addresses/index.xml.haml | 4 +- server/views/addresses/show.xml.haml | 18 ++-- server/views/api/show.html.haml | 2 +- server/views/api/show.xml.haml | 2 +- server/views/blobs/show.xml.haml | 14 ++-- server/views/buckets/index.xml.haml | 4 +- server/views/buckets/show.xml.haml | 12 +- server/views/drivers/index.xml.haml | 2 +- server/views/drivers/show.html.haml | 12 +- server/views/drivers/show.xml.haml | 10 +- .../errors/backend_capability_failure.xml.haml | 6 +- server/views/errors/common.html.haml | 14 ++-- server/views/errors/common.xml.haml | 10 +- server/views/firewalls/index.xml.haml | 2 +- server/views/firewalls/show.xml.haml | 18 ++-- server/views/hardware_profiles/index.xml.haml | 4 +- server/views/hardware_profiles/show.xml.haml | 8 +- server/views/images/index.xml.haml | 4 +- server/views/images/show.xml.haml | 28 +++--- server/views/instance_states/show.png.erb | 4 +- server/views/instance_states/show.xml.haml | 2 +- server/views/instances/index.html.haml | 2 +- server/views/instances/index.xml.haml | 4 +- server/views/instances/run.html.haml | 4 +- server/views/instances/run.xml.haml | 6 +- server/views/instances/run_command.html.haml | 8 +- server/views/instances/show.html.haml | 54 +++++----- server/views/instances/show.xml.haml | 74 +++++++------- server/views/keys/index.xml.haml | 4 +- server/views/keys/show.xml.haml | 24 +++--- server/views/load_balancers/index.xml.haml | 4 +- server/views/load_balancers/show.xml.haml | 18 ++-- server/views/metrics/index.xml.haml | 4 +- server/views/metrics/show.xml.haml | 6 +- server/views/realms/index.xml.haml | 4 +- server/views/realms/show.xml.haml | 10 +- server/views/storage_snapshots/index.xml.haml | 4 +- server/views/storage_snapshots/show.xml.haml | 8 +- server/views/storage_volumes/index.xml.haml | 4 +- server/views/storage_volumes/show.xml.haml | 42 ++++---- 53 files changed, 307 insertions(+), 310 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/lib/deltacloud/collections/addresses.rb ---------------------------------------------------------------------- diff --git a/server/lib/deltacloud/collections/addresses.rb b/server/lib/deltacloud/collections/addresses.rb index fabbb59..fb877d8 100644 --- a/server/lib/deltacloud/collections/addresses.rb +++ b/server/lib/deltacloud/collections/addresses.rb @@ -39,8 +39,8 @@ module Deltacloud::Collections status 201 # Created response['Location'] = address_url(@address.id) respond_to do |format| - format.xml { haml :"addresses/show", :ugly => true } - format.html { haml :"addresses/_address", :layout => false } + format.xml { haml :"addresses/show", :ugly => true, :locals => { :address => @address } } + format.html { haml :"addresses/_address", :layout => false, :locals => { :address => @address } } format.json { JSON::dump(:address => @address.to_hash(self)) } end end http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/lib/deltacloud/collections/buckets.rb ---------------------------------------------------------------------- diff --git a/server/lib/deltacloud/collections/buckets.rb b/server/lib/deltacloud/collections/buckets.rb index eb3830d..18d1d15 100644 --- a/server/lib/deltacloud/collections/buckets.rb +++ b/server/lib/deltacloud/collections/buckets.rb @@ -27,7 +27,7 @@ module Deltacloud::Collections get '/buckets/:bucket/%s' % NEW_BLOB_FORM_ID do @bucket_id = params[:bucket] respond_to do |format| - format.html {haml :"blobs/new"} + format.html {haml :"blobs/new", :locals=>{:bucket_id => @bucket_id} } end end @@ -65,14 +65,12 @@ module Deltacloud::Collections report_error(400) # likely blob size < 112 KB (didn't hit streaming patch) end when "finalize" then - bucket_id = params[:bucket] - blob_id = params[:blob] segmented_blob_manifest = BlobHelper.extract_segmented_blob_manifest(request) segmented_blob_id = BlobHelper.segmented_blob_id(request) @blob = driver.create_blob(credentials, params[:bucket], params[:blob], nil, {:segment_manifest=>segmented_blob_manifest, :segmented_blob_id=>segmented_blob_id}) respond_to do |format| - format.xml { haml :"blobs/show" } - format.html { haml :"blobs/show" } + format.xml { haml :"blobs/show", :locals => { :blob => @blob } } + format.html { haml :"blobs/show", :locals => { :blob => @blob } } format.json { xml_to_json 'blobs/show' } end else @@ -89,8 +87,8 @@ module Deltacloud::Collections @blob = driver.blob(credentials, {:id => params[:blob], 'bucket' => params[:bucket]}) respond_to do |format| - format.xml { haml :"blobs/show" } - format.html { haml :"blobs/show" } + format.xml { haml :"blobs/show", :locals => { :blob => @blob } } + format.html { haml :"blobs/show", :locals => { :blob => @blob } } format.json { JSON::dump(:blob => @blob.to_hash(self) ) } end elsif(env["BLOB_FAIL"]) @@ -108,8 +106,8 @@ module Deltacloud::Collections @blob = driver.create_blob(credentials, bucket_id, blob_id, blob_data, user_meta) temp_file.delete respond_to do |format| - format.xml { haml :"blobs/show" } - format.html { haml :"blobs/show" } + format.xml { haml :"blobs/show", :locals => { :blob => @blob } } + format.html { haml :"blobs/show", :locals => { :blob => @blob } } format.json { JSON::dump(:blob => @blob.to_hash(self)) } end end @@ -128,7 +126,7 @@ module Deltacloud::Collections status 201 response['Location'] = bucket_url(@bucket.id) respond_to do |format| - format.xml { haml :"buckets/show" } + format.xml { haml :"buckets/show", :locals=> { :bucket => @bucket } } format.json { JSON::dump(:bucket => @bucket.to_hash(self)) } format.html do redirect bucket_url(@bucket.id) if @bucket and @bucket.id @@ -158,8 +156,8 @@ module Deltacloud::Collections @blob = driver.blob(credentials, { :id => params[:blob_id], 'bucket' => params[:id]} ) if @blob respond_to do |format| - format.xml { haml :"blobs/show" } - format.html { haml :"blobs/show" } + format.xml { haml :"blobs/show", :locals => { :blob => @blob } } + format.html { haml :"blobs/show", :locals => { :blob => @blob } } format.json { JSON::dump(:blob => @blob.to_hash(self)) } end else @@ -192,8 +190,8 @@ module Deltacloud::Collections @blob = driver.create_blob(credentials, bucket_id, blob_id, blob_data, user_meta) status 201 respond_to do |format| - format.xml { haml :"blobs/show" } - format.html { haml :"blobs/show"} + format.xml { haml :"blobs/show", :locals => { :blob => @blob } } + format.html { haml :"blobs/show", :locals => { :blob => @blob }} format.json { JSON::dump(:blob => @blob.to_hash(self)) } end end @@ -225,8 +223,8 @@ module Deltacloud::Collections @blob = driver.blob(credentials, {:id => params[:blob], 'bucket' => params[:bucket]}) respond_to do |format| - format.xml { haml :"blobs/show" } - format.html { haml :"blobs/show" } + format.xml { haml :"blobs/show", :locals => { :blob => @blob } } + format.html { haml :"blobs/show", :locals => { :blob => @blob } } format.json { JSON::dump(@blob.to_hash(self)) } end elsif(env["BLOB_FAIL"]) @@ -244,8 +242,8 @@ module Deltacloud::Collections @blob = driver.create_blob(credentials, bucket_id, blob_id, blob_data, user_meta) temp_file.delete respond_to do |format| - format.xml { haml :"blobs/show" } - format.html { haml :"blobs/show" } + format.xml { haml :"blobs/show", :locals => { :blob => @blob } } + format.html { haml :"blobs/show", :locals => { :blob => @blob } } format.json { JSON::dump(@blob.to_hash(self)) } end end http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/lib/deltacloud/collections/drivers.rb ---------------------------------------------------------------------- diff --git a/server/lib/deltacloud/collections/drivers.rb b/server/lib/deltacloud/collections/drivers.rb index 8c51019..c49ab43 100644 --- a/server/lib/deltacloud/collections/drivers.rb +++ b/server/lib/deltacloud/collections/drivers.rb @@ -22,9 +22,9 @@ module Deltacloud::Collections control do @drivers = Deltacloud::Drivers.driver_config respond_to do |format| - format.xml { haml :"drivers/index" } + format.xml { haml :"drivers/index", :locals => { :drivers => @drivers } } format.json { @drivers.to_json } - format.html { haml :"drivers/index" } + format.html { haml :"drivers/index", :locals => { :drivers => @drivers } } end end end @@ -38,9 +38,9 @@ module Deltacloud::Collections @driver = Deltacloud::Drivers.driver_config[@name] halt 404 unless @driver respond_to do |format| - format.xml { haml :"drivers/show" } + format.xml { haml :"drivers/show", :locals => { :driver => @driver, :name => @name, :providers => @providers } } format.json { { :driver => @driver.merge(:id => params[:id]) }.to_json } - format.html { haml :"drivers/show" } + format.html { haml :"drivers/show", :locals => { :driver => @driver, :name => @name, :providers => @providers }} end end end http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/lib/deltacloud/collections/firewalls.rb ---------------------------------------------------------------------- diff --git a/server/lib/deltacloud/collections/firewalls.rb b/server/lib/deltacloud/collections/firewalls.rb index 1f35c58..e6ae4ee 100644 --- a/server/lib/deltacloud/collections/firewalls.rb +++ b/server/lib/deltacloud/collections/firewalls.rb @@ -25,7 +25,7 @@ module Deltacloud::Collections get '/firewalls/:id/new_rule' do @firewall_name = params[:id] respond_to do |format| - format.html {haml :"firewalls/new_rule" } + format.html { haml :"firewalls/new_rule", :locals => { :firewall_name => @firewall_name } } end end @@ -64,8 +64,8 @@ module Deltacloud::Collections status 201 # Created response['Location'] = firewall_url(@firewall.id) respond_to do |format| - format.xml { haml :"firewalls/show" } - format.html { haml :"firewalls/show" } + format.xml { haml :"firewalls/show", :locals => { :firewall => @firewall } } + format.html { haml :"firewalls/show", :locals => { :firewall => @firewall } } format.json { JSON::dump(:firewall => @firewall.to_hash(self)) } end end @@ -107,8 +107,8 @@ module Deltacloud::Collections @firewall = driver.firewall(credentials, {:id => params[:id]}) status 201 respond_to do |format| - format.xml { haml :"firewalls/show" } - format.html { haml :"firewalls/show" } + format.xml { haml :"firewalls/show", :locals => { :firewall => @firewall} } + format.html { haml :"firewalls/show", :locals => { :firewall => @firewall} } format.json { JSON::dump(:firewall => @firewall.to_hash(self) ) } end end http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/lib/deltacloud/collections/images.rb ---------------------------------------------------------------------- diff --git a/server/lib/deltacloud/collections/images.rb b/server/lib/deltacloud/collections/images.rb index 80fbf08..687f931 100644 --- a/server/lib/deltacloud/collections/images.rb +++ b/server/lib/deltacloud/collections/images.rb @@ -49,9 +49,9 @@ module Deltacloud::Collections status 201 # Created response['Location'] = image_url(@image.id) respond_to do |format| - format.xml { haml :"images/show" } + format.xml { haml :"images/show", :locals => { :image => @image } } format.json { JSON::dump(:image => @image.to_hash(self)) } - format.html { haml :"images/show" } + format.html { haml :"images/show", :locals => { :image => @image } } end end end http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/lib/deltacloud/collections/instance_states.rb ---------------------------------------------------------------------- diff --git a/server/lib/deltacloud/collections/instance_states.rb b/server/lib/deltacloud/collections/instance_states.rb index 6e16568..aba153b 100644 --- a/server/lib/deltacloud/collections/instance_states.rb +++ b/server/lib/deltacloud/collections/instance_states.rb @@ -26,7 +26,7 @@ module Deltacloud::Collections control do @machine = driver.instance_state_machine respond_to do |format| - format.xml { haml :'instance_states/show', :layout => false } + format.xml { haml :'instance_states/show', :layout => false, :locals => { :machine => @machine } } format.json do out = [] @machine.states.each do |state| @@ -37,12 +37,12 @@ module Deltacloud::Collections end out.to_json end - format.html { haml :'instance_states/show'} - format.gv { erb :"instance_states/show" } + format.html { haml :'instance_states/show', :locals => { :machine => @machine }} + format.gv { erb :"instance_states/show", :locals => { :machine => @machine } } format.png do # Trick respond_to into looking up the right template for the # graphviz file - gv = erb(:"instance_states/show") + gv = erb(:"instance_states/show", :locals => { :machine => @machine }) png = '' cmd = 'dot -Kdot -Gpad="0.2,0.2" -Gsize="5.0,8.0" -Gdpi="180" -Tpng' ::Open3.popen3( cmd ) do |stdin, stdout, stderr| http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/lib/deltacloud/collections/instances.rb ---------------------------------------------------------------------- diff --git a/server/lib/deltacloud/collections/instances.rb b/server/lib/deltacloud/collections/instances.rb index ee48f30..7ee662d 100644 --- a/server/lib/deltacloud/collections/instances.rb +++ b/server/lib/deltacloud/collections/instances.rb @@ -34,7 +34,7 @@ module Deltacloud::Collections get '/instances/:id/run' do respond_to do |format| @instance = driver.instances(credentials, :id => params[:id]).first - format.html {haml :"instances/run_command" } + format.html {haml :"instances/run_command", :locals => @instance } end end @@ -59,7 +59,7 @@ module Deltacloud::Collections end status 201 # Created respond_to do |format| - format.xml { haml :"instances/#{action_handler}" } + format.xml { haml :"instances/#{action_handler}", :locals => {:instance=>@instance} } format.json do if @elements JSON::dump(:instances => @elements.map { |i| i.to_hash(self) }) @@ -69,10 +69,10 @@ module Deltacloud::Collections end format.html do if @elements - haml :"instances/index" + haml :"instances/index", :locals => { :elements => @elements } elsif @instance and @instance.id response['Location'] = instance_url(@instance.id) - haml :"instances/show" + haml :"instances/show", :locals => { :instance => @instance } else redirect instances_url end @@ -113,8 +113,8 @@ module Deltacloud::Collections control do @output = driver.run_on_instance(credentials, params) respond_to do |format| - format.xml { haml :"instances/run" } - format.html { haml :"instances/run" } + format.xml { haml :"instances/run", :locals => { :output => @output } } + format.html { haml :"instances/run", :locals => { :output => @output } } format.json { JSON::dump({:instance => { :id => params[:id], :public_address => @output.ssh.network.ip, :command => @output.ssh.command, :output => @output.body}})} end end http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/lib/deltacloud/collections/keys.rb ---------------------------------------------------------------------- diff --git a/server/lib/deltacloud/collections/keys.rb b/server/lib/deltacloud/collections/keys.rb index 8d5c460..d1b5541 100644 --- a/server/lib/deltacloud/collections/keys.rb +++ b/server/lib/deltacloud/collections/keys.rb @@ -40,8 +40,8 @@ module Deltacloud::Collections status 201 response['Location'] = key_url(@key.id) respond_to do |format| - format.xml { haml :"keys/show", :ugly => true } - format.html { haml :"keys/show" } + format.xml { haml :"keys/show", :ugly => true, :locals => { :key => @key } } + format.html { haml :"keys/show", :locals => { :key => @key } } format.json { JSON::dump(:key => @key.to_hash(self)) } end end http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/lib/deltacloud/collections/load_balancers.rb ---------------------------------------------------------------------- diff --git a/server/lib/deltacloud/collections/load_balancers.rb b/server/lib/deltacloud/collections/load_balancers.rb index 92c7a36..7a75c85 100644 --- a/server/lib/deltacloud/collections/load_balancers.rb +++ b/server/lib/deltacloud/collections/load_balancers.rb @@ -40,9 +40,9 @@ module Deltacloud::Collections end @unregistered_instances = all_instances - @registered_instances respond_to do |format| - format.xml { haml :'load_balancers/show' } + format.xml { haml :'load_balancers/show', :locals => { :load_balancer => @load_balancer } } format.json { JSON::dump(:load_balancer => @load_balancer.to_hash(self)) } - format.html { haml :'load_balancers/show' } + format.html { haml :'load_balancers/show' } # FIXME: Fix the HTML view + instance variables end end end @@ -58,7 +58,7 @@ module Deltacloud::Collections status 201 # Created response['Location'] = load_balancer_url(@load_balancer.id) respond_to do |format| - format.xml { haml :"load_balancers/show" } + format.xml { haml :"load_balancers/show", :locals => { :load_balancer => @load_balancer } } format.json { JSON::dump(:load_balancer => @load_balancer.to_hash(self)) } format.html { redirect load_balancer_url(@load_balancer.id)} end @@ -72,7 +72,7 @@ module Deltacloud::Collections driver.lb_register_instance(credentials, params) @load_balancer = driver.load_balancer(credentials, :id => params[:id]) respond_to do |format| - format.xml { haml :'load_balancers/show' } + format.xml { haml :'load_balancers/show', :locals => { :load_balancer => @load_balancer } } format.json { JSON::dump(:load_balancer => @load_balancer.to_hash(self) ) } format.html { redirect load_balancer_url(@load_balancer.id)} end @@ -86,7 +86,7 @@ module Deltacloud::Collections driver.lb_unregister_instance(credentials, params) @load_balancer = driver.load_balancer(credentials, :id => params[:id]) respond_to do |format| - format.xml { haml :'load_balancers/show' } + format.xml { haml :'load_balancers/show', :locals => { :load_balancer => @load_balancer } } format.json { JSON::dump(:load_balancer => @load_balancer.to_hash(self)) } format.html { redirect load_balancer_url(@load_balancer.id) } end http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/lib/deltacloud/collections/storage_snapshots.rb ---------------------------------------------------------------------- diff --git a/server/lib/deltacloud/collections/storage_snapshots.rb b/server/lib/deltacloud/collections/storage_snapshots.rb index c18bb41..c9836fa 100644 --- a/server/lib/deltacloud/collections/storage_snapshots.rb +++ b/server/lib/deltacloud/collections/storage_snapshots.rb @@ -34,9 +34,9 @@ module Deltacloud::Collections status 201 # Created response['Location'] = storage_snapshot_url(@storage_snapshot.id) respond_to do |format| - format.xml { haml :"storage_snapshots/show" } - format.html { haml :"storage_snapshots/show" } - format.json { xml_to_json "storage_snapshots/show" } + format.xml { haml :"storage_snapshots/show", :locals => { :storage_snapshot => @storage_snapshot } } + format.html { haml :"storage_snapshots/show", :locals => { :storage_snapshot => @storage_snapshot } } + format.json { JSON::dump(:storage_snapshot => @storage_snapshot.to_hash(self)) } end end end http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/lib/deltacloud/collections/storage_volumes.rb ---------------------------------------------------------------------- diff --git a/server/lib/deltacloud/collections/storage_volumes.rb b/server/lib/deltacloud/collections/storage_volumes.rb index 3af8015..e02418f 100644 --- a/server/lib/deltacloud/collections/storage_volumes.rb +++ b/server/lib/deltacloud/collections/storage_volumes.rb @@ -46,8 +46,8 @@ module Deltacloud::Collections status 201 response['Location'] = storage_volume_url(@storage_volume.id) respond_to do |format| - format.xml { haml :"storage_volumes/show" } - format.html { haml :"storage_volumes/show" } + format.xml { haml :"storage_volumes/show", :locals => { :storage_volume => @storage_volume } } + format.html { haml :"storage_volumes/show", :locals => { :storage_volume => @storage_volume } } format.json { JSON::dump(:storage_volume => @storage_volume.to_hash(self)) } end end @@ -62,7 +62,7 @@ module Deltacloud::Collections status 202 respond_to do |format| format.html { redirect(storage_volume_url(params[:id]))} - format.xml { haml :"storage_volumes/show" } + format.xml { haml :"storage_volumes/show", :locals => { :storage_volume => @storage_volume } } format.json { JSON::dump(:storage_volume => @storage_volume.to_hash(self)) } end end @@ -78,7 +78,7 @@ module Deltacloud::Collections status 202 respond_to do |format| format.html { redirect(storage_volume_url(params[:id]))} - format.xml { haml :"storage_volumes/show" } + format.xml { haml :"storage_volumes/show", :locals => { :storage_volume => @storage_volume } } format.json { JSON::dump(:storage_volume => @storage_volume.to_hash(self)) } end end http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/lib/deltacloud/helpers/deltacloud_helper.rb ---------------------------------------------------------------------- diff --git a/server/lib/deltacloud/helpers/deltacloud_helper.rb b/server/lib/deltacloud/helpers/deltacloud_helper.rb index b794560..32f13b0 100644 --- a/server/lib/deltacloud/helpers/deltacloud_helper.rb +++ b/server/lib/deltacloud/helpers/deltacloud_helper.rb @@ -75,8 +75,8 @@ module Deltacloud::Helpers headers['X-Backend-Runtime'] = @benchmark.real.to_s instance_variable_set(:"@#{model}", @elements) respond_to do |format| - format.html { haml :"#{model}/index" } - format.xml { haml :"#{model}/index" } + format.html { haml :"#{model}/index", :locals => { :elements => @elements } } + format.xml { haml :"#{model}/index", :locals => { :elements => @elements } } format.json { JSON::dump({ model => @elements.map { |el| el.to_hash(self) }}) } end else @@ -92,7 +92,7 @@ module Deltacloud::Helpers instance_variable_set("@#{model}", @element) if @element respond_to do |format| - format.html { haml :"#{model.to_s.pluralize}/show", :locals=>{model=>@element} } + format.html { haml :"#{model.to_s.pluralize}/show", :locals=>{model=>@element}} format.xml { haml :"#{model.to_s.pluralize}/show" , :locals=>{model=>@element}} format.json { JSON::dump(model => @element.to_hash(self)) } end @@ -109,30 +109,29 @@ module Deltacloud::Helpers def report_error(code=nil, message=nil) if !code.nil? - @error = Deltacloud::Exceptions.exception_from_status(code, message || translate_error_code(code)[:message]) - @code = code - message = @error.message + error = Deltacloud::Exceptions.exception_from_status(code, message || translate_error_code(code)[:message]) + message = error.message else - @error = request.env['sinatra.error'] || @exception - @code = @error.respond_to?(:code) ? @error.code : 500 - message = @error.respond_to?(:message) ? @error.message : translate_error_code(code)[:message] + error = request.env['sinatra.error'] || @exception + code = error.respond_to?(:code) ? error.code : 500 + message = error.respond_to?(:message) ? error.message : translate_error_code(code)[:message] end - response.status = @code + response.status = code - backtrace = (@error.respond_to?(:backtrace) and !@error.backtrace.nil?) ? - "\n\n#{@error.backtrace[0..20].join("\n")}\n\n" : '' + backtrace = (error.respond_to?(:backtrace) and !error.backtrace.nil?) ? + "\n\n#{error.backtrace[0..20].join("\n")}\n\n" : '' - if @code.to_s =~ /5(\d+)/ - log.error(@code.to_s) { "[#{@error.class.to_s}] #{message}#{backtrace}" } + if code.to_s =~ /5(\d+)/ + log.error(code.to_s) { "[#{error.class.to_s}] #{message}#{backtrace}" } end respond_to do |format| - format.xml { haml :"errors/common", :layout => false } - format.json { JSON::dump({ :code => @code || @error.code, :message => message, :error => @error.class.name }) } + format.xml { haml :"errors/common", :layout => false, :locals => { :err => error } } + format.json { JSON::dump({ :code => code || error.code, :message => message, :err => error.class.name }) } format.html { begin - haml :"errors/common", :layout => :error + haml :"errors/common", :layout => :error, :locals => { :err => error } rescue RuntimeError # If the HTML representation of error is missing, then try to report # it through XML @@ -171,8 +170,8 @@ module Deltacloud::Helpers redirect instance_url(params[:id]) else response = respond_to do |format| - format.xml { haml :"instances/show" } - format.html { haml :"instances/show" } + format.xml { haml :"instances/show", :locals => { :instance => @instance } } + format.html { haml :"instances/show", :locals => { :instance => @instance } } format.json { JSON::dump(@instance.to_hash(self)) } end halt 202, response http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/lib/deltacloud/server.rb ---------------------------------------------------------------------- diff --git a/server/lib/deltacloud/server.rb b/server/lib/deltacloud/server.rb index 0ef925f..e874b44 100644 --- a/server/lib/deltacloud/server.rb +++ b/server/lib/deltacloud/server.rb @@ -48,11 +48,11 @@ module Deltacloud if params[:force_auth] return [401, 'Authentication failed'] unless driver.valid_credentials?(credentials) end - @collections = driver.supported_collections(credentials) + collections = driver.supported_collections(credentials) respond_to do |format| - format.xml { haml :"api/show" } - format.json { collections_to_json(@collections) } - format.html { haml :"api/show" } + format.xml { haml :"api/show", :locals => { :collections => collections } } + format.json { collections_to_json(collections) } + format.html { haml :"api/show", :locals => { :collections => collections } } end end http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/views/addresses/index.xml.haml ---------------------------------------------------------------------- diff --git a/server/views/addresses/index.xml.haml b/server/views/addresses/index.xml.haml index abf83b7..a944e5e 100644 --- a/server/views/addresses/index.xml.haml +++ b/server/views/addresses/index.xml.haml @@ -1,4 +1,4 @@ !!!XML %addresses - - @elements.each do |c| - = haml :'addresses/show', :locals => { :@address => c, :partial => true } + - elements.each do |c| + = haml :'addresses/show', :locals => { :address => c, :partial => true } http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/views/addresses/show.xml.haml ---------------------------------------------------------------------- diff --git a/server/views/addresses/show.xml.haml b/server/views/addresses/show.xml.haml index 1ae8814..28d8b6d 100644 --- a/server/views/addresses/show.xml.haml +++ b/server/views/addresses/show.xml.haml @@ -1,14 +1,14 @@ - unless defined?(partial) !!! XML -%address{ :href => address_url(@address.id), :id => @address.id } +%address{ :href => address_url(address.id), :id => address.id } %ip< - =@address.id + =address.id %actions - if driver.respond_to?(:destroy_address) - %link{ :rel => "destroy", :method => "delete", :href => destroy_address_url(@address.id)} - - if driver.respond_to?(:associate_address) and not @address.instance_id - %link{ :rel => "associate", :method => "post", :href => associate_address_url(@address.id)} - - if driver.respond_to?(:disassociate_address) and @address.instance_id - %link{ :rel => "disassociate", :method => "post", :href => disassociate_address_url(@address.id)} - - if @address.instance_id - %instance{ :href => instance_url(@address.instance_id), :id => @address.instance_id} + %link{ :rel => "destroy", :method => "delete", :href => destroy_address_url(address.id)} + - if driver.respond_to?(:associate_address) and not address.instance_id + %link{ :rel => "associate", :method => "post", :href => associate_address_url(address.id)} + - if driver.respond_to?(:disassociate_address) and address.instance_id + %link{ :rel => "disassociate", :method => "post", :href => disassociate_address_url(address.id)} + - if address.instance_id + %instance{ :href => instance_url(address.instance_id), :id => address.instance_id} http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/views/api/show.html.haml ---------------------------------------------------------------------- diff --git a/server/views/api/show.html.haml b/server/views/api/show.html.haml index 15a3490..57f32b6 100644 --- a/server/views/api/show.html.haml +++ b/server/views/api/show.html.haml @@ -3,7 +3,7 @@ %div{ :'data-role' => :content, :'data-theme' => 'c'} %ul{ :'data-role' => :listview, :'data-inset' => 'true'} - - @collections.each do |c| + - collections.each do |c| %li %a{ :href => url_for(c.collection_name), :'data-icon' => "arrow-r"}=c.collection_name.to_s.gsub('_', ' ').titlecase http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/views/api/show.xml.haml ---------------------------------------------------------------------- diff --git a/server/views/api/show.xml.haml b/server/views/api/show.xml.haml index f21f69b..852a599 100644 --- a/server/views/api/show.xml.haml +++ b/server/views/api/show.xml.haml @@ -1,5 +1,5 @@ %api{ :version => settings.version, :driver => driver_symbol, :provider => Thread.current[:provider] || ENV['API_PROVIDER'] } - - @collections.each do |c| + - collections.each do |c| %link{ :rel => c.collection_name, :href => self.send(:"#{c.collection_name}_url")} - c.features.select { |f| driver.class.has_feature?(c.collection_name, f.name) }.each do |f| - f.operations.each do |operation| http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/views/blobs/show.xml.haml ---------------------------------------------------------------------- diff --git a/server/views/blobs/show.xml.haml b/server/views/blobs/show.xml.haml index 4687720..d382c82 100644 --- a/server/views/blobs/show.xml.haml +++ b/server/views/blobs/show.xml.haml @@ -1,13 +1,13 @@ !!! XML -%blob{:href => bucket_url(@blob.bucket) + '/' + @blob.id, :id => @blob.id} - %bucket=@blob.bucket - - @blob.attributes.select{ |attr| (attr!=:id && attr!=:user_metadata) }.each do |attribute| +%blob{:href => bucket_url(blob.bucket) + '/' + blob.id, :id => blob.id} + %bucket=blob.bucket + - blob.attributes.select{ |attr| (attr!=:id && attr!=:user_metadata) }.each do |attribute| - next if attribute == :bucket - unless attribute == :content - haml_tag(attribute, :<) do - - haml_concat @blob.send(attribute) + - haml_concat blob.send(attribute) %user_metadata - - if @blob.user_metadata.respond_to? :each - - @blob.user_metadata.each do |k, v| + - if blob.user_metadata.respond_to? :each + - blob.user_metadata.each do |k, v| %entry{:key => k}=render_cdata(v) - %content{:href => bucket_url(@blob.bucket) + '/' + @blob.id + '/content', :rel => 'blob_content'} + %content{:href => bucket_url(blob.bucket) + '/' + blob.id + '/content', :rel => 'blob_content'} http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/views/buckets/index.xml.haml ---------------------------------------------------------------------- diff --git a/server/views/buckets/index.xml.haml b/server/views/buckets/index.xml.haml index 9f1fd20..f4b1ab7 100644 --- a/server/views/buckets/index.xml.haml +++ b/server/views/buckets/index.xml.haml @@ -1,4 +1,4 @@ !!!XML %buckets - - @elements.each do |c| - = haml :'buckets/show', :locals => { :@bucket => c, :partial => true } + - elements.each do |c| + = haml :'buckets/show', :locals => { :bucket => c, :partial => true } http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/views/buckets/show.xml.haml ---------------------------------------------------------------------- diff --git a/server/views/buckets/show.xml.haml b/server/views/buckets/show.xml.haml index 67f6935..ca2c1c9 100644 --- a/server/views/buckets/show.xml.haml +++ b/server/views/buckets/show.xml.haml @@ -1,10 +1,10 @@ - unless defined?(partial) !!! XML -%bucket{:href => bucket_url(@bucket.id), :id => @bucket.id} - - @bucket.attributes.select{ |attr| attr!=:id }.each do |attribute| +%bucket{:href => bucket_url(bucket.id), :id => bucket.id} + - bucket.attributes.select{ |attr| attr!=:id }.each do |attribute| - unless attribute == :blob_list -haml_tag(attribute, :<) do - - haml_concat @bucket.send(attribute) - - if @bucket.blob_list - - @bucket.blob_list.each do |blb| - %blob{:id => blb, :href => bucket_url(@bucket.id) +"/#{blb}"} + - haml_concat bucket.send(attribute) + - if bucket.blob_list + - bucket.blob_list.each do |blb| + %blob{:id => blb, :href => bucket_url(bucket.id) +"/#{blb}"} http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/views/drivers/index.xml.haml ---------------------------------------------------------------------- diff --git a/server/views/drivers/index.xml.haml b/server/views/drivers/index.xml.haml index 63e809f..84673f3 100644 --- a/server/views/drivers/index.xml.haml +++ b/server/views/drivers/index.xml.haml @@ -1,5 +1,5 @@ %drivers - - @drivers.each do |id, details| + - drivers.each do |id, details| %driver{ :href => driver_url(id), :id => id } %name< =details[:name] http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/views/drivers/show.html.haml ---------------------------------------------------------------------- diff --git a/server/views/drivers/show.html.haml b/server/views/drivers/show.html.haml index 062a5bc..5a162c1 100644 --- a/server/views/drivers/show.html.haml +++ b/server/views/drivers/show.html.haml @@ -1,23 +1,23 @@ -=header @name +=header name =subheader "Deltacloud API #{settings.version}" %div{ :'data-role' => :content, :'data-theme' => 'c'} %ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' => 'd'} %li{ :'data-role' => 'list-divider'} Identifier %li - %p{ :'data-role' => 'fieldcontain'}=@name + %p{ :'data-role' => 'fieldcontain'}=name %li{ :'data-role' => 'list-divider'} Name %li - %p{ :'data-role' => 'fieldcontain'}=@driver[:name] + %p{ :'data-role' => 'fieldcontain'}=driver[:name] %li{ :'data-role' => 'list-divider'} Provider %li %p{ :'data-role' => 'fieldcontain'} - - if @providers - - @providers.each do |p| + - if providers + - providers.each do |p| %h3= p.id %p= p.url - else - - providers = driver_provider(@driver).keys.collect { |k| k.to_s }.sort + - providers = driver_provider(driver).keys.collect { |k| k.to_s }.sort - if providers.empty? None - else http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/views/drivers/show.xml.haml ---------------------------------------------------------------------- diff --git a/server/views/drivers/show.xml.haml b/server/views/drivers/show.xml.haml index 3734c4d..4297118 100644 --- a/server/views/drivers/show.xml.haml +++ b/server/views/drivers/show.xml.haml @@ -1,12 +1,12 @@ -%driver{ :href => driver_url(@name), :id => @name } +%driver{ :href => driver_url(name), :id => name } %name< - = @driver[:name] - - if @providers.nil? - - driver_provider(@driver).each do |prov, details| + = driver[:name] + - if providers.nil? + - driver_provider(driver).each do |prov, details| %provider{ :id => prov } - details.each do |kind, url| %entrypoint{ :kind => kind }<=cdata(url) - else - - @providers.each do |p| + - providers.each do |p| %provider{ :id => p.id } %entrypoint{ :kind => p.name }<=p.url http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/views/errors/backend_capability_failure.xml.haml ---------------------------------------------------------------------- diff --git a/server/views/errors/backend_capability_failure.xml.haml b/server/views/errors/backend_capability_failure.xml.haml index 4302e4b..48e3e6a 100644 --- a/server/views/errors/backend_capability_failure.xml.haml +++ b/server/views/errors/backend_capability_failure.xml.haml @@ -1,5 +1,5 @@ -%error{:url => "#{request.env['REQUEST_URI']}", :status => "#{response.status}"} - %capability #{@error.capability} - %message< #{cdata @error.message} +%err{:url => "#{request.env['REQUEST_URI']}", :status => "#{response.status}"} + %capability #{err.capability} + %message< #{cdata err.message} http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/views/errors/common.html.haml ---------------------------------------------------------------------- diff --git a/server/views/errors/common.html.haml b/server/views/errors/common.html.haml index 8cd3c74..b8e85d2 100644 --- a/server/views/errors/common.html.haml +++ b/server/views/errors/common.html.haml @@ -2,28 +2,28 @@ %ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' => 'e'} %li{ :'data-role' => 'list-divider'} Server message %li - %h3= h [@error.class.name, @error.message].join(' - ') + %h3= h [err.class.name, err.message].join(' - ') %li{ :'data-role' => 'list-divider'} Original request URI %li %a{ :href => request.env['REQUEST_URI'], :'data-ajax' => 'false'} %span=request.env['REQUEST_URI'] %span{ :class => 'ui-li-count'} Retry - %li{ :'data-role' => 'list-divider'} Error details + %li{ :'data-role' => 'list-divider'} err details %li - - if @error.class.method_defined? :details - %p= h @error.details + - if err.class.method_defined? :details + %p= h err.details - else %em No details %li{ :'data-role' => 'list-divider'} Backtrace %li - %pre= bt @error.backtrace + %pre= bt err.backtrace - - if @error.backtrace + - if err.backtrace %div{ 'data-role' => :collapsible, 'data-collapsed' => "true"} %h3 Backtrace %ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' => 'e'} %li - %pre= h @error.backtrace.join("\n") + %pre= h err.backtrace.join("\n") %div{ 'data-role' => :collapsible, 'data-collapsed' => "true"} %h3 Parameters http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/views/errors/common.xml.haml ---------------------------------------------------------------------- diff --git a/server/views/errors/common.xml.haml b/server/views/errors/common.xml.haml index 88ce93f..64344e8 100644 --- a/server/views/errors/common.xml.haml +++ b/server/views/errors/common.xml.haml @@ -4,13 +4,13 @@ %backend{ :driver => driver_symbol, :provider => current_provider } %code=response.status %message< - - if @error.respond_to? :message - =cdata @error.message + - if err.respond_to? :message + =cdata err.message - else - =translate_error_code(response.status) - - if @error.respond_to? :backtrace + =translate_err_code(response.status) + - if err.respond_to? :backtrace %backtrace - =cdata @error.backtrace.nil? ? '' : @error.backtrace.join("\n") + =cdata err.backtrace.nil? ? '' : err.backtrace.join("\n") %request - if params -params.each do |name, value| http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/views/firewalls/index.xml.haml ---------------------------------------------------------------------- diff --git a/server/views/firewalls/index.xml.haml b/server/views/firewalls/index.xml.haml index 53a9b6e..44c77ae 100644 --- a/server/views/firewalls/index.xml.haml +++ b/server/views/firewalls/index.xml.haml @@ -1,6 +1,6 @@ !!! XML %firewalls - - @firewalls.each do |firewall| + - firewalls.each do |firewall| %firewall{:href => firewall_url(firewall.id), :id => firewall.id} %actions %link{ :rel => :destroy, :href => destroy_firewall_url(firewall.id), :method => :delete, :id => firewall.id} http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/views/firewalls/show.xml.haml ---------------------------------------------------------------------- diff --git a/server/views/firewalls/show.xml.haml b/server/views/firewalls/show.xml.haml index 39ed9d2..d7c2bb7 100644 --- a/server/views/firewalls/show.xml.haml +++ b/server/views/firewalls/show.xml.haml @@ -1,20 +1,20 @@ !!! XML -%firewall{:href => firewall_url(@firewall.id), :id => @firewall.id} +%firewall{:href => firewall_url(firewall.id), :id => firewall.id} %actions - %link{ :rel => :destroy, :href => destroy_firewall_url(@firewall.id), :method => :delete} - %link{ :rel => :update, :href => "#{firewall_url(@firewall_name)}/rules", :method => :post} - - @firewall.attributes.select{ |attr| attr != :id && attr!= :rules}.each do |attribute| + %link{ :rel => :destroy, :href => destroy_firewall_url(firewall.id), :method => :delete} + %link{ :rel => :update, :href => "#{firewall_url(firewall_name)}/rules", :method => :post} + - firewall.attributes.select{ |attr| attr != :id && attr!= :rules}.each do |attribute| - haml_tag("#{attribute}".tr('-', '_'), :<) do - if [:name, :description].include?(attribute) =cdata do - - haml_concat @firewall.send(attribute) + - haml_concat firewall.send(attribute) - else - - haml_concat @firewall.send(attribute) + - haml_concat firewall.send(attribute) %rules - - @firewall.rules.each do |rule| - %rule{:href => firewall_url(@firewall.id) + '/' + rule.id, :id => rule.id} + - firewall.rules.each do |rule| + %rule{:href => firewall_url(firewall.id) + '/' + rule.id, :id => rule.id} %actions - %link{ :rel => :destroy, :href => "#{firewall_url(@firewall.name)}/#{rule.id}", :method => :delete} + %link{ :rel => :destroy, :href => "#{firewall_url(firewall.name)}/#{rule.id}", :method => :delete} - rule.attributes.select{|attr| attr != :sources && attr != :id}.each do |rule_attrib| - haml_tag("#{rule_attrib}".tr('-', '_'), :<) do - haml_concat rule.send(rule_attrib) http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/views/hardware_profiles/index.xml.haml ---------------------------------------------------------------------- diff --git a/server/views/hardware_profiles/index.xml.haml b/server/views/hardware_profiles/index.xml.haml index 9292c5b..f12dce2 100644 --- a/server/views/hardware_profiles/index.xml.haml +++ b/server/views/hardware_profiles/index.xml.haml @@ -1,4 +1,4 @@ !!! XML %hardware_profiles - - order_hardware_profiles(@hardware_profiles).each do |prof| - = haml :'hardware_profiles/show', :locals => { :@hardware_profile => prof, :partial => true } + - order_hardware_profiles(elements).each do |prof| + = haml :'hardware_profiles/show', :locals => { :hardware_profile => prof, :partial => true } http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/views/hardware_profiles/show.xml.haml ---------------------------------------------------------------------- diff --git a/server/views/hardware_profiles/show.xml.haml b/server/views/hardware_profiles/show.xml.haml index 677674f..9709c52 100644 --- a/server/views/hardware_profiles/show.xml.haml +++ b/server/views/hardware_profiles/show.xml.haml @@ -1,10 +1,10 @@ - unless defined?(partial) !!! XML -%hardware_profile{ :href => hardware_profile_url(@hardware_profile.id), :id => @hardware_profile.id } - %id= @hardware_profile.id +%hardware_profile{ :href => hardware_profile_url(hardware_profile.id), :id => hardware_profile.id } + %id= hardware_profile.id %name< - = @hardware_profile.name - - @hardware_profile.each_property do |prop| + = hardware_profile.name + - hardware_profile.each_property do |prop| - attr = { :name => prop.name, :kind => prop.kind, :unit => prop.unit } - if prop.kind == :fixed %property{ attr, :value => prop.value }/ http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/views/images/index.xml.haml ---------------------------------------------------------------------- diff --git a/server/views/images/index.xml.haml b/server/views/images/index.xml.haml index 52d86e6..bde6d05 100644 --- a/server/views/images/index.xml.haml +++ b/server/views/images/index.xml.haml @@ -1,5 +1,5 @@ - unless defined?(partial) !!! XML %images - - @elements.each do |c| - = haml :'images/show', :locals => { :@image => c, :partial => true } + - elements.each do |c| + = haml :'images/show', :locals => { :image => c, :partial => true } http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/views/images/show.xml.haml ---------------------------------------------------------------------- diff --git a/server/views/images/show.xml.haml b/server/views/images/show.xml.haml index ac014af..a1988c0 100644 --- a/server/views/images/show.xml.haml +++ b/server/views/images/show.xml.haml @@ -1,20 +1,20 @@ - unless defined?(partial) !!! XML -%image{:href => image_url(@image.id), :id => @image.id} - %name=@image.name - %description=@image.description - %owner_id=@image.owner_id - %architecture=@image.architecture - - if @image.state - %state=@image.state - - if @image.creation_time - %creation_time=@image.creation_time - - if @image.hardware_profiles +%image{:href => image_url(image.id), :id => image.id} + %name=image.name + %description=image.description + %owner_id=image.owner_id + %architecture=image.architecture + - if image.state + %state=image.state + - if image.creation_time + %creation_time=image.creation_time + - if image.hardware_profiles %hardware_profiles - - @image.hardware_profiles.each do |profile| + - image.hardware_profiles.each do |profile| %hardware_profile{ :href => hardware_profile_url(profile.id), :id => profile.id, :rel => :hardware_profile } - %root_type=@image.root_type + %root_type=image.root_type %actions - %link{ :rel => 'create_instance', :method => :post, :href => "#{instances_url};image_id=#{@image.id}"} + %link{ :rel => 'create_instance', :method => :post, :href => "#{instances_url};image_id=#{image.id}"} - if driver.respond_to? :destroy_image - %link{ :rel => 'destroy_image', :method => :delete, :href => "#{destroy_image_url(@image.id)}" } + %link{ :rel => 'destroy_image', :method => :delete, :href => "#{destroy_image_url(image.id)}" } http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/views/instance_states/show.png.erb ---------------------------------------------------------------------- diff --git a/server/views/instance_states/show.png.erb b/server/views/instance_states/show.png.erb index e3f97a7..5634361 100644 --- a/server/views/instance_states/show.png.erb +++ b/server/views/instance_states/show.png.erb @@ -1,6 +1,6 @@ digraph instance_states { rankdir=LR; - <% for state in @machine.states do %> + <% for state in machine.states do %> <%= state %> [ label="<%= state.to_s.titlecase %>", @@ -23,7 +23,7 @@ digraph instance_states { ] <% end %> - <% for state in @machine.states do %> + <% for state in machine.states do %> <% for transition in state.transitions do %> <%= state %> -> <%= transition.destination %> [ http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/views/instance_states/show.xml.haml ---------------------------------------------------------------------- diff --git a/server/views/instance_states/show.xml.haml b/server/views/instance_states/show.xml.haml index beba422..96efbe3 100644 --- a/server/views/instance_states/show.xml.haml +++ b/server/views/instance_states/show.xml.haml @@ -1,5 +1,5 @@ %states - - for state in @machine.states + - for state in machine.states %state{ :name=>state } - for transition in state.transitions - if ( transition.automatically? ) http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/views/instances/index.html.haml ---------------------------------------------------------------------- diff --git a/server/views/instances/index.html.haml b/server/views/instances/index.html.haml index f7efee2..3678a8d 100644 --- a/server/views/instances/index.html.haml +++ b/server/views/instances/index.html.haml @@ -4,7 +4,7 @@ %div{ :'data-role' => :content, :'data-theme' => 'c'} %ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' => 'a'} %li{ :'data-role' => 'list-divider'}=driver_symbol - - @elements.each do |instance| + - elements.each do |instance| %li %a{ :href => instance_url(instance.id), :'data-ajax' => 'false'} %img{ :class => 'ui-link-thumb', :src => '/images/machine.png'} http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/views/instances/index.xml.haml ---------------------------------------------------------------------- diff --git a/server/views/instances/index.xml.haml b/server/views/instances/index.xml.haml index e5f39ba..fa35eaf 100644 --- a/server/views/instances/index.xml.haml +++ b/server/views/instances/index.xml.haml @@ -1,4 +1,4 @@ !!! XML %instances - - @elements.each do |c| - = haml :'instances/show', :locals => { :@instance => c, :partial => true } + - elements.each do |c| + = haml :'instances/show', :locals => { :instance => c, :partial => true } http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/views/instances/run.html.haml ---------------------------------------------------------------------- diff --git a/server/views/instances/run.html.haml b/server/views/instances/run.html.haml index 88c91ee..2951897 100644 --- a/server/views/instances/run.html.haml +++ b/server/views/instances/run.html.haml @@ -2,8 +2,8 @@ %p %label Command: - %em #{@output.ssh.command} + %em #{output.ssh.command} %p %strong Command output %pre - =@output.body + =output.body http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/views/instances/run.xml.haml ---------------------------------------------------------------------- diff --git a/server/views/instances/run.xml.haml b/server/views/instances/run.xml.haml index 4201e20..fa24fff 100644 --- a/server/views/instances/run.xml.haml +++ b/server/views/instances/run.xml.haml @@ -1,7 +1,7 @@ %instance{:id => params[:id], :href=> instance_url(params[:id])} %public_address - =@output.ssh.network.ip + =output.ssh.network.ip %command - =@output.ssh.command + =output.ssh.command %output< - =@output.body + =output.body http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/views/instances/run_command.html.haml ---------------------------------------------------------------------- diff --git a/server/views/instances/run_command.html.haml b/server/views/instances/run_command.html.haml index a9d9bf9..d10f7ea 100644 --- a/server/views/instances/run_command.html.haml +++ b/server/views/instances/run_command.html.haml @@ -1,15 +1,15 @@ -=header "Run command on #{@instance.name}" -=subheader "#{@instance.id}" +=header "Run command on #{instance.name}" +=subheader "#{instance.id}" %div{ :'data-role' => :content, :'data-theme' => 'c', :class => 'middle-dialog'} - %form{ :action => url_for('/instances/%s/run' % @instance.id), :method => :post } + %form{ :action => url_for('/instances/%s/run' % instance.id), :method => :post } %p %label{ :for => :cmd } Desired command: %input{ :name => :cmd, :value => "", :type => :text} %p %fieldset{ :'data-role' => :fieldcontain} %legend Target instance IP address: - - (@instance.public_addresses | @instance.private_addresses).each_with_index do |ip, idx| + - (instance.public_addresses | instance.private_addresses).each_with_index do |ip, idx| %label{ :for => ip.address }= "#{ip.address}" %input{ :name => :ip, :value => ip.address, :id => ip.address, :type => :radio, :'data-theme' => 'b', :checked => idx == 0 || nil}/ %p http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/views/instances/show.html.haml ---------------------------------------------------------------------- diff --git a/server/views/instances/show.html.haml b/server/views/instances/show.html.haml index ae193aa..58e912e 100644 --- a/server/views/instances/show.html.haml +++ b/server/views/instances/show.html.haml @@ -1,67 +1,67 @@ =header "Instance" -=subheader @instance.id +=subheader instance.id %div{ :'data-role' => :content, :'data-theme' => 'c'} %ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' => 'd'} %li{ :'data-role' => 'list-divider'} Name %li - %p{ :'data-role' => 'fieldcontain'}=@instance.name + %p{ :'data-role' => 'fieldcontain'}=instance.name %li{ :'data-role' => 'list-divider'} Owner %li - %p{ :'data-role' => 'fieldcontain'}=@instance.owner_id + %p{ :'data-role' => 'fieldcontain'}=instance.owner_id %li{ :'data-role' => 'list-divider'} State %li - %p{ :'data-role' => 'fieldcontain'}=@instance.state + %p{ :'data-role' => 'fieldcontain'}=instance.state %li{ :'data-role' => 'list-divider'} Launch Time %li - %p{ :'data-role' => 'fieldcontain'}=@instance.launch_time + %p{ :'data-role' => 'fieldcontain'}=instance.launch_time %li{ :'data-role' => 'list-divider'} Image %li - %a{ :href => image_url(@instance.image_id), :'data-ajax' => 'false' }=@instance.image_id + %a{ :href => image_url(instance.image_id), :'data-ajax' => 'false' }=instance.image_id %li{ :'data-role' => 'list-divider'} Hardware Profile %li - - prof = @instance.instance_profile + - prof = instance.instance_profile %a{ :href => hardware_profile_url(prof.name), :'data-ajax' => 'false'} =[prof.name, format_instance_profile(prof)].compact.join(', ') %li{ :'data-role' => 'list-divider'} Realm %li - - if @instance.realm_id - %a{ :href => realm_url(@instance.realm_id), :'data-ajax' => 'false' }=@instance.realm_id + - if instance.realm_id + %a{ :href => realm_url(instance.realm_id), :'data-ajax' => 'false' }=instance.realm_id - else default %li{ :'data-role' => 'list-divider'} Public addresses %li - %p{ :'data-role' => 'fieldcontain'}=@instance.public_addresses.join(',') + %p{ :'data-role' => 'fieldcontain'}=instance.public_addresses.join(',') %li{ :'data-role' => 'list-divider'} Private addresses %li - %p{ :'data-role' => 'fieldcontain'}=@instance.private_addresses.join(',') - - if @instance.password or @instance.keyname + %p{ :'data-role' => 'fieldcontain'}=instance.private_addresses.join(',') + - if instance.password or instance.keyname %li{ :'data-role' => 'list-divider'} Authentication - - if @instance.password + - if instance.password %li{ :'data-role' => 'list-divider'} Username - %li=@instance.username + %li=instance.username %li{ :'data-role' => 'list-divider'} Password - %li=@instance.password - - if @instance.keyname + %li=instance.password + - if instance.keyname %li{ :'data-role' => 'list-divider'} SSH key name %li - %a{ :href => key_url(@instance.keyname), :'data-ajax' => 'false'}=@instance.keyname - - if @instance.firewalls + %a{ :href => key_url(instance.keyname), :'data-ajax' => 'false'}=instance.keyname + - if instance.firewalls %li{ :'data-role' => 'list-divider'} Firewalls - - @instance.firewalls.each do |firewall| + - instance.firewalls.each do |firewall| %li %a{ :href => firewall_url(firewall), :'data-ajax' => 'false'}=firewall - - if @instance.storage_volumes + - if instance.storage_volumes %li{ :'data-role' => 'list-divider'} Attached Storage Volumes - -@instance.storage_volumes.each do |vol| + -instance.storage_volumes.each do |vol| %li %a{ :href => storage_volume_url("#{vol.keys.first}"), :'data-ajax' => 'false'}=["#{vol.keys.first}", "#{vol.values.first}"].compact.reject{ |e| e.empty? }.join(' <---> ') %li{ :'data-role' => 'list-divider'} Actions %li %div{ :'data-role' => 'controlgroup', :'data-type' => "horizontal" } - - @instance.actions.each do |action| - =link_to_action action.to_s.capitalize, self.send(:"#{action}_instance_url", @instance.id), instance_action_method(action) - - if @instance.state=="RUNNING" and driver.respond_to?(:run_on_instance) - =link_to_action 'Run command...', url_for('instances/%s/run' % @instance.id), :get - - if @instance.can_create_image? - =link_to_action 'Create image...', url_for("images/new?instance_id=#{@instance.id}"), :get + - instance.actions.each do |action| + =link_to_action action.to_s.capitalize, self.send(:"#{action}_instance_url", instance.id), instance_action_method(action) + - if instance.state=="RUNNING" and driver.respond_to?(:run_on_instance) + =link_to_action 'Run command...', url_for('instances/%s/run' % instance.id), :get + - if instance.can_create_image? + =link_to_action 'Create image...', url_for("images/new?instance_id=#{instance.id}"), :get http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/views/instances/show.xml.haml ---------------------------------------------------------------------- diff --git a/server/views/instances/show.xml.haml b/server/views/instances/show.xml.haml index 6a888f7..654037b 100644 --- a/server/views/instances/show.xml.haml +++ b/server/views/instances/show.xml.haml @@ -1,60 +1,60 @@ - unless defined?(partial) !!! XML -%instance{:href => instance_url(@instance.id), :id => @instance.id} - - if @instance.name +%instance{:href => instance_url(instance.id), :id => instance.id} + - if instance.name %name< - =@instance.name - - if @instance.owner_id + =instance.name + - if instance.owner_id %owner_id< - =@instance.owner_id - - if @instance.image_id - %image{:href => image_url(@instance.image_id), :id => @instance.image_id } - - if @instance.realm_id - %realm{:href => realm_url(@instance.realm_id), :id => @instance.realm_id } - - if @instance.state + =instance.owner_id + - if instance.image_id + %image{:href => image_url(instance.image_id), :id => instance.image_id } + - if instance.realm_id + %realm{:href => realm_url(instance.realm_id), :id => instance.realm_id } + - if instance.state %state< - =@instance.state - - if @instance.instance_profile - - haml_tag :"hardware_profile", {:id => @instance.instance_profile.id, :href => hardware_profile_url(@instance.instance_profile.id)} do - - @instance.instance_profile.overrides.each do |p, v| + =instance.state + - if instance.instance_profile + - haml_tag :"hardware_profile", {:id => instance.instance_profile.id, :href => hardware_profile_url(instance.instance_profile.id)} do + - instance.instance_profile.overrides.each do |p, v| %property{:kind => 'fixed', :name => p, :value => v, :unit => Deltacloud::HardwareProfile::unit(p)} - - if @instance.actions + - if instance.actions %actions - - @instance.actions.compact.each do |instance_action| - %link{:rel => instance_action, :method => instance_action_method(instance_action), :href => self.send("#{instance_action}_instance_url", @instance.id)} + - instance.actions.compact.each do |instance_action| + %link{:rel => instance_action, :method => instance_action_method(instance_action), :href => self.send("#{instance_action}_instance_url", instance.id)} - if driver.respond_to?(:run_on_instance) - %link{:rel => 'run', :method => :post, :href => "#{run_instance_url(@instance.id)};id=#{@instance.id}"} - - if @instance.can_create_image? - %link{:rel => 'create_image', :method => :post, :href => "#{create_image_url};instance_id=#{@instance.id}"} - - if @instance.launch_time + %link{:rel => 'run', :method => :post, :href => "#{run_instance_url(instance.id)};id=#{instance.id}"} + - if instance.can_create_image? + %link{:rel => 'create_image', :method => :post, :href => "#{create_image_url};instance_id=#{instance.id}"} + - if instance.launch_time %launch_time< - =@instance.launch_time - - if @instance.public_addresses + =instance.launch_time + - if instance.public_addresses %public_addresses< - - @instance.public_addresses.each do |a| + - instance.public_addresses.each do |a| %address{ :type => a.address_type, :port => a.port }=a.address - - if @instance.private_addresses + - if instance.private_addresses %private_addresses< - - @instance.private_addresses.each do |a| + - instance.private_addresses.each do |a| %address{ :type => a.address_type, :port => a.port }=a.address - - if @instance.firewalls + - if instance.firewalls %firewalls< - - @instance.firewalls.each do |firewall| + - instance.firewalls.each do |firewall| %firewall{:href => firewall_url(firewall), :id => firewall } - - if @instance.storage_volumes + - if instance.storage_volumes %storage_volumes< - - @instance.storage_volumes.each do |volume| + - instance.storage_volumes.each do |volume| %storage_volume{:href=> storage_volume_url(volume.keys.first), :id => volume.keys.first, :device => volume.values.first} - if driver.class.has_feature?(:instances, :authentication_key) or driver.class.has_feature?(:instances, :authentication_password) %authentication{ :type => auth_feature_name } - - if @instance.authn_feature_failed? - %error #{@instance.authn_error} + - if instance.authn_feature_failed? + %error #{instance.authn_error} - else - - if @instance.password + - if instance.password %login - %username #{@instance.username} - %password=cdata(@instance.password) - - if @instance.keyname + %username #{instance.username} + %password=cdata(instance.password) + - if instance.keyname %login - %keyname #{@instance.keyname} + %keyname #{instance.keyname} http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/views/keys/index.xml.haml ---------------------------------------------------------------------- diff --git a/server/views/keys/index.xml.haml b/server/views/keys/index.xml.haml index 9256716..e379e49 100644 --- a/server/views/keys/index.xml.haml +++ b/server/views/keys/index.xml.haml @@ -1,4 +1,4 @@ !!!XML %keys - - @elements.each do |c| - = haml :'keys/show', :locals => { :@key => c, :partial => true } + - elements.each do |c| + = haml :'keys/show', :locals => { :key => c, :partial => true } http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/views/keys/show.xml.haml ---------------------------------------------------------------------- diff --git a/server/views/keys/show.xml.haml b/server/views/keys/show.xml.haml index db0786b..49e6de3 100644 --- a/server/views/keys/show.xml.haml +++ b/server/views/keys/show.xml.haml @@ -1,23 +1,23 @@ - unless defined?(partial) !!! XML -%key{ :href => key_url(@key.id), :id => @key.id, :type => "#{@key.credential_type}" } - %name=@key.name +%key{ :href => key_url(key.id), :id => key.id, :type => "#{key.credential_type}" } + %name=key.name %actions - if driver.respond_to?(:destroy_key) - %link{ :rel => "destroy", :method => "delete", :href => destroy_key_url(@key.id)} - - if @key.is_key? - - if @key.fingerprint + %link{ :rel => "destroy", :method => "delete", :href => destroy_key_url(key.id)} + - if key.is_key? + - if key.fingerprint %fingerprint< - =@key.fingerprint - - unless @key.pem_rsa_key.nil? + =key.fingerprint + - unless key.pem_rsa_key.nil? %pem - ~render_cdata(@key.pem_rsa_key) - - if @key.is_password? + ~render_cdata(key.pem_rsa_key) + - if key.is_password? %username< =cdata do - =@key.username + =key.username %password< =cdata do - =@key.password + =key.password %state< - =@key.state + =key.state http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/views/load_balancers/index.xml.haml ---------------------------------------------------------------------- diff --git a/server/views/load_balancers/index.xml.haml b/server/views/load_balancers/index.xml.haml index 053b628..994c9cb 100644 --- a/server/views/load_balancers/index.xml.haml +++ b/server/views/load_balancers/index.xml.haml @@ -1,4 +1,4 @@ !!!XML %load_balancers - - @elements.each do |c| - = haml :'load_balancers/show', :locals => { :@load_balancer => c, :partial => true } + - elements.each do |c| + = haml :'load_balancers/show', :locals => { :load_balancer => c, :partial => true } http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/views/load_balancers/show.xml.haml ---------------------------------------------------------------------- diff --git a/server/views/load_balancers/show.xml.haml b/server/views/load_balancers/show.xml.haml index 2eeb09e..43b7034 100644 --- a/server/views/load_balancers/show.xml.haml +++ b/server/views/load_balancers/show.xml.haml @@ -1,21 +1,21 @@ - unless defined?(partial) !!! XML -%load_balancer{ :href => load_balancer_url(@load_balancer.id), :id => @load_balancer.id} +%load_balancer{ :href => load_balancer_url(load_balancer.id), :id => load_balancer.id} %actions - %link{ :rel => "destroy", :method => "delete", :href => destroy_load_balancer_url(@load_balancer.id)} - %link{ :rel => "register", :method => "post", :href => register_load_balancer_url(@load_balancer.id)} + %link{ :rel => "destroy", :method => "delete", :href => destroy_load_balancer_url(load_balancer.id)} + %link{ :rel => "register", :method => "post", :href => register_load_balancer_url(load_balancer.id)} %public_addresses - - @load_balancer.public_addresses.each do |address| + - load_balancer.public_addresses.each do |address| %address #{address} %created_at< - = @load_balancer.created_at - %realm{ :href => realm_url(@load_balancer.realms.first.id), :id => @load_balancer.realms.first.id} + = load_balancer.created_at + %realm{ :href => realm_url(load_balancer.realms.first.id), :id => load_balancer.realms.first.id} %listeners - - @load_balancer.listeners.each do |listener| + - load_balancer.listeners.each do |listener| %listener{ :protocol => listener.protocol} %load_balancer_port #{listener.load_balancer_port} %instance_port #{listener.instance_port} %instances - - @load_balancer.instances.each do |instance| + - load_balancer.instances.each do |instance| %instance{:href => instance_url(instance.id), :id => instance.id} - %link{:rel => "unregister", :href => unregister_load_balancer_url(@load_balancer.id, { :instance_id => instance.id})} + %link{:rel => "unregister", :href => unregister_load_balancer_url(load_balancer.id, { :instance_id => instance.id})} http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/views/metrics/index.xml.haml ---------------------------------------------------------------------- diff --git a/server/views/metrics/index.xml.haml b/server/views/metrics/index.xml.haml index bd5c184..36c8ccd 100644 --- a/server/views/metrics/index.xml.haml +++ b/server/views/metrics/index.xml.haml @@ -1,5 +1,5 @@ - unless defined?(partial) !!!XML %metrics - - @elements.each do |c| - = haml :'metrics/show', :locals => { :@metric => c, :partial => true} + - elements.each do |c| + = haml :'metrics/show', :locals => { :metric => c, :partial => true} http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/views/metrics/show.xml.haml ---------------------------------------------------------------------- diff --git a/server/views/metrics/show.xml.haml b/server/views/metrics/show.xml.haml index 87254d0..5434413 100644 --- a/server/views/metrics/show.xml.haml +++ b/server/views/metrics/show.xml.haml @@ -1,10 +1,10 @@ - unless defined?(partial) !!! XML -%metric{:href => metric_url(@metric.id), :id => @metric.id} +%metric{:href => metric_url(metric.id), :id => metric.id} -haml_tag(:entity, :<) do - -haml_concat @metric.send(:entity) || @metric.send(:id) + -haml_concat metric.send(:entity) || metric.send(:id) %properties - -@metric.properties.each do |prop| + -metric.properties.each do |prop| -haml_tag(prop.name, :<) do - if prop.values - prop.values.each do |p| http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/views/realms/index.xml.haml ---------------------------------------------------------------------- diff --git a/server/views/realms/index.xml.haml b/server/views/realms/index.xml.haml index 71d1cb1..59f55ff 100644 --- a/server/views/realms/index.xml.haml +++ b/server/views/realms/index.xml.haml @@ -1,4 +1,4 @@ !!!XML %realms - - @elements.each do |c| - = haml :'realms/show', :locals => { :@realm => c, :partial => true } + - elements.each do |c| + = haml :'realms/show', :locals => { :realm => c, :partial => true } http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/views/realms/show.xml.haml ---------------------------------------------------------------------- diff --git a/server/views/realms/show.xml.haml b/server/views/realms/show.xml.haml index 5c06c06..2cc0c8c 100644 --- a/server/views/realms/show.xml.haml +++ b/server/views/realms/show.xml.haml @@ -1,11 +1,11 @@ - unless defined?(partial) !!! XML -%realm{:href => realm_url(@realm.id), :id => @realm.id } +%realm{:href => realm_url(realm.id), :id => realm.id } %name< - =@realm.name + =realm.name %state< - =@realm.state - - unless @realm.limit.eql?(:unlimited) + =realm.state + - unless realm.limit.eql?(:unlimited) %limit< =cdata do - =@realm.limit + =realm.limit http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/views/storage_snapshots/index.xml.haml ---------------------------------------------------------------------- diff --git a/server/views/storage_snapshots/index.xml.haml b/server/views/storage_snapshots/index.xml.haml index 9ae9675..4a8b14f 100644 --- a/server/views/storage_snapshots/index.xml.haml +++ b/server/views/storage_snapshots/index.xml.haml @@ -1,4 +1,4 @@ !!!XML %storage_snapshots - - @elements.each do |c| - = haml :'storage_snapshots/show', :locals => { :@storage_snapshot => c, :partial => true } + - elements.each do |c| + = haml :'storage_snapshots/show', :locals => { :storage_snapshot => c, :partial => true } http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/views/storage_snapshots/show.xml.haml ---------------------------------------------------------------------- diff --git a/server/views/storage_snapshots/show.xml.haml b/server/views/storage_snapshots/show.xml.haml index a47a652..075fdc4 100644 --- a/server/views/storage_snapshots/show.xml.haml +++ b/server/views/storage_snapshots/show.xml.haml @@ -1,7 +1,7 @@ - unless defined?(partial) !!! XML -%storage_snapshot{:href => storage_snapshot_url(@storage_snapshot.id), :id => @storage_snapshot.id } - %name=@storage_snapshot.id +%storage_snapshot{:href => storage_snapshot_url(storage_snapshot.id), :id => storage_snapshot.id } + %name=storage_snapshot.id %created< - =@storage_snapshot.created - %storage_volume{:href => storage_volume_url(@storage_snapshot.storage_volume_id), :id => @storage_snapshot.storage_volume_id} + =storage_snapshot.created + %storage_volume{:href => storage_volume_url(storage_snapshot.storage_volume_id), :id => storage_snapshot.storage_volume_id} http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/views/storage_volumes/index.xml.haml ---------------------------------------------------------------------- diff --git a/server/views/storage_volumes/index.xml.haml b/server/views/storage_volumes/index.xml.haml index e73c46a..31517a3 100644 --- a/server/views/storage_volumes/index.xml.haml +++ b/server/views/storage_volumes/index.xml.haml @@ -1,4 +1,4 @@ !!!XML %storage_volumes - - @elements.each do |volume| - = haml :'storage_volumes/show', :locals => { :@storage_volume => volume, :partial => true } + - elements.each do |volume| + = haml :'storage_volumes/show', :locals => { :storage_volume => volume, :partial => true } http://git-wip-us.apache.org/repos/asf/deltacloud/blob/b8652ea6/server/views/storage_volumes/show.xml.haml ---------------------------------------------------------------------- diff --git a/server/views/storage_volumes/show.xml.haml b/server/views/storage_volumes/show.xml.haml index ccd1baa..f96bc4f 100644 --- a/server/views/storage_volumes/show.xml.haml +++ b/server/views/storage_volumes/show.xml.haml @@ -1,33 +1,33 @@ - unless defined?(partial) !!!XML -%storage_volume{ :href => storage_volume_url(@storage_volume.id), :id => @storage_volume.id} - - if @storage_volume.created +%storage_volume{ :href => storage_volume_url(storage_volume.id), :id => storage_volume.id} + - if storage_volume.created %created< - =@storage_volume.created + =storage_volume.created %capacity{ :unit => "GB" }< - = @storage_volume.capacity - - if @storage_volume.kind + = storage_volume.capacity + - if storage_volume.kind %kind< - = @storage_volume.kind + = storage_volume.kind %name< - = @storage_volume.name || @storage_volume.id - - if @storage_volume.device + = storage_volume.name || storage_volume.id + - if storage_volume.device %device< - = @storage_volume.device - - if @storage_volume.realm_id - %realm{:id => @storage_volume.realm_id, :href => realm_url(@storage_volume.realm_id)} + = storage_volume.device + - if storage_volume.realm_id + %realm{:id => storage_volume.realm_id, :href => realm_url(storage_volume.realm_id)} %realm_id< - = @storage_volume.realm_id - - if @storage_volume.state + = storage_volume.realm_id + - if storage_volume.state %state< - = @storage_volume.state + = storage_volume.state - - unless @storage_volume.instance_id.nil? + - unless storage_volume.instance_id.nil? %mount - %instance{:href => instance_url(@storage_volume.instance_id), :id => @storage_volume.instance_id} - - unless @storage_volume.device.nil? - %device{ :name => @storage_volume.device } - - if @storage_volume.actions + %instance{:href => instance_url(storage_volume.instance_id), :id => storage_volume.instance_id} + - unless storage_volume.device.nil? + %device{ :name => storage_volume.device } + - if storage_volume.actions %actions - - @storage_volume.actions.each do |action| - %link{:rel => action, :method => :post, :href => self.send("#{action}_storage_volume_url", @storage_volume.id)} + - storage_volume.actions.each do |action| + %link{:rel => action, :method => :post, :href => self.send("#{action}_storage_volume_url", storage_volume.id)}