From: Tomas Sedovic <tsedovic(a)redhat.com>
---
src/app/models/instance.rb | 5 +++++
src/app/views/deployments/_pretty_view_show.haml | 7 +++++--
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/app/models/instance.rb b/src/app/models/instance.rb
index 5b69717..b682c06 100644
--- a/src/app/models/instance.rb
+++ b/src/app/models/instance.rb
@@ -361,11 +361,16 @@ class Instance < ActiveRecord::Base
{:include => :hardware_profile}
}
+ def instance_key_path
+ Rails.application.routes.url_helpers.key_instance_path(self) if instance_key
+ end
+
def as_json(options={})
super(options).merge({
:owner => owner.name,
:provider => provider_account ? provider_account.provider.name : '',
:href => Rails.application.routes.url_helpers.instance_path(id),
+ :instance_key_path => instance_key_path,
})
end
diff --git a/src/app/views/deployments/_pretty_view_show.haml b/src/app/views/deployments/_pretty_view_show.haml
index c849622..4f7fe6a 100644
--- a/src/app/views/deployments/_pretty_view_show.haml
+++ b/src/app/views/deployments/_pretty_view_show.haml
@@ -11,9 +11,9 @@
%li
State:
= instance.state
- - if instance.instance_key
+ - if instance.instance_key_path
%li
- = link_to("Download key", key_instance_path(instance))
+ = link_to("Download key", instance.instance_key_path)
:javascript
Conductor.setupPrettyFilterURL(
@@ -26,5 +26,8 @@
<ul>
<li>IP Address: ${public_addresses}</li>
<li>State: ${state}</li>
+ {{if instance_key_path}}
+ <li><a href="${instance_key_path}">Download key</a></li>
+ {{/if}}
</ul>
</li>
--
1.7.6