--- server/views/hardware_profiles/index.xml.haml | 2 +- server/views/hardware_profiles/show.xml.haml | 3 +-- server/views/images/index.xml.haml | 7 ++++--- server/views/images/show.xml.haml | 4 ++-- server/views/instances/index.xml.haml | 14 ++++++-------- server/views/instances/show.html.haml | 5 ----- server/views/instances/show.xml.haml | 19 ++++++------------- server/views/realms/index.xml.haml | 4 +--- server/views/realms/show.xml.haml | 9 ++++----- server/views/storage_snapshots/index.xml.haml | 8 +++----- server/views/storage_snapshots/show.xml.haml | 6 ++---- server/views/storage_volumes/index.xml.haml | 14 +++++++------- server/views/storage_volumes/show.xml.haml | 4 ++-- 13 files changed, 39 insertions(+), 60 deletions(-)
diff --git a/server/views/hardware_profiles/index.xml.haml b/server/views/hardware_profiles/index.xml.haml index 52f91a4..cf0a69f 100644 --- a/server/views/hardware_profiles/index.xml.haml +++ b/server/views/hardware_profiles/index.xml.haml @@ -1,4 +1,4 @@ !!! XML -%hardware-profiles +%hardware_profiles - @profiles.each do |prof| = haml :'hardware_profiles/show', :locals => { :@profile => prof, :partial => true } diff --git a/server/views/hardware_profiles/show.xml.haml b/server/views/hardware_profiles/show.xml.haml index 4a289a1..50f918e 100644 --- a/server/views/hardware_profiles/show.xml.haml +++ b/server/views/hardware_profiles/show.xml.haml @@ -1,7 +1,6 @@ - unless defined?(partial) !!! XML -%hardware-profile{ :href => hardware_profile_url(@profile.name) } - %id= @profile.name +%hardware_profile{ :href => hardware_profile_url(@profile.name), :id => @profile.name } - @profile.each_property do |prop| - attr = { :name => prop.name, :kind => prop.kind, :unit => prop.unit } - if prop.kind == :fixed diff --git a/server/views/images/index.xml.haml b/server/views/images/index.xml.haml index 6d14b21..356668b 100644 --- a/server/views/images/index.xml.haml +++ b/server/views/images/index.xml.haml @@ -1,7 +1,8 @@ !!! XML %images - @elements.each do |image| - %image{:href => image_url(image.id)} - - image.attributes.each do |attribute| - - haml_tag(attribute, :<) do + %image{:href => image_url(image.id), :id => image.id} + - image.attributes.select{ |attr| attr!=:id }.each do |attribute| + - haml_tag("#{attribute}".tr('-', '_'), :<) do - haml_concat image.send(attribute) + diff --git a/server/views/images/show.xml.haml b/server/views/images/show.xml.haml index fbb5d07..c3e2cc4 100644 --- a/server/views/images/show.xml.haml +++ b/server/views/images/show.xml.haml @@ -1,5 +1,5 @@ !!! XML -%image{:href => image_url(@image.id)} - - @image.attributes.each do |attribute| +%image{:href => image_url(@image.id), :id => @image.id} + - @image.attributes.select{ |attr| attr!=:id }.each do |attribute| - haml_tag(attribute, :<) do - haml_concat @image.send(attribute) diff --git a/server/views/instances/index.xml.haml b/server/views/instances/index.xml.haml index f2bb8f0..ab780eb 100644 --- a/server/views/instances/index.xml.haml +++ b/server/views/instances/index.xml.haml @@ -1,23 +1,21 @@ !!! XML %instances - @elements.each do |instance| - %instance{:href => instance_url(instance.id)} - %id #{instance.id} + %instance{:href => instance_url(instance.id), :id => instance.id} %name #{instance.name} %owner_id #{instance.owner_id} - %image{:href => image_url(instance.image_id)} - %realm{:href => realm_url(instance.realm_id)} + %image{:href => image_url(instance.image_id), :id => instance.image_id } + %realm{:href => realm_url(instance.realm_id), :id => instance.realm_id } %state #{instance.state} - - haml_tag :"hardware-profile", { :href => hardware_profile_url(instance.instance_profile.id)} do - %id #{instance.instance_profile.id} + - 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)} %actions - instance.actions.compact.each do |action| %link{:rel => action, :href => self.send("#{action}_instance_url", instance.id), :method => instance_action_method(action)} - %public-addresses + %public_addresses - instance.public_addresses.each do |address| %address #{address} - %private-addresses + %private_addresses - instance.private_addresses.each do |address| %address #{address} diff --git a/server/views/instances/show.html.haml b/server/views/instances/show.html.haml index 27a8d29..f27dcb7 100644 --- a/server/views/instances/show.html.haml +++ b/server/views/instances/show.html.haml @@ -36,11 +36,6 @@ %dt Private Addresses %dd = @instance.private_addresses.collect { |address| "<div>#{address}</div>" }.join - - unless @instance.launch_time.nil? - %di - %dt Launch Time - %dd - = @instance.launch_time %di %dt %dd diff --git a/server/views/instances/show.xml.haml b/server/views/instances/show.xml.haml index bab150b..18f563e 100644 --- a/server/views/instances/show.xml.haml +++ b/server/views/instances/show.xml.haml @@ -1,34 +1,27 @@ !!! XML -%instance{:href => instance_url(@instance.id)} - %id< - =@instance.id +%instance{:href => instance_url(@instance.id), :id => @instance.id} %name< =@instance.name %owner_id< =@instance.owner_id - %image{:href => image_url(@instance.image_id)} - %realm{:href => realm_url(@instance.realm_id)} + %image{:href => image_url(@instance.image_id), :id => @instance.image_id } + %realm{:href => realm_url(@instance.realm_id), :id => @instance.realm_id } %state< =@instance.state - - haml_tag :"hardware-profile", {:href => hardware_profile_url(@instance.instance_profile.id)} do - %id< - =@instance.instance_profile.id + - 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)} %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)} - %public-addresses + %public_addresses - @instance.public_addresses.each do |address| %address< =address - %private-addresses + %private_addresses - @instance.private_addresses.each do |address| %address< =address - - unless @instance.launch_time.nil? - %launch-time< - =@instance.launch_time - if driver_has_auth_features? %authentication{ :type => driver_auth_feature_name } - if @instance.authn_feature_failed? diff --git a/server/views/realms/index.xml.haml b/server/views/realms/index.xml.haml index 03dd3df..e67f282 100644 --- a/server/views/realms/index.xml.haml +++ b/server/views/realms/index.xml.haml @@ -1,9 +1,7 @@ !!!XML %realms - @elements.each do |realm| - %realm{:href => realm_url(realm.id)} - %id< - =realm.id + %realm{:href => realm_url(realm.id), :id => realm.id } %name< =realm.name %state< diff --git a/server/views/realms/show.xml.haml b/server/views/realms/show.xml.haml index 21ab97f..f53c46a 100644 --- a/server/views/realms/show.xml.haml +++ b/server/views/realms/show.xml.haml @@ -1,10 +1,9 @@ !!!XML -%realm{:href => realm_url(@realm.id)} - %id< - =@realm.id +%realm{:href => realm_url(@realm.id), :id => @realm.id } %name< =@realm.name %state< =@realm.state - %limit< - =@realm.limit.eql?(:unlimited) ? '' : @realm.limit + - unless @realm.limit.eql?(:unlimited) + %limit< + =@realm.limit diff --git a/server/views/storage_snapshots/index.xml.haml b/server/views/storage_snapshots/index.xml.haml index 734e00f..4813798 100644 --- a/server/views/storage_snapshots/index.xml.haml +++ b/server/views/storage_snapshots/index.xml.haml @@ -1,11 +1,9 @@ !!!XML -%storage-snapshots +%storage_snapshots - @elements.each do |snapshot| - %storage-snapshot{ :href => storage_snapshot_url(snapshot.id)} - %id< - =snapshot.id + %storage_snapshot{ :href => storage_snapshot_url(snapshot.id), :id => snapshot.id } %created< =snapshot.created %state< =snapshot.state - %storage-volume{ :href => storage_volume_url(snapshot.storage_volume_id)} + %storage_volume{ :href => storage_volume_url(snapshot.storage_volume_id), :id => snapshot.storage_volume_id } diff --git a/server/views/storage_snapshots/show.xml.haml b/server/views/storage_snapshots/show.xml.haml index 49e3f00..8043d1b 100644 --- a/server/views/storage_snapshots/show.xml.haml +++ b/server/views/storage_snapshots/show.xml.haml @@ -1,9 +1,7 @@ !!!XML -%storage-snapshot{:href => storage_snapshot_url(@storage_snapshot.id)} - %id< - =@storage_snapshot.id +%storage_snapshot{:href => storage_snapshot_url(@storage_snapshot.id), :id => @storage_snapshot.id } %created< =@storage_snapshot.created %state< =@storage_snapshot.state - %storage-volume{:href => storage_volume_url(@storage_snapshot.storage_volume_id)} + %storage_volume{:href => storage_volume_url(@storage_snapshot.storage_volume_id), :id => @storage_snapshot.storage_volume_id} diff --git a/server/views/storage_volumes/index.xml.haml b/server/views/storage_volumes/index.xml.haml index e07596f..a96ab61 100644 --- a/server/views/storage_volumes/index.xml.haml +++ b/server/views/storage_volumes/index.xml.haml @@ -1,13 +1,13 @@ !!!XML -%storage-volumes +%storage_volumes - @elements.each do |volume| - %storage-volume{ :href => storage_volume_url(volume.id)} - %id< - =volume.id + %storage_volume{ :href => storage_volume_url(volume.id), :id => volume.id } %created< =volume.created %capacity< =volume.capacity - %device< - =volume.device - %instance{:href => volume.instance_id} + - unless volume.device.nil? + %device< + =volume.device + - unless volume.instance_id.nil? + %instance{:href => instance_url(volume.instance_id), :id => volume.instance_id} diff --git a/server/views/storage_volumes/show.xml.haml b/server/views/storage_volumes/show.xml.haml index 18f2e42..5ab6748 100644 --- a/server/views/storage_volumes/show.xml.haml +++ b/server/views/storage_volumes/show.xml.haml @@ -1,5 +1,5 @@ !!!XML -%storage-volume{ :href => storage_volume_url(@storage_volume.id)} +%storage_volume{ :href => storage_volume_url(@storage_volume.id)} %id< =@storage_volume.id %created< @@ -10,4 +10,4 @@ =@storage_volume.device %state< =@storage_volume.state - %instance{:href => @storage_volume.instance_id} + %instance{:href => @storage_volume.instance_id, :id => @storage_volume.instance_id}