This repository has been archived by the owner on Mar 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstances.erb
49 lines (37 loc) · 2.49 KB
/
instances.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<% @title = 'Instances' %>
<%= table(@instances, :aws_state, :aws_instance_id, :aws_availability_zone, :aws_instance_type, :aws_groups) %>
<br />
<% unless @instances.empty? %>
<div id="instances">
<% @instances.each_with_index do |instance, i| %>
<div class="instance<% if i % 2 == 1%> odd<% end %>">
[<b class="state state-<%= instance[:aws_state] %>">
<%= instance[:aws_instance_id] %>
<span title="<%= instance[:aws_instance_id] %>"><%= instance[:aws_state] %></span>
</b>]
<%= link_to instance[:aws_image_id], "/images/search/#{instance[:aws_image_id]}" %>
launched <%= time_ago_or_time_stamp(Time.parse(instance[:aws_launch_time])) %>
<%= link_to(image_tag('info.png', :alt => 'Console Output'), "/#{@project}/instance/#{instance[:aws_instance_id]}/output") %>
<% if instance[:aws_state] == 'running' %>
<%= link_to image_tag('reboot.png', :alt => 'Reboot Instance'), "/#{@project}/instance/#{instance[:aws_instance_id]}/reboot", :onclick => "return confirm('Reboot: Are you sure?')" %>
<%= link_to image_tag('minus.png', :alt => 'Terminate Instance'), "/#{@project}/instance/#{instance[:aws_instance_id]}/terminate", :onclick => "return confirm('Terminate: Are you sure?')" %>
<% end %>
<div>
<small>
Type: <%= instance[:aws_instance_type] %>, Groups: <% instance[:aws_groups].each do |group| %><%= link_to group, "/groups##{group}" %><% end %>,
Key: <%= link_to instance[:ssh_key_name], "/#{@project}/keys##{instance[:ssh_key_name]}" %>, Zone: <%= instance[:aws_availability_zone] %>
</small>
</div>
<% if instance[:aws_state] == 'running' %>
<div>
Public: <span><%= instance[:dns_name] %></span> <a href="http://<%= instance[:dns_name] %>" target="_new">url</a><br/>
Private: <span><%= instance[:private_dns_name] %></span>
</div>
<% end %>
</div>
<% end %>
</div>
<% else %>
<p><i>You have no current instances.</i></p>
<p><%= link_to 'Choose an image', "/#{@project}/images" %> to launch a new instance.</p>
<% end %>