From: Michal Fojtik <mfoj...@redhat.com>
Signed-off-by: Michal fojtik <mfoj...@redhat.com> --- .../cimi/machine_configurations/show.html.haml | 10 +++--- .../cimi/machine_configurations/show.xml.haml | 36 ++++++------------ server/views/cimi/machine_images/show.xml.haml | 21 ++++------- server/views/cimi/machines/show.xml.haml | 39 +++++++------------- server/views/cimi/volumes/show.xml.haml | 21 ++++------- 5 files changed, 45 insertions(+), 82 deletions(-) diff --git a/server/views/cimi/machine_configurations/show.html.haml b/server/views/cimi/machine_configurations/show.html.haml index 38dc867..80c1b76 100644 --- a/server/views/cimi/machine_configurations/show.html.haml +++ b/server/views/cimi/machine_configurations/show.html.haml @@ -1,21 +1,21 @@ %h1 View/Edit machine configuration %form{ :action => machine_configurations_url } - %input{ :name => :id, :type => :hidden, :value => @dmtfitem["uri"] }/ + %input{ :name => :id, :type => :hidden, :value => url_for("/cimi/machine_configurations/#{@object.name}") }/ %input{ :name => :xmlRootNode, :type => :hidden, :value => @xml_root_node }/ %input{ :name => :refreshURI, :type => :hidden, :value => machine_configurations_url }/ %p %label Name: %p - %input{ :name => :name, :size => 50, :value => @dmtfitem["name"], :style => "width:50%;" } - %input{ :name => :created, :type => :hidden, :size => 50, :value => @dmtfitem["created"] } + %input{ :name => :name, :size => 50, :value => @object.name, :style => "width:50%;" } + %input{ :name => :created, :type => :hidden, :size => 50, :value => @object.launch_time || Time.new.getutc.to_s } %p %br %label Description: %p - %textarea{ :name => :description, :cols => 50, :rows => 4, :style => "width:50%;" } #{@dmtfitem['description']} + %textarea{ :name => :description, :cols => 50, :rows => 4, :style => "width:50%;" } %p %br %label @@ -156,4 +156,4 @@ }) cellRightBut.appendChild(er); - } \ No newline at end of file + } diff --git a/server/views/cimi/machine_configurations/show.xml.haml b/server/views/cimi/machine_configurations/show.xml.haml index c337fe1..095bebd 100644 --- a/server/views/cimi/machine_configurations/show.xml.haml +++ b/server/views/cimi/machine_configurations/show.xml.haml @@ -1,27 +1,15 @@ - unless defined?(partial) !!! XML %MachineConfiguration{ :xmlns => CMWG_NAMESPACE } - %uri=machine_configurations_url + "/" + @dmtfitem["uri"] - %name=@dmtfitem["name"] - %description=@dmtfitem["description"] - %created=@dmtfitem["created"] - - if @dmtfitem["property"] - - if @dmtfitem["property"]["name"] && @dmtfitem["property"]["content"] - - property_object = {"#{@dmtfitem['property']['name']}" => {"content" => @dmtfitem["property"]["content"]}} - - else - - property_object = @dmtfitem["property"] - - property_object.each_pair do |key, value| - %property{ :name => key}=value["content"] - %cpu=@dmtfitem["cpu"] - %memory{ :quantity => @dmtfitem["memory"]["quantity"], :units => @dmtfitem["memory"]["units"] } - - if @dmtfitem["disk"] - - if @dmtfitem["disk"].kind_of?(Array) - - property_object = @dmtfitem["disk"] - - else - - property_object = [@dmtfitem["disk"]] - - property_object.each do |disk| - %disk - %capacity{ :quantity => disk["capacity"]["quantity"], :units => disk["capacity"]["units"] } - %guestInterface= disk["guestInterface"] - %operation{ :rel => "edit", :href => machine_configurations_url + "/" + @dmtfitem["uri"] } - %operation{ :rel => "delete", :href => machine_configurations_url + "/" + @dmtfitem["uri"] } \ No newline at end of file + %uri=machine_configurations_url + "/" + @object.name + %uri=url_for("/cimi/machine_configurations/#{@object.name}") + %name=@object.name + %description="#{@object.name} machine configuration" + %created=Time.new.getutc.to_s + %cpu=@object.architecture.value + %memory{ :quantity => @object.memory.value, :units => @object.memory.unit }/ + %disk + %capacity{ :quantity => @object.storage.value, :units => @object.storage.unit }/ + %guestInterface SATA + %operation{ :rel => "edit", :href => machine_configurations_url + "/" + @object.name }/ + %operation{ :rel => "delete", :href => machine_configurations_url + "/" + @object.name }/ diff --git a/server/views/cimi/machine_images/show.xml.haml b/server/views/cimi/machine_images/show.xml.haml index a00713c..9ff2f3b 100644 --- a/server/views/cimi/machine_images/show.xml.haml +++ b/server/views/cimi/machine_images/show.xml.haml @@ -1,17 +1,10 @@ - unless defined?(partial) !!! XML %MachineImage{ :xmlns => CMWG_NAMESPACE } - %uri=machine_images_url + "/" + @dmtfitem["uri"] - %name=@dmtfitem["name"] - %description=@dmtfitem["description"] - %created=@dmtfitem["created"] - - if @dmtfitem["property"] - - if @dmtfitem["property"]["name"] && @dmtfitem["property"]["content"] - - property_object = {"#{@dmtfitem['property']['name']}" => {"content" => @dmtfitem["property"]["content"]}} - - else - - property_object = @dmtfitem["property"] - - property_object.each_pair do |key, value| - %property{ :name => key}=value["content"] - %imageLocation{ :href => @dmtfitem["imageLocation"]} - %operation{ :rel => "edit", :href => machine_images_url + "/" + @dmtfitem["uri"] } - %operation{ :rel => "delete", :href => machine_images_url + "/" + @dmtfitem["uri"] } \ No newline at end of file + %uri=machine_images_url + "/" + @object.id + %name=@object.name + %description="#{@object.name} machine image description" + %created=Time.new.getutc.to_s + %imageLocation{ :href => '/'}/ + %operation{ :rel => "edit", :href => machine_images_url + "/" + @object.id }/ + %operation{ :rel => "delete", :href => machine_images_url + "/" + @object.id }/ diff --git a/server/views/cimi/machines/show.xml.haml b/server/views/cimi/machines/show.xml.haml index c699b19..2b6da55 100644 --- a/server/views/cimi/machines/show.xml.haml +++ b/server/views/cimi/machines/show.xml.haml @@ -1,28 +1,17 @@ - unless defined?(partial) !!! XML %Machine{ :xmlns => CMWG_NAMESPACE } - %uri=machines_url + "/" + @dmtfitem["uri"] - %name=@dmtfitem["name"] - %description=@dmtfitem["description"] - %created=@dmtfitem["created"] - - if @dmtfitem["property"] - - if @dmtfitem["property"]["name"] && @dmtfitem["property"]["content"] - - property_object = {"#{@dmtfitem['property']['name']}" => {"content" => @dmtfitem["property"]["content"]}} - - else - - property_object = @dmtfitem["property"] - - property_object.each_pair do |key, value| - %property{ :name => key}=value["content"] - %status=@dmtfitem["status"] - %cpu=@dmtfitem["cpu"] - %memory{ :quantity => @dmtfitem["memory"]["quantity"], :units => @dmtfitem["memory"]["units"] } - - if @dmtfitem["disk"] - - if @dmtfitem["disk"].kind_of?(Array) - - property_object = @dmtfitem["disk"] - - else - - property_object = [@dmtfitem["disk"]] - - property_object.each do |disk| - %disk - %capacity{ :quantity => disk["capacity"]["quantity"], :units => disk["capacity"]["units"] } - %guestInterface= disk["guestInterface"] - %operation{ :rel => "edit", :href => machines_url + "/" + @dmtfitem["uri"] } - %operation{ :rel => "delete", :href => machines_url + "/" + @dmtfitem["uri"] } \ No newline at end of file + %uri=machines_url + "/" + @object.id + %name=@object.name + %description="#{@object.name} machine description" + %created=@object.launch_time || Time.new.getutc.to_s + %status=@object.state + %cpu=@object.instance_profile.overrides.select { |p, v| p == :architecture }.first || @profile.architecture.value + - memory_label, memory_value = @object.instance_profile.overrides.select { |p, v| p == :memory } + %memory{ :quantity => memory_value || @profile.memory.value, :units => Deltacloud::HardwareProfile::unit(:memory) }/ + %disk + - storage_label, storage_value = @object.instance_profile.overrides.select { |p, v| p == :storage } + %capacity{ :quantity => storage_value || @profile.storage.value, :units => Deltacloud::HardwareProfile::unit(:storage)}/ + %guestInterface SATA + %operation{ :rel => "edit", :href => machines_url + "/" + @object.id }/ + %operation{ :rel => "delete", :href => machines_url + "/" + @object.id }/ diff --git a/server/views/cimi/volumes/show.xml.haml b/server/views/cimi/volumes/show.xml.haml index 30ef2c2..5f34534 100644 --- a/server/views/cimi/volumes/show.xml.haml +++ b/server/views/cimi/volumes/show.xml.haml @@ -1,17 +1,10 @@ - unless defined?(partial) !!! XML %Volume{ :xmlns => CMWG_NAMESPACE } - %uri=volumes_url + "/" + @dmtfitem["uri"] - %name=@dmtfitem["name"] - %description=@dmtfitem["description"] - %created=@dmtfitem["created"] - - if @dmtfitem["property"] - - if @dmtfitem["property"]["name"] && @dmtfitem["property"]["content"] - - property_object = {"#{@dmtfitem['property']['name']}" => {"content" => @dmtfitem["property"]["content"]}} - - else - - property_object = @dmtfitem["property"] - - property_object.each_pair do |key, value| - %property{ :name => key}=value["content"] - %capacity{ :quantity => @dmtfitem["capacity"]["quantity"], :units => @dmtfitem["capacity"]["units"]} - %operation{ :rel => "edit", :href => volumes_url + "/" + @dmtfitem["uri"] } - %operation{ :rel => "delete", :href => volumes_url + "/" + @dmtfitem["uri"] } \ No newline at end of file + %uri=volumes_url + "/" + @object.id + %name=@object.name + %description="#{@object.name} volume description" + %created=@object.created || Time.new.getutc.to_s + %capacity{ :quantity => @object.capacity, :units => 'GB'} + %operation{ :rel => "edit", :href => volumes_url + "/" + @object.id } + %operation{ :rel => "delete", :href => volumes_url + "/" + @object.id } -- 1.7.4.4