Skip to content
This repository has been archived by the owner on Mar 7, 2023. It is now read-only.

Commit

Permalink
implemented create and delete security group - added new lightbox code
Browse files Browse the repository at this point in the history
  • Loading branch information
moomerman committed Oct 28, 2008
1 parent 06a33a6 commit 2e6ec37
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 4 deletions.
27 changes: 27 additions & 0 deletions public/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,30 @@ body {

#images .image {margin-bottom:10px;}
#images .odd {background-color:#A6CDDE;}

.lightbox_overlay {
display: none;
position: absolute;
top: 0%;
left: 0%;
width: 100%;
height: 100%;
background-color: black;
z-index:1001;
-moz-opacity: 0.8;
opacity:.80;
filter: alpha(opacity=80);
}
.lightbox {
display: none;
position: absolute;
top: 15%;
left: 25%;
width: 50%;
height: 50%;
padding: 16px;
border: 10px solid orange;
background-color: white;
z-index:1002;
overflow: auto;
}
9 changes: 8 additions & 1 deletion snail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@
erb :groups
end

get '/group/:group_name/delete' do
@ec2.delete_security_group(params[:group_name])
redirect '/groups'
end

get '/group/:group_name/revoke' do
if params[:group]
@ec2.revoke_security_group_named_ingress(params[:group_name], params[:owner], params[:group])
Expand All @@ -127,7 +132,9 @@
redirect '/groups'
end

post '/group/:group_name' do
post '/group' do
@ec2.create_security_group(params[:name], params[:description])
redirect '/groups'
end

# SSH Key Pairs
Expand Down
2 changes: 1 addition & 1 deletion views/_layout_header.erb
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<h1>Snail</h1>
<h1>Snail - The Amazon Web Services Manager</h1>
20 changes: 18 additions & 2 deletions views/groups.erb
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<% @title = 'Security Groups' %>

<p><%= link_to image_tag('add.png', :alt => 'Create a new Security Group'), '#' %> Create a new Secutiry Group</p>
<p><%= link_to image_tag('add.png', :alt => 'Create a new Security Group'), '#', :onclick => "$('#group_create').toggle();$('#overlay').toggle()" %> Create a new Security Group</p>
<br/>
<% @groups.each do |group| %>
<div id="group_<%= group[:aws_group_name] %>" class="group">
<b><%= group[:aws_group_name] %></b> <%= group[:aws_description] %>
<%= link_to image_tag('minus.png', :alt => 'Delete Security Group'), '#' %>
<%= link_to image_tag('minus.png', :alt => 'Delete Security Group'), "/group/#{group[:aws_group_name]}/delete", :onclick => "return confirm('Delete Security Group: Are you sure?')" %>
<br/>
<small>
<% group[:aws_perms].each do |perm| %>
Expand All @@ -26,4 +26,20 @@
<%= link_to '+ Add new rule', '#' %>
</small>
</div>

<% end %>

<div id="group_create" class="lightbox">
<h2>Create A Security Group</h2>
<form action="/group" method="POST">
<p>Group Name: <input type="text" name="name" /></p>
<p>Group Description: <input type="text" name="description" /></p>
<p><input type="submit" value="create"/> <%= link_to 'Cancel', '#', :onclick => "$('#group_create').toggle();$('#overlay').toggle()" %></p>
</form>
</div>

<div id="group_add_permission" class="lightbox">
perm
</div>

<div id="overlay" class="lightbox_overlay"/>

0 comments on commit 2e6ec37

Please sign in to comment.