From: David Lutterkort <lut...@redhat.com>
Signed-off-by: David Lutterkort <lut...@redhat.com> --- server/lib/cimi/server.rb | 39 ++++++++++++-------- server/views/cimi/machine/show.html.haml | 4 +- .../cimi/machine_configuration/show.html.haml | 4 +- server/views/cimi/machine_image/show.html.haml | 4 +- server/views/cimi/volume/show.html.haml | 4 +- 5 files changed, 31 insertions(+), 24 deletions(-) diff --git a/server/lib/cimi/server.rb b/server/lib/cimi/server.rb index 1dc5783..2b4848e 100644 --- a/server/lib/cimi/server.rb +++ b/server/lib/cimi/server.rb @@ -94,7 +94,7 @@ EOS end end -collection :machine_configuration do +collection :machine_configurations do global! description <<EOS @@ -108,7 +108,8 @@ EOS @dmtf_col_items = [] if profiles profiles.map do |profile| - new_item = { "name" => profile.name, "href" => api_url_for("/machine_configuration/" + profile.name) } + new_item = { "name" => profile.name, + "href" => machine_configuration_url(profile.name) } @dmtf_col_items.insert 0, new_item end end @@ -127,7 +128,7 @@ EOS resource_default = get_resource_default "machine_configuration" #get the actual values from profile resource_value = { "name" => @profile.name,"uri" => @profile.name, - "href" => api_url_for("/machine_configuration/" + @profile.name) } + "href" => machine_configuration_url(@profile.name) } #mixin actual values get from profile @dmtfitem = resource_default["dmtfitem"].merge resource_value show_resource "machine_configuration/show", "MachineConfiguration" @@ -138,7 +139,7 @@ EOS end end -collection :machine_image do +collection :machine_images do global! description <<EOS @@ -152,7 +153,8 @@ EOS @dmtf_col_items = [] if images images.map do |image| - new_item = { "name" => image.name,"href" => api_url_for("/machine_image/" + image.id) } + new_item = { "name" => image.name, + "href" => machine_image_url(image.id) } @dmtf_col_items.insert 0, new_item end end @@ -170,8 +172,9 @@ EOS #setup the default values for a machine imageion resource_default = get_resource_default "machine_image" #get the actual values from image - resource_value = { "name" => @image.name,"description" => @image.description, - "uri" => @image.id,"href" => api_url_for("/machine_image/" + @image.id) } + resource_value = { "name" => @image.name, + "description" => @image.description, + "uri" => @image.id,"href" => machine_image_url(@image.id) } #mixin actual values get from the specific image @dmtfitem = resource_default["dmtfitem"].merge resource_value show_resource "machine_image/show", "MachineImage" @@ -183,7 +186,7 @@ EOS end -collection :machine do +collection :machines do global! description <<EOS @@ -197,7 +200,8 @@ EOS @dmtf_col_items = [] if instances instances.map do |instance| - new_item = { "name" => instance.name, "href" => api_url_for("/machine/" + instance.id) } + new_item = { "name" => instance.name, + "href" => machine_url(instance.id) } @dmtf_col_items.insert 0, new_item end end @@ -215,8 +219,9 @@ EOS #setup the default values for a machine imageion resource_default = get_resource_default "machine" #get the actual values from image - resource_value = { "name" => @machine.name,"status" => @machine.state, "uri" => @machine.id, - "href" => api_url_for("/machine/" + @machine.id) } + resource_value = { "name" => @machine.name, + "status" => @machine.state, "uri" => @machine.id, + "href" => machine_url(@machine.id) } #mixin actual values get from the specific image @dmtfitem = resource_default["dmtfitem"].merge resource_value show_resource "machine/show", "Machine" @@ -228,7 +233,7 @@ EOS end -collection :volume do +collection :volumes do global! description <<EOS @@ -242,7 +247,8 @@ EOS @dmtf_col_items = [] if instances instances.map do |instance| - new_item = { "name" => instance.id, "href" => api_url_for("/volume/" + instance.id) } + new_item = { "name" => instance.id, + "href" => volume_url(instance.id) } @dmtf_col_items.insert 0, new_item end end @@ -260,9 +266,10 @@ EOS #setup the default values for a machine imageion resource_default = get_resource_default "volume" #get the actual values from image - resource_value = { "name" => @volume.id,"status" => @volume.state, "uri" => @volume.id, - "href" => api_url_for("/volume/" + @volume.id), - "capacity" => { "quantity" => @volume.capacity, "units" => "gigabyte"} } + resource_value = { "name" => @volume.id, + "status" => @volume.state, "uri" => @volume.id, + "href" => volume_url(@volume.id), + "capacity" => { "quantity" => @volume.capacity, "units" => "gigabyte"} } #mixin actual values get from the specific image @dmtfitem = resource_default["dmtfitem"].merge resource_value show_resource "volume/show", "Volume" diff --git a/server/views/cimi/machine/show.html.haml b/server/views/cimi/machine/show.html.haml index 5945c6a..c29ddff 100644 --- a/server/views/cimi/machine/show.html.haml +++ b/server/views/cimi/machine/show.html.haml @@ -1,9 +1,9 @@ %h1 View/Edit machine -%form{ :action => api_url_for("/machine") } +%form{ :action => machines_url } %input{ :name => :id, :type => :hidden, :value => @dmtfitem["uri"] }/ %input{ :name => :xmlRootNode, :type => :hidden, :value => @xml_root_node }/ - %input{ :name => :refreshURI, :type => :hidden, :value => api_url_for("/machine") }/ + %input{ :name => :refreshURI, :type => :hidden, :value => machines_url }/ %p %label Name: diff --git a/server/views/cimi/machine_configuration/show.html.haml b/server/views/cimi/machine_configuration/show.html.haml index 7db4b5b..38dc867 100644 --- a/server/views/cimi/machine_configuration/show.html.haml +++ b/server/views/cimi/machine_configuration/show.html.haml @@ -1,9 +1,9 @@ %h1 View/Edit machine configuration -%form{ :action => api_url_for("/machineConfiguration") } +%form{ :action => machine_configurations_url } %input{ :name => :id, :type => :hidden, :value => @dmtfitem["uri"] }/ %input{ :name => :xmlRootNode, :type => :hidden, :value => @xml_root_node }/ - %input{ :name => :refreshURI, :type => :hidden, :value => api_url_for("/collection/machineConfiguration") }/ + %input{ :name => :refreshURI, :type => :hidden, :value => machine_configurations_url }/ %p %label Name: diff --git a/server/views/cimi/machine_image/show.html.haml b/server/views/cimi/machine_image/show.html.haml index 3ab9e5f..1c3a28e 100644 --- a/server/views/cimi/machine_image/show.html.haml +++ b/server/views/cimi/machine_image/show.html.haml @@ -1,9 +1,9 @@ %h1 View/Edit machine image -%form{ :action => api_url_for("/machineImage") } +%form{ :action => machine_images_url } %input{ :name => :id, :type => :hidden, :value => @dmtfitem["uri"] }/ %input{ :name => :xmlRootNode, :type => :hidden, :value => @xml_root_node }/ - %input{ :name => :refreshURI, :type => :hidden, :value => api_url_for("/collection/machineImage") }/ + %input{ :name => :refreshURI, :type => :hidden, :value => machine_images_url }/ %p %label Name: diff --git a/server/views/cimi/volume/show.html.haml b/server/views/cimi/volume/show.html.haml index 2dcf1e8..0e7b20b 100644 --- a/server/views/cimi/volume/show.html.haml +++ b/server/views/cimi/volume/show.html.haml @@ -1,9 +1,9 @@ %h1 View/Edit volume -%form{ :action => api_url_for("/volume") } +%form{ :action => volumes_url } %input{ :name => :id, :type => :hidden, :value => @dmtfitem["uri"] }/ %input{ :name => :xmlRootNode, :type => :hidden, :value => @xml_root_node }/ - %input{ :name => :refreshURI, :type => :hidden, :value => api_url_for("/volume") }/ + %input{ :name => :refreshURI, :type => :hidden, :value => volumes_url }/ %p %label Name: -- 1.7.6