staypuft 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/staypuft/nics_assignment.js +32 -0
  3. data/app/assets/javascripts/staypuft/staypuft.js +38 -0
  4. data/app/assets/javascripts/staypuft/subnets_assignment.js +40 -0
  5. data/app/assets/stylesheets/staypuft/bootstrap_and_overrides.css.scss +5 -1
  6. data/app/assets/stylesheets/staypuft/staypuft.css.scss +102 -0
  7. data/app/controllers/staypuft/deployments_controller.rb +5 -0
  8. data/app/controllers/staypuft/interface_assignments_controller.rb +76 -0
  9. data/app/controllers/staypuft/steps_controller.rb +15 -1
  10. data/app/controllers/staypuft/subnet_typings_controller.rb +42 -0
  11. data/app/helpers/staypuft/deployments_helper.rb +18 -3
  12. data/app/lib/actions/staypuft/hostgroup/deploy.rb +38 -1
  13. data/app/lib/staypuft/network_query.rb +35 -0
  14. data/app/lib/staypuft/seeder.rb +113 -39
  15. data/app/models/staypuft/concerns/host_interface_management.rb +28 -0
  16. data/app/models/staypuft/deployment.rb +35 -3
  17. data/app/models/staypuft/interface_assigner.rb +137 -0
  18. data/app/models/staypuft/layout.rb +3 -0
  19. data/app/models/staypuft/layout_subnet_type.rb +12 -0
  20. data/app/models/staypuft/role.rb +15 -0
  21. data/app/models/staypuft/subnet_type.rb +27 -0
  22. data/app/models/staypuft/subnet_typing.rb +11 -0
  23. data/app/views/staypuft/deployments/_assigned_hosts.html.erb +5 -2
  24. data/app/views/staypuft/deployments/_assigned_hosts_table.html.erb +13 -46
  25. data/app/views/staypuft/deployments/_deployed_hosts_table.html.erb +12 -33
  26. data/app/views/staypuft/deployments/_deployment_overview.html.erb +12 -9
  27. data/app/views/staypuft/deployments/_deployment_summary.html.erb +18 -0
  28. data/app/views/staypuft/deployments/_empty_hosts.html.erb +8 -0
  29. data/app/views/staypuft/deployments/_free_hosts.html.erb +1 -1
  30. data/app/views/staypuft/deployments/_free_hosts_table.html.erb +11 -34
  31. data/app/views/staypuft/deployments/_host_head_row.html.erb +11 -0
  32. data/app/views/staypuft/deployments/_host_row.html.erb +30 -0
  33. data/app/views/staypuft/deployments/_hosts_header.html.erb +7 -0
  34. data/app/views/staypuft/deployments/index.html.erb +1 -1
  35. data/app/views/staypuft/deployments/show.html.erb +2 -2
  36. data/app/views/staypuft/interface_assignments/create.js.erb +12 -0
  37. data/app/views/staypuft/interface_assignments/destroy.js.erb +12 -0
  38. data/app/views/staypuft/interface_assignments/index.html.erb +38 -0
  39. data/app/views/staypuft/interfaces/_drop_zone.html.erb +30 -0
  40. data/app/views/staypuft/steps/network_configuration.html.erb +52 -0
  41. data/app/views/staypuft/steps/services_configuration.html.erb +45 -39
  42. data/app/views/staypuft/steps/services_overview.html.erb +1 -1
  43. data/app/views/staypuft/subnet_types/_subnet_type_pull.html.erb +9 -0
  44. data/app/views/staypuft/subnet_typings/create.js.erb +12 -0
  45. data/app/views/staypuft/subnet_typings/destroy.js.erb +12 -0
  46. data/app/views/staypuft/subnet_typings/update.js.erb +14 -0
  47. data/app/views/staypuft/subnets/_drop_zone.html.erb +16 -0
  48. data/app/views/staypuft/subnets/_subnet_pull.html.erb +9 -0
  49. data/config/routes.rb +3 -0
  50. data/db/migrate/20140701074900_create_subnet_type.rb +9 -0
  51. data/db/migrate/20140701075033_create_layout_subnet.rb +10 -0
  52. data/db/migrate/20140701090256_create_staypuft_subnet_typings.rb +14 -0
  53. data/db/migrate/20140825164900_add_orchestration_to_staypuft_role.rb +5 -0
  54. data/db/migrate/20140831234000_add_required_to_subnet_types.rb +5 -0
  55. data/db/seeds.rb +1 -1
  56. data/lib/staypuft/engine.rb +11 -8
  57. data/lib/staypuft/version.rb +1 -1
  58. metadata +135 -91
@@ -1,51 +1,30 @@
1
1
  <div class="tab-pane" id="<%= child_hostgroup.name.parameterize.underscore %>_deployed_hosts">
2
- <% if child_hostgroup.hosts.select { |h| !ForemanTasks::Lock.locked?(deployment, nil) && h.open_stack_deployed? }.present? %>
2
+ <% if hosts.present? %>
3
3
  <%= form_tag(unassign_host_deployment_path(id: deployment), class: 'form-horizontal well association') do |f| %>
4
4
  <%= submit_tag _("Unassign Hosts"),
5
5
  :class => "btn btn-danger btn-sm pull-left",
6
6
  :'data-toggle' => "tooltip",
7
7
  :'data-placement' => "right",
8
8
  :title => _("Unassigning deployed hosts may lead to unexpected problems.") %>
9
- <h4 class="pull-left"><%= _("Deployed Hosts") %></h4>
10
- <button type="button" class="close" aria-hidden="true">×</button>
11
- <p class="clearfix"></p>
12
- <%= hidden_field_tag :hostgroup_id, child_hostgroup.id %>
9
+
10
+ <%= render 'hosts_header', :header => _("Deployed Hosts"), :child_hostgroup => child_hostgroup, :assign_text => false %>
11
+
13
12
  <table class="table table-bordered table-striped table-condensed">
14
13
  <thead>
15
- <tr>
16
- <th class="ca">
17
- <%= tag :input, type: 'checkbox', class: 'check_all' %>
18
- </th>
19
- <th><%= sort :name, :as => _('Name') %></th>
20
- <th class="hidden-s hidden-xs"><%= sort :ip, :as => _('IP Address') %></th>
21
- </tr>
14
+ <%= render 'host_head_row' %>
22
15
  </thead>
23
16
  <tbody>
24
- <% child_hostgroup.hosts.select{ |h| !ForemanTasks::Lock.locked?(deployment, nil) && h.open_stack_deployed? }.each do |host| %>
25
- <tr class="checkbox_highlight deployed">
26
- <td class="ca">
27
- <%= check_box_tag 'host_ids[]',
28
- host.id,
29
- false,
30
- id: "host_ids_#{host.id}" %>
31
- </td>
32
- <td class="ellipsis">
33
- <%= host_label(host) %>
34
- </td>
35
- <td class="hidden-s hidden-xs"><%= host.ip %></td>
36
- </tr>
17
+ <% hosts.each do |host| %>
18
+ <%= render 'host_row',
19
+ :custom_css_class => 'deployed',
20
+ :host => host,
21
+ :checkbox_value => false %>
37
22
  <% end %>
38
23
  </tbody>
39
24
  </table>
25
+
40
26
  <% end %>
41
27
  <% else %>
42
- <div class="well association">
43
- <button type="button" class="close pull-right" aria-hidden="true">×</button>
44
- <h4><%= _("Deployed Hosts") %></h4>
45
- <div class="alert alert-warning">
46
- <span class="glyphicon glyphicon-warning-sign">&nbsp;</span>
47
- <%= _("No hosts from this group have been deployed yet.") %>
48
- </div>
49
- </div>
28
+ <%= render 'empty_hosts', :header => _("Deployed Hosts"), :message => _("No hosts from this group have been deployed yet.") %>
50
29
  <% end %>
51
30
  </div>
@@ -44,15 +44,18 @@
44
44
 
45
45
  <div class="tab-content col-md-8">
46
46
  <% @deployment.child_hostgroups.deploy_order.each_with_index do |child_hostgroup, i| %>
47
- <%= render :partial => "free_hosts_table", :locals => { :deployment => @deployment,
48
- :hostgroup => @hostgroup,
49
- :child_hostgroup => child_hostgroup } %>
50
- <%= render :partial => "assigned_hosts_table", :locals => { :deployment => @deployment,
51
- :hostgroup => @hostgroup,
52
- :child_hostgroup => child_hostgroup } %>
53
- <%= render :partial => "deployed_hosts_table", :locals => { :deployment => @deployment,
54
- :hostgroup => @hostgroup,
55
- :child_hostgroup => child_hostgroup } %>
47
+ <%= render 'free_hosts_table', :deployment => @deployment,
48
+ :hostgroup => @hostgroup,
49
+ :child_hostgroup => child_hostgroup,
50
+ :hosts => child_hostgroup.free_hosts %>
51
+ <%= render 'assigned_hosts_table', :deployment => @deployment,
52
+ :hostgroup => @hostgroup,
53
+ :child_hostgroup => child_hostgroup,
54
+ :hosts => child_hostgroup.hosts %>
55
+ <%= render 'deployed_hosts_table', :deployment => @deployment,
56
+ :hostgroup => @hostgroup,
57
+ :child_hostgroup => child_hostgroup,
58
+ :hosts => child_hostgroup.hosts.select { |h| !ForemanTasks::Lock.locked?(@deployment, nil) && h.open_stack_deployed? } %>
56
59
  <% end %>
57
60
  <%= render :partial => "deployment_summary", :locals => { :deployment => @deployment } %>
58
61
  </div>
@@ -6,6 +6,24 @@
6
6
  <div class="row">
7
7
  <div class="col-sm-12 text-center"><h3 class="text-muted"><%= _("Deployed") %></h3></div>
8
8
  </div>
9
+ <div class="row ceph_notification <% if @deployment.hide_ceph_notification? %>hide<% end %>">
10
+ <div class="col-sm-8 col-sm-offset-1">
11
+ <div class="row">
12
+ <div class="col-sm-1 col-sm-offset-2"><h3 class="glyphicon glyphicon-info-sign text-muted"></h3></div>
13
+ <div class="col-sm-8"><h3 class="text-muted"><%= _("Information")%></h3></div>
14
+ </div>
15
+ <div class="row">
16
+ <div class="col-sm-8 col-sm-offset-2">
17
+ <%= _("Ceph Hosts need to be configured manually. Please follow instructions in Ceph Installation documentation.") %>
18
+ </div>
19
+ </div>
20
+ <div class="row">
21
+ <div class="col-sm-10 col-sm-offset-2">
22
+ <a href="" id="ceph_notification_dismissal"><span class="glyphicon glyphicon-remove"></span><%= _("Dismiss this notification") %></a>
23
+ </div>
24
+ </div>
25
+ </div>
26
+ </div>
9
27
  <div class="row">
10
28
  <div class="col-sm-8 col-sm-offset-2">
11
29
  <form class="form-horizontal">
@@ -0,0 +1,8 @@
1
+ <div class="well association">
2
+ <button type="button" class="close pull-right" aria-hidden="true">×</button>
3
+ <h4><%= header %></h4>
4
+ <div class="alert alert-warning">
5
+ <span class="glyphicon glyphicon-warning-sign">&nbsp;</span>
6
+ <%= message %>
7
+ </div>
8
+ </div>
@@ -42,7 +42,7 @@
42
42
  </td>
43
43
  <td><%= host.cpus %></td>
44
44
  <td><%= host.mem %></td>
45
- <td><%= host.network_interfaces.join('<br/>') if host.network_interfaces %></td>
45
+ <td><%= host_nics(host) %></td>
46
46
  <td class="hidden-s hidden-xs"><%= host.ip %></td>
47
47
  </tr>
48
48
  <% end %>
@@ -1,47 +1,24 @@
1
1
  <div class="tab-pane" id="<%= child_hostgroup.name.parameterize.underscore %>_free_hosts">
2
- <% if child_hostgroup.free_hosts.present? %>
2
+ <% if hosts.present? %>
3
3
  <%= form_tag(associate_host_deployment_path(id: deployment), class: 'form-horizontal well association') do |f| %>
4
- <h4 class="pull-left"><%= _("Free Hosts") %></h4>
5
- <button type="button" class="close pull-right" aria-hidden="true">&nbsp;&nbsp;×</button>
6
- <%= submit_tag _("Assign Hosts"), :class => "btn btn-primary btn-sm pull-right" %>
7
- <p class="clearfix"></p>
8
- <%= hidden_field_tag :hostgroup_id, child_hostgroup.id %>
4
+
5
+ <%= render 'hosts_header', :header => _("Free Hosts"), :child_hostgroup => child_hostgroup, :assign_text => _("Assign Hosts") %>
6
+
9
7
  <table class="table table-bordered table-striped table-condensed">
10
8
  <thead>
11
- <tr>
12
- <th class="ca">
13
- <%= tag :input, type: 'checkbox', class: 'check_all' %>
14
- </th>
15
- <th><%= sort :name, :as => _('Name') %></th>
16
- <th class="hidden-s hidden-xs"><%= sort :ip, :as => _('IP Address') %></th>
17
- </tr>
9
+ <%= render 'host_head_row' %>
18
10
  </thead>
19
11
  <tbody>
20
- <% child_hostgroup.free_hosts.each do |host| %>
21
- <tr class="checkbox_highlight">
22
- <td class="ca">
23
- <%= check_box_tag 'host_ids[]',
24
- host.id,
25
- child_hostgroup.host_ids.include?(host.id),
26
- id: "host_ids_#{host.id}" %>
27
- </td>
28
- <td class="ellipsis">
29
- <%= host_label(host) %>
30
- </td>
31
- <td class="hidden-s hidden-xs"><%= host.ip %></td>
32
- </tr>
12
+ <% hosts.each do |host| %>
13
+ <%= render 'host_row',
14
+ :host => host,
15
+ :checkbox_value => child_hostgroup.host_ids.include?(host.id) %>
33
16
  <% end %>
34
17
  </tbody>
35
18
  </table>
19
+
36
20
  <% end %>
37
21
  <% else %>
38
- <div class="well association">
39
- <button type="button" class="close pull-right" aria-hidden="true">×</button>
40
- <h4><%= _("Free Hosts") %></h4>
41
- <div class="alert alert-warning">
42
- <span class="glyphicon glyphicon-warning-sign">&nbsp;</span>
43
- <%= _("All available hosts have been already assigned.") %>
44
- </div>
45
- </div>
22
+ <%= render 'empty_hosts', :header => _("Free Hosts"), :message => _("All available hosts have been already assigned.") %>
46
23
  <% end %>
47
24
  </div>
@@ -0,0 +1,11 @@
1
+ <tr>
2
+ <th class="ca">
3
+ <%= tag :input, type: 'checkbox', class: 'check_all' %>
4
+ </th>
5
+ <th><%= sort :name, :as => _('Name') %></th>
6
+ <th><%= _('NICs') %></th>
7
+ <% if local_assigns[:deploying_col] %>
8
+ <th class="hidden-s hidden-xs"><%= _('Deploying?') %></th>
9
+ <% end %>
10
+ <th class="hidden-s hidden-xs"><%= sort :ip, :as => _('IP Address') %></th>
11
+ </tr>
@@ -0,0 +1,30 @@
1
+ <tr class="checkbox_highlight <%= local_assigns[:custom_css_class] %>">
2
+ <td class="ca">
3
+ <%= check_box_tag 'host_ids[]',
4
+ host.id,
5
+ checkbox_value,
6
+ id: "host_ids_#{host.id}",
7
+ disabled: local_assigns[:disabled]%>
8
+ <%= hidden_field_tag 'host_ids[]', host.id if local_assigns[:disabled] %>
9
+ </td>
10
+
11
+ <td class="ellipsis">
12
+ <%= host_label(host) %>
13
+ </td>
14
+
15
+ <td>
16
+ <%= host_nics(host) %>
17
+ </td>
18
+
19
+ <% unless local_assigns[:disabled].nil? %>
20
+ <td class="hidden-s hidden-xs">
21
+ <% if disabled %>
22
+ <span class="glyphicon glyphicon-cloud-upload"></span>
23
+ <% else %>
24
+ <span class="glyphicon glyphicon-minus"></span>
25
+ <% end %>
26
+ </td>
27
+ <% end %>
28
+
29
+ <td class="hidden-s hidden-xs"><%= host.ip %></td>
30
+ </tr>
@@ -0,0 +1,7 @@
1
+ <h4 class="pull-left"><%= header %></h4>
2
+ <button type="button" class="close pull-right" aria-hidden="true">&nbsp;&nbsp;×</button>
3
+ <% if assign_text %>
4
+ <%= submit_tag assign_text, :class => "btn btn-primary btn-sm pull-right" %>
5
+ <% end %>
6
+ <p class="clearfix"></p>
7
+ <%= hidden_field_tag :hostgroup_id, child_hostgroup.id %>
@@ -1,6 +1,6 @@
1
1
  <% title _("OpenStack Deployments") %>
2
2
 
3
- <% title_actions display_link_if_authorized(_("New Deployment"), hash_for_new_deployment_path, :class => 'btn-success'), help_path %>
3
+ <% title_actions display_link_if_authorized(_("New Deployment"), hash_for_new_deployment_path, :class => 'btn btn-success'), help_path %>
4
4
 
5
5
  <% if @deployments.present? %>
6
6
 
@@ -3,7 +3,7 @@
3
3
  <% sub_nav = [ {:title => _("Overview"), :target_id => '#overview', :active => true},
4
4
  {:title => _("Hosts"), :target_id => '#hosts'},
5
5
  # {:title => _("Networking"), :target_id => '#networking'},
6
- {:title => _("Advanced Configuration"), :target_id => '#advanced_configuration'} ] %>
6
+ {:title => _("Advanced Configuration"), :target_id => '#advanced_configuration'} ] %>
7
7
  <%= tabbed_nav_menu(sub_nav, 'sub-navigation', 'nav nav-tabs') %>
8
8
 
9
9
  <div id="sub-navigation-tabs" class="tab-content">
@@ -14,7 +14,7 @@
14
14
  <%= render :partial => "deployment_hosts", :locals => { :deployment => @deployment } %>
15
15
  </div>
16
16
  <!--<div class="tab-pane" id="networking">-->
17
- <!--<%= render :partial => "deployment_networking", :locals => { :deployment => @deployment } %>-->
17
+ <!--<%= render :partial => "deployment_networking", :locals => { :deployment => @deployment } %>-->
18
18
  <!--</div>-->
19
19
  <div class="tab-pane" id="advanced_configuration">
20
20
  <%= render :partial => "advanced_configuration", :locals => { :deployment => @deployment } %>
@@ -0,0 +1,12 @@
1
+ <% if @saved %>
2
+ $("#<%= dom_id(@subnet) %>").remove();
3
+ $("#<%= params[:interface] %>-<%= @assigner.virtual_assignment? ? 'virtuals' : 'physicals' %>").prepend(
4
+ '<%=j render :partial => 'staypuft/subnets/subnet_pull',
5
+ :object => @subnet,
6
+ :as => 'subnet',
7
+ :locals => { :active => !is_pxe?(@deployment, @subnet), :deployment => @deployment, :existing => true } %>');
8
+ $("#<%= dom_id(@subnet) %>").draggable({revert: 'invalid'});
9
+ <% else %>
10
+ error = '<%=j @errors.map { |k, v| "#{h(k)}: #{v.join(', ')}" }.join('<br />').html_safe %>';
11
+ $.jnotify(error, { type: "error", sticky: true });
12
+ <% end %>
@@ -0,0 +1,12 @@
1
+ <% if @destroyed %>
2
+ $("#<%= dom_id(@subnet) %>").remove();
3
+ $("#subnets").append(
4
+ '<%=j render :partial => 'staypuft/subnets/subnet_pull',
5
+ :object => @subnet,
6
+ :as => 'subnet',
7
+ :locals => { :active => !is_pxe?(@deployment, @subnet), :deployment => @deployment, :existing => false } %>');
8
+ $("#<%= dom_id(@subnet) %>").draggable({revert: 'invalid'});
9
+ <% else %>
10
+ error = '<%=j @errors.map { |k, v| "#{k}: #{v.join(', ')}" }.join('<br />') %>';
11
+ $.jnotify(error, { type: "error", sticky: true });
12
+ <% end %>
@@ -0,0 +1,38 @@
1
+ <%= javascript 'staypuft/nics_assignment' %>
2
+
3
+ <% title _("Configure Interfaces (%s hosts)") % @hosts.size %>
4
+
5
+ <div id="subnets">
6
+ <h2><%= _("Configured Networks") %></h2>
7
+ <% @subnets.each do |subnet| %>
8
+ <% next if is_pxe?(@deployment, subnet) # we skip PXE network which is always on primary interface %>
9
+ <% next if @host.interfaces.where(:subnet_id => subnet.id).present? # we skip assigned subnets %>
10
+ <%= render 'staypuft/subnets/subnet_pull',
11
+ :subnet => subnet,
12
+ :deployment => @deployment,
13
+ :active => true,
14
+ :existing => false %>
15
+ <% end %>
16
+ </div>
17
+
18
+ <div class="cleared"></div>
19
+ <br />
20
+ <h2><%= _("Network Interfaces") %></h2>
21
+
22
+ <% if (subnet = @host.subnet) %>
23
+ <%= render 'staypuft/interfaces/drop_zone',
24
+ :identifier => @host.primary_interface,
25
+ :subnet => subnet,
26
+ :deployment => @deployment,
27
+ :host => @host %>
28
+ <% end %>
29
+
30
+ <% @interfaces.each do |interface| %>
31
+ <%= render 'staypuft/interfaces/drop_zone',
32
+ :identifier => interface.identifier,
33
+ :subnet => interface.subnet,
34
+ :deployment => @deployment,
35
+ :host => @host %>
36
+ <% end %>
37
+
38
+ <%= link_to _('Back to deployment'), deployment_path(@deployment) %>
@@ -0,0 +1,30 @@
1
+ <div class="interface" id="<%= identifier %>-interface" data-interface="<%= identifier %>">
2
+ <div class="identifier">
3
+ <%= identifier %>
4
+ </div>
5
+
6
+ <!-- physical interface assignment (can be only one at most) -->
7
+ <div id="<%= identifier %>-physicals">
8
+ <%= render 'staypuft/subnets/subnet_pull',
9
+ :subnet => subnet,
10
+ :deployment => deployment,
11
+ :active => !is_pxe?(deployment, subnet),
12
+ :existing => true if subnet %>
13
+ </div>
14
+
15
+ <!-- all virtual devices attached to this physical interface assignments -->
16
+ <div id="<%= identifier %>-virtuals">
17
+ <% host.interfaces.where(:physical_device => identifier).where("subnet_id IS NOT NULL").each do |virtual| %>
18
+ <%= render 'staypuft/subnets/subnet_pull',
19
+ :subnet => virtual.subnet,
20
+ :deployment => deployment,
21
+ :active => true,
22
+ :existing => true if virtual.subnet %>
23
+ <% end %>
24
+ </div>
25
+
26
+ <div class="subnet-drop-zones">
27
+ <div class="empty-zone">
28
+ </div>
29
+ </div>
30
+ </div>
@@ -0,0 +1,52 @@
1
+ <%= javascript 'staypuft/subnets_assignment' %>
2
+
3
+ <%= render :layout => 'title' do %>
4
+ <%= alert_if_deployed %>
5
+
6
+ <div class="well">
7
+ <div class="wizard-container">
8
+ <%= deployment_wizard 2 %>
9
+ </div>
10
+
11
+ <div class="row">
12
+ <div id="subnet_types" class="col-md-12">
13
+ <%= base_errors_for @deployment %>
14
+ <h4><%= _("Available Roles") %></h4>
15
+ <% @deployment.unassigned_subnet_types.each do |subnet_type| %>
16
+ <%= render 'staypuft/subnet_types/subnet_type_pull', :subnet_type => subnet_type, :deployment => @deployment %>
17
+ <% end %>
18
+ </div>
19
+ </div>
20
+
21
+ <div class="row">
22
+ <div id="title_action" class="col-md-12">
23
+ <div class="btn-toolbar pull-right">
24
+ <%= display_link_if_authorized(_("New Subnet"), hash_for_new_subnet_path(:redirect => request.url + '#new')) %>
25
+ </div>
26
+ </div>
27
+
28
+ <div id="subnets" class="col-md-12">
29
+ <h4><%= _("Networks") %></h4>
30
+ <% @subnets.each do |subnet| %>
31
+ <%= render 'staypuft/subnets/drop_zone', :subnet => subnet, :deployment => @deployment %>
32
+ <% end %>
33
+ </div>
34
+ </div>
35
+
36
+ <br />
37
+
38
+ <%= form_for(@deployment, :url => wizard_path, :method => 'PUT', :html => {:class => ''}) do |f| %>
39
+ <div class="form_actions">
40
+ <a class="btn btn-default" href="<%= previous_wizard_path %>">
41
+ <span class="glyphicon glyphicon-chevron-left"></span>
42
+ <%= _("Back") %>
43
+ </a>
44
+ <%= link_to _("Cancel"), deployment_path(@deployment),
45
+ :class => "btn btn-danger" %>
46
+ <%= button_tag(:type => 'submit', :class => "btn btn-primary pull-right") do %>
47
+ <%= _("Next") %>
48
+ <% end %>
49
+ </div>
50
+ <% end %>
51
+ </div>
52
+ <% end %>
@@ -1,44 +1,50 @@
1
1
  <%= render :layout => 'title' do %>
2
2
  <%= alert_if_deployed %>
3
3
 
4
- <div class="deployment-wizard">
5
- <%= form_for(@deployment, :url => wizard_path, :method => 'PUT') do |f| %>
6
- <%= base_errors_for @deployment %>
7
-
8
- <%= deployment_wizard 3 %>
9
- <div class="form-group tabbed_side_nav_form row">
10
- <ul class="nav nav-pills nav-stacked col-md-3 configuration" data-tabs="pills">
11
- <h3><%= _("Services") %></h3>
12
- <% @services_map.each_with_index do |service_name, i| %>
13
- <% service = @deployment.send(service_name)
14
- if service.active?
15
- %>
16
- <li class="">
17
- <a href="#<%= service_name %>" data-toggle="tab">
18
- <%= service_name.capitalize %>
19
- </a>
20
- </li>
21
- <% end %>
22
- <% end %>
23
- </ul>
24
-
25
- <div class="tab-content col-md-9">
26
- <% @services_map.each_with_index do |service_name, i| %>
27
- <% service = @deployment.send(service_name)
28
- if service.active?
29
- %>
30
- <div class="tab-pane" id="<%= service_name %>">
31
- <h3><%= _("%s Service Configuration") % service_name.to_s.capitalize %></h3>
32
- <%= render partial: service_name.to_s, locals: {f: f}%>
33
- </div>
34
- <% end %>
35
- <% end %>
36
- </div>
4
+ <%= form_for(@deployment, :url => wizard_path, :method => 'PUT') do |f| %>
5
+ <%= base_errors_for @deployment %>
6
+
7
+ <%= deployment_wizard 4 %>
8
+ <div class="form-group tabbed_side_nav_form row">
9
+ <ul class="nav nav-pills nav-stacked col-md-3 configuration" data-tabs="pills">
10
+ <h3><%= _("Services") %></h3>
11
+ <% @services_map.each_with_index do |service_name, i| %>
12
+ <% service = @deployment.send(service_name)
13
+ if service.active?
14
+ %>
15
+ <li class="">
16
+ <a href="#<%= service_name %>" data-toggle="tab">
17
+ <%= service_name.capitalize %>
18
+ </a>
19
+ </li>
20
+ <% end %>
21
+ <% end %>
22
+ </ul>
23
+
24
+ <div class="tab-content col-md-9">
25
+ <% @services_map.each_with_index do |service_name, i| %>
26
+ <% service = @deployment.send(service_name)
27
+ if service.active?
28
+ %>
29
+ <div class="tab-pane" id="<%= service_name %>">
30
+ <h3><%= _("%s Service Configuration") % service_name.to_s.capitalize %></h3>
31
+ <%= render partial: service_name.to_s, locals: {f: f}%>
32
+ </div>
33
+ <% end %>
34
+ <% end %>
37
35
  </div>
38
-
39
- <%= render :partial => "wizard_form_buttons",
40
- :locals => { :deployment => @deployment,
41
- :step => Staypuft::Deployment::STEP_CONFIGURATION } %>
42
- <% end %>
43
- </div>
36
+ </div>
37
+
38
+ <div class="form_actions">
39
+ <a class="btn btn-default" href="<%= previous_wizard_path %>">
40
+ <span class="glyphicon glyphicon-chevron-left"></span>
41
+ <%= _("Back") %>
42
+ </a>
43
+ <%= link_to _("Cancel"), deployment_path(@deployment),
44
+ :class => "btn btn-danger" %>
45
+ <%= button_tag(:type => 'submit', :class => "btn btn-primary pull-right") do %>
46
+ <%= _("Next") %>
47
+ <% end %>
48
+ </div>
49
+ <% end %>
44
50
  <% end %>
@@ -5,7 +5,7 @@
5
5
  <%= form_for(@deployment, :url => wizard_path, :method => 'PUT') do |f| %>
6
6
  <%= base_errors_for @deployment %>
7
7
 
8
- <%= deployment_wizard 2 %>
8
+ <%= deployment_wizard 3 %>
9
9
  <h3><%= _("Deployment Roles & Available Services") %></h3>
10
10
  <h4><%= "#{@deployment.layout.name} - #{@deployment.layout.networking.capitalize} " + _("Networking") %></h4>
11
11
 
@@ -0,0 +1,9 @@
1
+ <% typing = local_assigns[:subnet_typing] %>
2
+
3
+ <div class="subnet-type-pull <%= typing.nil? ? 'new' : 'existing' %>" id="<%= dom_id(subnet_type) %>"
4
+ data-subnet-type-id="<%= subnet_type.id %>"
5
+ data-delete-url="<%= url_for subnet_typing_path(typing) if typing %>"
6
+ data-update-url="<%= url_for subnet_typing_path(typing) if typing %>"
7
+ data-create-url="<%= url_for subnet_typings_path(:deployment_id => deployment) %>">
8
+ <%= subnet_type.name %>
9
+ </div>
@@ -0,0 +1,12 @@
1
+ <% if @saved %>
2
+ $("#<%= dom_id(@subnet_type) %>").remove();
3
+ $("#<%= dom_id(@subnet) %>_drop_zone div.subnet-types").prepend('<%=j render :partial => 'staypuft/subnet_types/subnet_type_pull',
4
+ :object => @subnet_type,
5
+ :as => 'subnet_type',
6
+ :locals => { :subnet_typing => @subnet_typing, :deployment => @deployment } %>');
7
+ $("#<%= dom_id(@subnet_type) %>").draggable({revert: 'invalid'});
8
+ <% end %>
9
+
10
+ <% if @warn.present? %>
11
+ $.jnotify('<%=j @warn.html_safe %>', { type: "warning", sticky: true });
12
+ <% end %>
@@ -0,0 +1,12 @@
1
+ <% if @destroyed %>
2
+ $('#<%= dom_id(@subnet_type) %>').remove();
3
+ $("#subnet_types").append('<%=j render :partial => 'staypuft/subnet_types/subnet_type_pull',
4
+ :object => @subnet_type,
5
+ :locals => { :deployment => @deployment },
6
+ :as => 'subnet_type' %>');
7
+ $("#<%= dom_id(@subnet_type) %>").draggable({revert: 'invalid'});
8
+ <% end %>
9
+
10
+ <% if @warn.present? %>
11
+ $.jnotify('<%=j @warn.html_safe %>', { type: "warning", sticky: true });
12
+ <% end %>
@@ -0,0 +1,14 @@
1
+ <% if @saved %>
2
+ $("#<%= dom_id(@subnet_type) %>").remove()
3
+ $("#<%= dom_id(@subnet) %>_drop_zone div.subnet-types").prepend('<%=j render :partial => 'staypuft/subnet_types/subnet_type_pull',
4
+ :object => @subnet_type,
5
+ :as => 'subnet_type',
6
+ :locals => { :subnet_typing => @subnet_typing, :deployment => @deployment } %>');
7
+ $("#<%= dom_id(@subnet_type) %>").draggable({
8
+ revert: 'invalid'
9
+ });
10
+ <% end %>
11
+
12
+ <% if @warn.present? %>
13
+ $.jnotify('<%=j @warn.html_safe %>', { type: "warning", sticky: true });
14
+ <% end %>
@@ -0,0 +1,16 @@
1
+ <div class="subnet-drop-zone" id="<%= dom_id(subnet) %>_drop_zone" data-subnet-id="<%= subnet.id %>">
2
+ <div class="name">
3
+ <%= subnet.name %> - <%= subnet.network_address %>
4
+ </div>
5
+
6
+ <div class="subnet-types">
7
+ <% deployment.subnet_typings.where(["#{Staypuft::SubnetTyping.table_name}.subnet_id = ?", subnet.id]).each do |typing| %>
8
+ <%= render :partial => 'staypuft/subnet_types/subnet_type_pull',
9
+ :object => typing.subnet_type,
10
+ :locals => { :subnet_typing => typing, :deployment => deployment },
11
+ :as => :subnet_type %>
12
+ <% end %>
13
+
14
+ <div class="empty-zone"></div>
15
+ </div>
16
+ </div>
@@ -0,0 +1,9 @@
1
+ <div class="subnet-pull <%= 'active' if active %> <%= 'existing' if existing %> <%= 'virtual' if subnet.vlanid.present? %>"
2
+ id="<%= dom_id(subnet) %>"
3
+ data-create-url="<%= deployment_interface_assignments_path(deployment, :host_ids => params[:host_ids], :subnet_id => subnet) %>"
4
+ data-delete-url="<%= deployment_interface_assignment_path(deployment, 0, :host_ids => params[:host_ids], :subnet_id => subnet) %>">
5
+ <div class="content">
6
+ <div class="name"><%= subnet.name %> <%= '(vlan: ' + subnet.vlanid + ')' if subnet.vlanid.present? %></div>
7
+ <div class="subnet-types"><%= subnet_types(deployment, subnet) %></div>
8
+ </div>
9
+ </div>
data/config/routes.rb CHANGED
@@ -16,7 +16,10 @@ Rails.application.routes.draw do
16
16
  end
17
17
 
18
18
  resources :steps
19
+
20
+ resources :interface_assignments, :only => [:index, :create, :destroy]
19
21
  end
20
22
 
23
+ resources :subnet_typings, :only => [:create, :destroy, :update]
21
24
  end
22
25
  end