deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dko...@apache.org
Subject [3/8] git commit: CIMI: use id instead of name in urls in client UI
Date Mon, 15 Jul 2013 07:00:13 GMT
CIMI: use id instead of name in urls in client UI


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/1d8b3912
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/1d8b3912
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/1d8b3912

Branch: refs/heads/master
Commit: 1d8b3912cef23c8e1409ffb2f1742a4a58fbbfed
Parents: 7bab588
Author: Dies Koper <diesk@fast.au.fujitsu.com>
Authored: Mon Jul 15 10:28:15 2013 +1000
Committer: Dies Koper <diesk@fast.au.fujitsu.com>
Committed: Mon Jul 15 10:53:21 2013 +1000

----------------------------------------------------------------------
 clients/cimi/lib/entities/address.rb          | 2 +-
 clients/cimi/lib/entities/credential.rb       | 2 +-
 clients/cimi/lib/entities/machine.rb          | 2 +-
 clients/cimi/lib/entities/machine_template.rb | 2 +-
 clients/cimi/lib/entities/network.rb          | 2 +-
 clients/cimi/views/credentials/show.haml      | 4 ++--
 server/lib/cimi/service/machine_image.rb      | 2 +-
 7 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1d8b3912/clients/cimi/lib/entities/address.rb
----------------------------------------------------------------------
diff --git a/clients/cimi/lib/entities/address.rb b/clients/cimi/lib/entities/address.rb
index 95c76d8..665561e 100644
--- a/clients/cimi/lib/entities/address.rb
+++ b/clients/cimi/lib/entities/address.rb
@@ -43,7 +43,7 @@ class CIMI::Frontend::Address < CIMI::Frontend::Entity
       result = create_entity('addresses', address_xml, credentials)
       address = collection_class_for(:address).from_xml(result)
       flash[:success] = "Address was successfully created."
-      redirect "/cimi/addresses/#{address.name}", 302
+      redirect "/cimi/addresses/#{href_to_id(address.id)}", 302
     rescue => e
       flash[:error] = "Address cannot be created: #{e.message}"
     end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1d8b3912/clients/cimi/lib/entities/credential.rb
----------------------------------------------------------------------
diff --git a/clients/cimi/lib/entities/credential.rb b/clients/cimi/lib/entities/credential.rb
index 3916704..5b123e6 100644
--- a/clients/cimi/lib/entities/credential.rb
+++ b/clients/cimi/lib/entities/credential.rb
@@ -55,7 +55,7 @@ class CIMI::Frontend::Credential < CIMI::Frontend::Entity
       result = create_entity('credentials', credential_xml, credentials)
       cred = collection_class_for(:credential).from_xml(result)
       flash[:success] = "Credential was successfully created."
-      redirect "/cimi/credentials/#{cred.name}", 302
+      redirect "/cimi/credentials/#{href_to_id(cred.id)}", 302
     rescue => e
       flash[:error] = "Credential could not be created: #{e.message}"
       redirect(back)

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1d8b3912/clients/cimi/lib/entities/machine.rb
----------------------------------------------------------------------
diff --git a/clients/cimi/lib/entities/machine.rb b/clients/cimi/lib/entities/machine.rb
index 05f1e14..f193ebd 100644
--- a/clients/cimi/lib/entities/machine.rb
+++ b/clients/cimi/lib/entities/machine.rb
@@ -112,7 +112,7 @@ class CIMI::Frontend::Machine < CIMI::Frontend::Entity
       result = create_entity('machines', machine_xml, credentials)
       machine = collection_class_for(:machine).from_xml(result)
       flash[:success] = "Machine was successfully created."
-      redirect "/cimi/machines/#{machine.name}", 302
+      redirect "/cimi/machines/#{href_to_id machine.id}", 302
     rescue => e
       flash[:error] = "Machine cannot be created: #{e.message}"
     end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1d8b3912/clients/cimi/lib/entities/machine_template.rb
----------------------------------------------------------------------
diff --git a/clients/cimi/lib/entities/machine_template.rb b/clients/cimi/lib/entities/machine_template.rb
index c7a0717..334b731 100644
--- a/clients/cimi/lib/entities/machine_template.rb
+++ b/clients/cimi/lib/entities/machine_template.rb
@@ -44,7 +44,7 @@ class CIMI::Frontend::MachineTemplate < CIMI::Frontend::Entity
       result = create_entity('machine_templates', machine_template_xml, credentials)
       machine_template = collection_class_for(:machine_template).from_xml(result)
       flash[:success] = "Machine Template was successfully created."
-      redirect "/cimi/machine_templates/#{machine_template.name}", 302
+      redirect "/cimi/machine_templates/#{href_to_id(machine_template.id)}", 302
     rescue => e
       flash[:error] = "Machine Template cannot be created: #{e.message}"
     end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1d8b3912/clients/cimi/lib/entities/network.rb
----------------------------------------------------------------------
diff --git a/clients/cimi/lib/entities/network.rb b/clients/cimi/lib/entities/network.rb
index 361d4d9..d0c0013 100644
--- a/clients/cimi/lib/entities/network.rb
+++ b/clients/cimi/lib/entities/network.rb
@@ -56,7 +56,7 @@ class CIMI::Frontend::Network < CIMI::Frontend::Entity
       result = create_entity('networks', network_xml, credentials)
       network = collection_class_for(:network).from_xml(result)
       flash[:success] = "Network was successfully created."
-      redirect "/cimi/networks/#{network.name}", 302
+      redirect "/cimi/networks/#{href_to_id(network.id)}", 302
     rescue => e
       flash[:error] = "Network cannot be created: #{e.message}"
     end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1d8b3912/clients/cimi/views/credentials/show.haml
----------------------------------------------------------------------
diff --git a/clients/cimi/views/credentials/show.haml b/clients/cimi/views/credentials/show.haml
index 6a9ac76..5908ff5 100644
--- a/clients/cimi/views/credentials/show.haml
+++ b/clients/cimi/views/credentials/show.haml
@@ -15,8 +15,8 @@
   %p
     %a{ :href => "#{@cred.id}?format=xml", :class => 'label warning' } XML
     %a{ :href => "#{@cred.id}?format=json", :class => 'label warning' } JSON
-  %p
-    %form{ :action => "/cimi/credentials/#{@cred.name}/delete", :method => :post, :style
=> 'display:inline'}
+  %p}
+    %form{ :action => "/cimi/credentials/#{href_to_id @cred.id}/delete", :method =>
:post, :style => 'display:inline'}
       %input{ :type => :hidden, :name => '_method', :value => 'delete'}
       %button{ :class => 'btn btn-danger'} Destroy
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1d8b3912/server/lib/cimi/service/machine_image.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/service/machine_image.rb b/server/lib/cimi/service/machine_image.rb
index 17d9220..ede8559 100644
--- a/server/lib/cimi/service/machine_image.rb
+++ b/server/lib/cimi/service/machine_image.rb
@@ -29,7 +29,7 @@ class CIMI::Service::MachineImage < CIMI::Service::Base
   def self.from_image(image, context)
     self.new(context, :values => {
       :id => context.machine_image_url(image.id),
-      :name => image.id,
+      :name => image.name,
       :description => image.description,
       :state => image.state || 'UNKNOWN',
       :type => "IMAGE",


Mime
View raw message