From: Jan Provaznik <[email protected]>
---
.../controllers/resources/instances_controller.rb | 18 ++++++
src/app/views/resources/instances/show.haml | 60 ++++++++++++++++++++
src/config/routes.rb | 2 +-
3 files changed, 79 insertions(+), 1 deletions(-)
create mode 100644 src/app/views/resources/instances/show.haml
diff --git a/src/app/controllers/resources/instances_controller.rb
b/src/app/controllers/resources/instances_controller.rb
index c682d76..adad984 100644
--- a/src/app/controllers/resources/instances_controller.rb
+++ b/src/app/controllers/resources/instances_controller.rb
@@ -62,6 +62,11 @@ class Resources::InstancesController < ApplicationController
def edit
end
+ def show
+ @instance = Instance.find((params[:id] || []).first)
+ require_privilege(Privilege::INSTANCE_CONTROL,@instance.pool)
+ end
+
def start
end
@@ -86,6 +91,19 @@ class Resources::InstancesController < ApplicationController
)
end
+ def key
+ @instance = Instance.find((params[:id] || []).first)
+ require_privilege(Privilege::INSTANCE_CONTROL,@instance.pool)
+ unless @instance.instance_key.nil?
+ send_data @instance.instance_key.pem,
+ :filename => "#[email protected]_key.name}.pem",
+ :type => "text/plain"
+ return
+ end
+ flash[:warning] = "SSH Key not found for this Instance."
+ redirect_to resources_instance_path(@instance)
+ end
+
private
def init_new_instance_attrs
diff --git a/src/app/views/resources/instances/show.haml
b/src/app/views/resources/instances/show.haml
new file mode 100644
index 0000000..deb1a49
--- /dev/null
+++ b/src/app/views/resources/instances/show.haml
@@ -0,0 +1,60 @@
+%h2 Instance Details
+%ul
+ %li
+ = label_tag :name, 'Name'
+ %span= @instance.name
+ %li
+ = label_tag :status, 'Status'
+ %span= @instance.state
+ %li
+ = label_tag :public_addresses, 'Public Addresses'
+ %span= @instance.public_addresses
+ %li
+ = label_tag :private_addresses, 'Private Addresses'
+ %span= @instance.private_addresses
+ %li
+ = label_tag :operating_system, 'Operating system'
+ %span= "#[email protected]}
#[email protected]_version}"
+ %li
+ = label_tag :provider, 'Provider'
+ %span= @instance.cloud_account.provider.name if @instance.cloud_account
+ %li
+ = label_tag :base_template, 'Base Template'
+ %span= @instance.template.name
+ %li
+ = label_tag :architecture, 'Architecture'
+ %span= @instance.hardware_profile.architecture.value
+ %li
+ = label_tag :memory, 'Memory'
+ %span= @instance.hardware_profile.memory.value
+ %li
+ = label_tag :storage, 'Storage'
+ %span= @instance.hardware_profile.storage.value
+ %li
+ = label_tag :instantiation_time, 'Instantiation Time'
+ %span= @instance.created_at.strftime("%d-%b-%Y %H:%M:%S")
+ %li
+ = label_tag :uptime, 'Uptime'
+ %span= @instance.total_state_time(@instance.state)
+ %li
+ = label_tag :current_alerts, 'Current Alerts'
+ %span= 0
+ %li
+ = label_tag :console_connection, 'Console Connection'
+ %span= 'via SSH'
+ - unless @instance.instance_key_id.nil?
+ %li
+ = label_tag :instance_key, 'SSH key'
+ %span= link_to("Download", key_resources_instance_path(@instance))
+ %li
+ = label_tag :owner, 'Owner'
+ %span= "#[email protected]_name} #[email protected]_name}"
+ %li
+ = label_tag :shared_to, 'Shared to'
+ %span= "N/A"
+ - if @instance.state == Instance::STATE_ERROR
+ %li
+ = label_tag :error, 'Error'
+ %span= @instance.last_error
+
+= link_to 'Back', resources_instances_path, :class => 'button'
diff --git a/src/config/routes.rb b/src/config/routes.rb
index fc13895..827df84 100644
--- a/src/config/routes.rb
+++ b/src/config/routes.rb
@@ -34,7 +34,7 @@ ActionController::Routing::Routes.draw do |map|
map.namespace 'resources' do |r|
r.resources :pools, :deployments
- r.resources :instances, :collection => {:start => :get, :stop => :get,
:select_template => :get}
+ r.resources :instances, :collection => {:start => :get, :stop => :get,
:select_template => :get}, :member => {:key => :get}
end
map.namespace 'image_factory' do |r|
--
1.7.2.3
_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel