foreman_content 0.2 → 0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +40 -1
  3. data/app/controllers/content/api/repositories_controller.rb +3 -5
  4. data/app/controllers/content/content_views_controller.rb +48 -0
  5. data/app/controllers/content/products_controller.rb +1 -1
  6. data/app/controllers/content/repositories_controller.rb +9 -6
  7. data/app/helpers/content/content_views_helper.rb +21 -0
  8. data/app/helpers/content/products_helper.rb +9 -0
  9. data/app/helpers/content/repositories_helper.rb +3 -49
  10. data/app/models/concerns/content/environment_extensions.rb +2 -2
  11. data/app/models/concerns/content/home_helper.rb +1 -0
  12. data/app/models/concerns/content/host_extensions.rb +17 -1
  13. data/app/models/concerns/content/hostgroup_extensions.rb +14 -0
  14. data/app/models/concerns/content/operatingsystem_extensions.rb +6 -5
  15. data/app/models/concerns/content/orchestration/pulp/clone.rb +77 -0
  16. data/app/models/concerns/content/orchestration/pulp/sync.rb +70 -0
  17. data/app/models/concerns/content/orchestration/pulp.rb +25 -0
  18. data/app/models/content/available_content_view.rb +12 -0
  19. data/app/models/content/content_view.rb +66 -0
  20. data/app/models/content/content_view_host.rb +9 -0
  21. data/app/models/content/content_view_repository_clone.rb +5 -0
  22. data/app/models/content/host_product.rb +0 -11
  23. data/app/models/content/hostgroup_product.rb +0 -11
  24. data/app/models/content/operatingsystem_repository.rb +0 -11
  25. data/app/models/content/product.rb +6 -5
  26. data/app/models/content/repository/operating_system.rb +14 -0
  27. data/app/models/content/repository/product.rb +21 -0
  28. data/app/models/content/repository.rb +28 -39
  29. data/app/models/content/repository_clone.rb +29 -0
  30. data/app/models/content/validators/content_validator.rb +0 -12
  31. data/app/models/content/validators/description_format.rb +0 -12
  32. data/app/models/content/validators/no_trailing_space.rb +0 -12
  33. data/app/models/setting/content.rb +0 -18
  34. data/app/overrides/{add_host_conent_tab.rb → add_host_content_tab.rb} +2 -2
  35. data/app/overrides/{add_hostgroup_conent_tab.rb → add_hostgroup_content_tab.rb} +1 -1
  36. data/app/services/content/content_view_factory.rb +41 -0
  37. data/app/services/content/{pulp_configuration.rb → pulp/configuration.rb} +1 -1
  38. data/app/services/content/pulp/event_handler.rb +61 -0
  39. data/app/services/content/pulp/repository.rb +200 -0
  40. data/app/services/content/pulp/repository_clone.rb +24 -0
  41. data/app/services/content/pulp/repository_sync_history.rb +35 -0
  42. data/app/services/content/pulp/repository_sync_status.rb +30 -0
  43. data/app/views/content/content_views/_form.html.erb +49 -0
  44. data/app/views/content/content_views/_form_tab.html.erb +3 -0
  45. data/app/views/content/content_views/_host_tab_pane.html.erb +5 -0
  46. data/app/views/content/content_views/_step1.html.erb +18 -0
  47. data/app/views/content/content_views/_step2.html.erb +16 -0
  48. data/app/views/content/content_views/edit.html.erb +5 -0
  49. data/app/views/content/content_views/index.html.erb +27 -0
  50. data/app/views/content/content_views/new.html.erb +11 -0
  51. data/app/views/content/products/_form.html.erb +2 -13
  52. data/app/views/content/products/_form_tab.html.erb +3 -3
  53. data/app/views/content/products/_hostgroup_tab_pane.html.erb +2 -2
  54. data/app/views/content/products/index.html.erb +6 -1
  55. data/app/views/content/repositories/_os_form.html.erb +22 -0
  56. data/app/views/content/repositories/{_form.html.erb → _product_form.html.erb} +4 -6
  57. data/app/views/content/repositories/edit.html.erb +5 -2
  58. data/app/views/content/repositories/index.html.erb +12 -9
  59. data/app/views/content/repositories/new.html.erb +5 -2
  60. data/app/views/content/repositories/show.html.erb +9 -16
  61. data/config/environment.rb +0 -0
  62. data/config/routes.rb +6 -0
  63. data/db/migrate/20130702140034_create_content_repositories.rb +6 -2
  64. data/db/migrate/20130722084911_create_content_operatingsystem_repositories.rb +1 -1
  65. data/db/migrate/20130807121629_create_content_content_views.rb +15 -0
  66. data/db/migrate/20130807123220_create_content_available_content_views.rb +11 -0
  67. data/db/migrate/20130812154754_create_content_content_view_hosts.rb +9 -0
  68. data/db/migrate/20130813110455_create_content_repository_clones.rb +17 -0
  69. data/db/migrate/20130825145431_create_content_content_view_repository_clones.rb +12 -0
  70. data/lib/content/engine.rb +2 -0
  71. data/lib/content/version.rb +1 -1
  72. data/test/fixtures/content/repository_clones.yml +21 -0
  73. data/test/unit/content/repository_clone_test.rb +7 -0
  74. metadata +44 -17
  75. data/app/models/concerns/content/custom_repository_paths.rb +0 -29
  76. data/app/models/content/environment_product.rb +0 -19
  77. data/app/models/content/orchestration/pulp.rb +0 -93
  78. data/app/models/content/product_operatingsystem.rb +0 -19
  79. data/app/models/content/remote/pulp/repository.rb +0 -48
  80. data/app/overrides/add_os_conent_tab.rb +0 -9
  81. data/app/services/content/pulp_event_handler.rb +0 -25
  82. data/app/views/content/products/_host_tab_pane.html.erb +0 -5
  83. data/app/views/content/products/_operatingsystem_tab_pane.html.erb +0 -5
  84. data/db/migrate/20130717032320_create_content_environments_products.rb +0 -9
  85. data/db/migrate/20130729032320_create_content_product_operatingsystems.rb +0 -9
@@ -0,0 +1,30 @@
1
+ class Content::Pulp::RepositorySyncStatus
2
+ attr_reader :state, :progress, :finish_time, :start_time, :sync_times, :sync_metrics, :message, :task_id
3
+
4
+ HISTORY_ERROR = 'failed'
5
+ HISTORY_SUCCESS = 'success'
6
+ FINISHED = 'finished'
7
+ ERROR = 'error'
8
+ RUNNING = 'running'
9
+ WAITING = 'waiting'
10
+ CANCELED = 'canceled'
11
+ NOT_SYNCED = 'not synchronized'
12
+
13
+ def initialize(attrs)
14
+ @state = NOT_SYNCED
15
+ @sync_times = @sync_metrics = {}
16
+
17
+ attrs.each do |k, v|
18
+ instance_variable_set("@#{k}", v) if respond_to?("#{k}".to_sym)
19
+ end
20
+ end
21
+
22
+ def not_synced?
23
+ state == NOT_SYNCED
24
+ end
25
+
26
+ def running?
27
+ state == RUNNING
28
+ end
29
+
30
+ end
@@ -0,0 +1,49 @@
1
+ <%= form_for @content_view, :url => (@content_view.new_record? ? content_views_path : content_view_path(@content_view)) do |f| %>
2
+ <%= base_errors_for @content_view %>
3
+
4
+ <ul class="nav nav-tabs" data-tabs="tabs">
5
+ <li class="active"><a href="#primary" data-toggle="tab"><%= _("Content view") %></a></li>
6
+ <li><a href="#availability" data-toggle="tab"><%= _("Availability") %></a></li>
7
+ </ul>
8
+
9
+ <div class="tab-content">
10
+ <div class="tab-pane active" id="primary">
11
+ <%= text_f f, :name, :value => @content_view.to_label %>
12
+
13
+ <% if @content_view.new_record? %>
14
+ <% @content_view.source_repositories.each do |repo| %>
15
+ <%= f.hidden_field :source_repositories, :multiple => true, :value => repo.id %>
16
+ <% end if @content_view.source_repositories %>
17
+ <% @content_view.repository_clones.each do |repo| %>
18
+ <%= f.hidden_field :repository_clone_ids, :multiple => true, :value => repo.id %>
19
+ <% end if @content_view.repository_clones %>
20
+
21
+ <%= f.hidden_field :originator_id, :value => @content_view.originator_id %>
22
+ <%= f.hidden_field :originator_type, :value => @content_view.originator_type %>
23
+ <% end %>
24
+
25
+ <table class="table table-bordered">
26
+ <tr>
27
+ <th><%= _("Name") %></th>
28
+ <th><%= _("State") %></th>
29
+ <th><%= _("Last publish") %></th>
30
+ <th><%= _("Content type") %></th>
31
+ </tr>
32
+ <% repositories(@content_view).each do |repository| %>
33
+ <tr>
34
+ <td><%= repository.name %></td>
35
+ <td><%= repository.try(:state) %></td>
36
+ <td><%= last_time(repository.last_published) %></td>
37
+ <td><%= repository.content_type %></td>
38
+ </tr>
39
+ <% end %>
40
+ </table>
41
+ </div>
42
+ <div class="tab-pane" id="availability">
43
+ <%= multiple_selects(f, :environments, Environment,
44
+ Content::AvailableContentView.where(:content_view_id => @content_view.id).pluck(:environment_id),
45
+ { :label => _('Available in environments') }) %>
46
+ </div>
47
+ </div>
48
+ <%= submit_or_cancel f %>
49
+ <% end %>
@@ -0,0 +1,3 @@
1
+ <li id="content_views_tab">
2
+ <a href="#content_views" data-toggle="tab">Content Views</a>
3
+ </li>
@@ -0,0 +1,5 @@
1
+ <div class="tab-pane" id="content_views">
2
+ <%= fields_for @host do |f| %>
3
+ <%= multiple_selects f, :content_views, Content::ContentView, @host.all_content_view_ids , {:disabled => @host.inherited_content_view_ids}, {} %>
4
+ <% end -%>
5
+ </div>
@@ -0,0 +1,18 @@
1
+ <%= wizard_header 1, _('Select source type'), _('Select content'), _('Create') %>
2
+ <%= form_tag hash_for_new_content_view_path, :class => 'form-horizontal well', :method => :get do %>
3
+ <% case params[:type] %>
4
+ <% when 'product' %>
5
+ <%= field(nil, _('Product')) do
6
+ select_tag('product', options_from_collection_for_select(Content::Product.has_repos, 'id', 'name'))
7
+ end %>
8
+ <% when 'operatingsystem' %>
9
+ <%= field(nil, _('Operating system')) do
10
+ select_tag('operatingsystem', options_from_collection_for_select(Redhat.has_repos, 'id', 'to_label'))
11
+ end %>
12
+ <% when 'hostgroup' %>
13
+ <%= field(nil, _('Host group')) do
14
+ select_tag('hostgroup', options_from_collection_for_select(accessible_hostgroups, 'id', 'to_label'))
15
+ end %>
16
+ <% end %>
17
+ <%= next_or_cancel hash_for_new_content_view_path() %>
18
+ <% end %>
@@ -0,0 +1,16 @@
1
+ <%= wizard_header 2, _("Select source type"), _("Select content"), _("Create") %>
2
+ <%= form_for Content::ContentViewFactory.new, :url => hash_for_new_content_view_path, :class => 'form-horizontal well', :method => :get do |f| %>
3
+ <%= f.hidden_field :originator_id, :value => @hostgroup.id %>
4
+ <%= f.hidden_field :originator_type, :value => @hostgroup.class.name %>
5
+ <%= select_f f, :parent_cv, @hostgroup.parent.try(:content_views) || [], "id", "name",
6
+ :label => _("Parent Content view") %>
7
+ <h6>Products</h6>
8
+ <% @hostgroup.products.each do |product| %>
9
+ <%= select_f f, :product_cv, product.content_views, "id", "name", {}, :label => product.name %>
10
+ <% end %>
11
+
12
+ <h6>Operating System</h6>
13
+ <%= select_f f, :os_cv, @hostgroup.os.content_views, "id", "name" %>
14
+
15
+ <%= next_or_cancel hash_for_new_content_view_path() %>
16
+ <% end %>
@@ -0,0 +1,5 @@
1
+ <%= javascript 'content/content.js' %>
2
+
3
+ <% title _("Edit Content View") %>
4
+
5
+ <%= render :partial => 'form' %>
@@ -0,0 +1,27 @@
1
+ <% title _("Content Views") %>
2
+ <% title_actions select_action_button( _('New content view'),
3
+ display_link_if_authorized(_("Product view"), hash_for_new_content_view_path(:type=>'product')),
4
+ display_link_if_authorized(_("Operating system view"), hash_for_new_content_view_path(:type=>'operatingsystem')),
5
+ display_link_if_authorized(_("Hostgroup view"), hash_for_new_content_view_path(:type=>'hostgroup'))) %>
6
+
7
+
8
+ <table class="table table-bordered table-striped">
9
+ <tr>
10
+ <th><%= sort :name, :as => s_("Name") %></th>
11
+ <th><%= _("Repositories") %></th>
12
+ <th><%= _("Created at") %></th>
13
+ <th></th>
14
+ </tr>
15
+ <% @content_views.each do |content_view| %>
16
+ <tr>
17
+ <td><%= link_to_if_authorized(h(content_view.name), hash_for_edit_content_view_path(content_view)) %></td>
18
+ <td><%= @counter[content_view.id] || '0' %></td>
19
+ <td><%= _("%s ago") % time_ago_in_words(content_view.created_at) %></td>
20
+ <td><%= action_buttons(
21
+ display_delete_if_authorized(hash_for_content_view_path(content_view), :confirm => "Delete #{content_view}?")
22
+ )%></td>
23
+ </tr>
24
+ <% end %>
25
+ </table>
26
+ <%= page_entries_info @content_views %>
27
+ <%= will_paginate @content_views %>
@@ -0,0 +1,11 @@
1
+ <%= javascript 'content/content.js' %>
2
+
3
+ <% title _("New Content View") %>
4
+
5
+ <% if @content_view %>
6
+ <%= render :partial => 'form' %>
7
+ <% elsif @hostgroup %>
8
+ <%= render :partial => 'step2' %>
9
+ <% else %>
10
+ <%= render :partial => 'step1' %>
11
+ <% end %>
@@ -3,24 +3,13 @@
3
3
  <%= base_errors_for @product %>
4
4
  <ul class="nav nav-tabs" data-tabs="tabs">
5
5
  <li class="active"><a href="#primary" data-toggle="tab"><%= _("Product") %></a></li>
6
- <li><a href="#environments" data-toggle="tab"><%= _("Environments") %></a></li>
7
- <li><a href="#operatingsystems" data-toggle="tab"><%= _("Operating systems") %></a></li>
8
6
  </ul>
9
7
  <div class="tab-content">
10
8
  <div class="tab-pane active" id="primary">
11
9
  <%= text_f f, :name %>
12
- <%= text_f f, :description %>
13
- </div>
14
- <div class="tab-pane" id="environments">
15
- <%= alert :class => 'controls alert-success', :header => 'Product environments list',
16
- :text => _('Repositories of this product will be restricted only for hosts in the selected environments.') %>
17
- <%= multiple_selects(f, :environments, Environment, f.object.environment_ids) %>
18
- </div>
19
- <div class="tab-pane" id="operatingsystems">
20
- <%= alert :class => 'controls alert-success', :header => 'Default Products for operating system',
21
- :text => _('Repositories of this product will be added to every host that runs the selected operating system, pending environment restriction') %>
22
- <%= multiple_selects(f, :operatingsystems, Redhat, f.object.operatingsystem_ids,{:label=>"Operating system default products"}) %>
10
+ <%= textarea_f f, :description, :class => "input-xlarge" , :rows=> '3' %>
23
11
  </div>
12
+
24
13
  </div>
25
14
  <%= submit_or_cancel f %>
26
15
  <% end %>
@@ -1,3 +1,3 @@
1
- <li id="products_tab">
2
- <a href="#products" data-toggle="tab">Products</a>
3
- </li>
1
+ <li id="content_tab">
2
+ <a href="#product" data-toggle="tab">Content</a>
3
+ </li>
@@ -1,5 +1,5 @@
1
- <div class="tab-pane" id="products">
1
+ <div class="tab-pane" id="product">
2
2
  <%= fields_for @hostgroup do |f| %>
3
3
  <%= multiple_selects f, :products, Content::Product, @hostgroup.all_product_ids , {:disabled => @hostgroup.inherited_product_ids}, {} %>
4
4
  <% end -%>
5
- </div>
5
+ </div>
@@ -16,7 +16,12 @@
16
16
  <td><%= link_to @counter[product.id] || '0', repositories_path(:search => "product=#{product.name}") %></td>
17
17
  <td align="right">
18
18
  <%= action_buttons(
19
- display_link_if_authorized(_("Synchronize"), hash_for_sync_product_path(product), :method => :put),
19
+ display_link_if_authorized(_("Create Content View"), hash_for_new_content_view_path(:product=>product),
20
+ :disabled => visible?(product.id)),
21
+ display_link_if_authorized(_("Synchronize"), hash_for_sync_product_path(product), :method => :put,
22
+ :disabled => visible?(product.id)),
23
+ display_link_if_authorized(_("Add Repository"),
24
+ hash_for_new_repository_path(:type => "product",:product_id => product.id)),
20
25
  display_delete_if_authorized(hash_for_product_path(product), :confirm => "Delete #{product.name}?")
21
26
  )%>
22
27
  </td>
@@ -0,0 +1,22 @@
1
+ <%= javascript 'content/content.js' %>
2
+ <%= form_for @repository, :url => (@repository.new_record? ? repositories_path : repository_path(:id => @repository.id)) do |f| %>
3
+ <%= base_errors_for @repository %>
4
+ <ul class="nav nav-tabs" data-tabs="tabs">
5
+ <li class="active"><a href="#primary" data-toggle="tab"><%= _("Repository") %></a></li>
6
+ </ul>
7
+ <div class="tab-content">
8
+ <div class="tab-pane active" id="primary">
9
+ <%= f.hidden_field :type %>
10
+ <%= select_f f, :operatingsystem_id, ::Redhat.all, :id, :to_label, {}, {:label => _("Operating System")} %>
11
+ <%= text_f f, :name %>
12
+ <%= text_f f, :feed, :class => 'span6' %>
13
+ <%= selectable_f f, :content_type, @repository.content_types %>
14
+ <%= select_f f, :architecture_id, ::Architecture.all, :id, :name, { :include_blank => N_("noarch")} %>
15
+ <%= checkbox_f f, :enabled %>
16
+
17
+ <%= select_f f, :gpg_key_id, Content::GpgKey.all, :id, :name, {:include_blank => true}, {:label => _("GPG Key")} %>
18
+
19
+ </div>
20
+ </div>
21
+ <%= submit_or_cancel f %>
22
+ <% end %>
@@ -7,23 +7,21 @@
7
7
  </ul>
8
8
  <div class="tab-content">
9
9
  <div class="tab-pane active" id="primary">
10
+ <%= f.hidden_field :type %>
10
11
  <%= select_f f, :product_id, Content::Product.all, :id, :name, {}, {:label => _("Product")} %>
11
12
  <%= text_f f, :name %>
12
13
  <%= text_f f, :feed, :class => 'span6' %>
13
- <%= selectable_f f, :content_type, Content::Repository::TYPES %>
14
+ <%= selectable_f f, :content_type, @repository.content_types %>
14
15
  <%= select_f f, :architecture_id, ::Architecture.all, :id, :name, { :include_blank => N_("noarch")} %>
15
16
  <%= checkbox_f f, :enabled %>
16
17
 
17
18
  <%= select_f f, :gpg_key_id, Content::GpgKey.all, :id, :name, {:include_blank => true}, {:label => _("GPG Key")} %>
18
19
 
19
- <% unless @repository.new_record? %>
20
- <%= text_f f, :full_path, :disabled => true, :class => 'span6' %>
21
- <% end %>
22
20
  </div>
23
21
  <div class="tab-pane" id="operatingsystems">
24
22
  <%= alert :class => 'controls alert-success', :header => 'Repository for operating systems',
25
- :text => _('This Repository will be restricted only to hosts that runs the selected operating system') %>
26
- <%= multiple_selects(f, :operatingsystems, ::Redhat, f.object.operatingsystem_ids) %>
23
+ :text => _('This Repository will be restricted only to hosts that runs the selected operating system') %>
24
+ <%= multiple_selects(f, :operatingsystems, ::Redhat, @repository.operatingsystem_ids) %>
27
25
  </div>
28
26
  </div>
29
27
  <%= submit_or_cancel f %>
@@ -1,3 +1,6 @@
1
1
  <% title _("Edit Repository") %>
2
-
3
- <%= render :partial => 'form' %>
2
+ <% if @repository.is_a? Content::Repository::OperatingSystem %>
3
+ <%= render :partial => 'os_form' %>
4
+ <% else %>
5
+ <%= render :partial => 'product_form' %>
6
+ <% end %>
@@ -1,11 +1,14 @@
1
1
  <% title _("Repositories") %>
2
- <% title_actions display_link_if_authorized(_("New Repository"), hash_for_new_repository_path), help_path %>
2
+
3
+ <% title_actions select_action_button(_('New repository'),
4
+ display_link_if_authorized(_("New Product Repository"), hash_for_new_repository_path(:type => 'product')),
5
+ display_link_if_authorized(_("New Operating system Repository"), hash_for_new_repository_path(:type => 'operatingsystem'))) %>
3
6
 
4
7
  <table class="table table-bordered table-striped">
5
8
  <tr>
6
9
  <th><%= sort :name, :as => s_("Name") %></th>
7
10
  <th><%= _("Product") %></th>
8
- <th><%= _("Operating system") %></th>
11
+ <th><%= _("State") %></th>
9
12
  <th><%= _("Last sync status") %></th>
10
13
  <th><%= _("Content type") %></th>
11
14
  <th></th>
@@ -13,16 +16,16 @@
13
16
  <% @repositories.each do |repository| %>
14
17
  <tr>
15
18
  <td><%= link_to_if_authorized(h(repository.name), hash_for_repository_path(repository)) %></td>
16
- <td><%= repository.product %></td>
17
- <td><%= repository.operatingsystems.map(&:to_label).to_sentence %></td>
18
- <td><%= sync_status repository %></td>
19
+ <td><%= repository.entity_name %></td>
20
+ <td><%= repository.try(:state) %></td>
21
+ <td><%= last_time(repository.last_sync) %></td>
19
22
  <td><%= repository.content_type %></td>
20
23
  <td align="right">
21
24
  <%= action_buttons(
22
- display_link_if_authorized(_("Edit"), hash_for_edit_repository_path(repository)),
23
- display_link_if_authorized(_("Synchronize"), hash_for_sync_repository_path(repository), :method => :put),
24
- display_delete_if_authorized(hash_for_repository_path(repository), :confirm => "Delete #{repository.name}?")
25
- )%>
25
+ display_link_if_authorized(_("Edit"), hash_for_edit_repository_path(repository)),
26
+ display_link_if_authorized(_("Synchronize"), hash_for_sync_repository_path(repository), :method => :put),
27
+ display_delete_if_authorized(hash_for_repository_path(repository), :confirm => "Delete #{repository.name}?")
28
+ ) %>
26
29
 
27
30
  </td>
28
31
  </tr>
@@ -1,3 +1,6 @@
1
1
  <% title _("New Repository") %>
2
-
3
- <%= render :partial => 'form' %>
2
+ <% if @repository.is_a? Content::Repository::OperatingSystem %>
3
+ <%= render :partial => "os_form" %>
4
+ <% else %>
5
+ <%= render :partial => "product_form" %>
6
+ <% end %>
@@ -3,7 +3,8 @@
3
3
 
4
4
  <%= title_actions(button_group(
5
5
  link_to_if_authorized(_("Edit"), hash_for_edit_repository_path(@repository)),
6
- link_to_if_authorized(_("Synchronize"), hash_for_sync_repository_path(@repository), :method => :put)
6
+ link_to_if_authorized(_("Synchronize"), hash_for_sync_repository_path(@repository), :method => :put),
7
+ display_delete_if_authorized(hash_for_repository_path(@repository), :class => 'btn-danger', :confirm => "Delete #{@repository.name}?")
7
8
  )) %>
8
9
  <div class="row">
9
10
  <div class="span12">
@@ -40,10 +41,6 @@
40
41
  <td> <%= _("Unprotected") %> </td>
41
42
  <td> <%= @repository.unprotected %> </td>
42
43
  </tr>
43
- <tr>
44
- <td> <%= _("Full path") %> </td>
45
- <td> <%= @repository.full_path %> </td>
46
- </tr>
47
44
  </table>
48
45
  </div>
49
46
  </div>
@@ -51,12 +48,12 @@
51
48
  <div class="stats-well span4">
52
49
  <h4 class="ca" ><%= _('Last Update Metrics') -%></h4>
53
50
  <div style="margin-top:50px;padding-bottom: 40px;">
54
- <%= flot_pie_chart("metrics" ,_("Last Update Metrics"), sync_history_times(@sync_history), :class => "statistics-pie small")%>
51
+ <%= flot_pie_chart("metrics" ,_("Last Update Metrics"), @repository.sync_history.last.try(:times), :class => "statistics-pie small")%>
55
52
  </div>
56
53
  </div>
57
54
  <div class="stats-well span4">
58
55
  <h4 class="ca" ><%= _('Update Summary') -%></h4>
59
- <%= flot_bar_chart("status" ,"", _("Number of packages"), sync_history_metrics(@sync_history), :class => "statistics-bar")%>
56
+ <%= flot_bar_chart("status" ,"", _("Number of packages"), @repository.sync_history.last.try(:metrics), :class => "statistics-bar")%>
60
57
  </div>
61
58
 
62
59
  <div class="span4">
@@ -65,19 +62,15 @@
65
62
  <th><%= _('Repository Counters') %></th>
66
63
  <th></th>
67
64
  </tr>
68
- <% @details[:content_unit_counts].each do |name, value| -%>
65
+ <% @repository.counters.each do |name, value| -%>
69
66
  <tr>
70
- <td> <%= name.humanize %> </td>
67
+ <td> <%= name.to_s.humanize %> </td>
71
68
  <td> <%= value %> </td>
72
69
  </tr>
73
70
  <% end -%>
74
- <tr>
75
- <td> <%= _("Last published") %> </td>
76
- <td> <%= last_publish @details %> </td>
77
- </tr>
78
71
  <tr>
79
72
  <td> <%= _("Last synchronized") %> </td>
80
- <td> <%= last_sync @details %> </td>
73
+ <td> <%= last_time @repository.last_sync %> </td>
81
74
  </tr>
82
75
  </table>
83
76
  </div>
@@ -87,9 +80,9 @@
87
80
  <th><%= _('Last Sync') %></th>
88
81
  <th></th>
89
82
  </tr>
90
- <% sync_history_status(@sync_history).each do |name, value| -%>
83
+ <% @repository.sync_history.last.status.each do |name, value| -%>
91
84
  <tr>
92
- <td> <%= name.humanize %> </td>
85
+ <td> <%= name.to_s.humanize %> </td>
93
86
  <td> <%= value %> </td>
94
87
  </tr>
95
88
  <% end -%>
File without changes
data/config/routes.rb CHANGED
@@ -6,6 +6,12 @@ Rails.application.routes.draw do
6
6
  end
7
7
  end
8
8
 
9
+ resources :content_views do
10
+ collection do
11
+ get 'auto_complete_search'
12
+ end
13
+ end
14
+
9
15
  resources :products do
10
16
  collection do
11
17
  get 'auto_complete_search'
@@ -1,17 +1,21 @@
1
1
  class CreateContentRepositories < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :content_repositories do |t|
4
+ t.string :type
5
+ t.string :pulp_id, :null => false
4
6
  t.string :name, :null => false
5
7
  t.string :description
6
8
  t.string :content_type, :default => "yum", :null => false
7
9
  t.boolean :enabled, :default => true
8
- t.string :relative_path
9
10
  t.string :feed
10
11
  t.boolean :unprotected, :default => false
11
- t.references :product, :null => false
12
12
  t.string :pulp_id
13
13
  t.references :gpg_key
14
14
  t.references :architecture
15
+ t.string :status
16
+ t.datetime :last_sync
17
+ t.references :product
18
+ t.references :operatingsystem
15
19
  t.timestamps
16
20
  end
17
21
  add_index :content_repositories, :pulp_id, :unique => true
@@ -6,4 +6,4 @@ class CreateContentOperatingsystemRepositories < ActiveRecord::Migration
6
6
  end
7
7
  add_index(:content_operatingsystem_repositories, [:repository_id, :operatingsystem_id],:name=>'operatingsystem_repositories_index', :unique=>true)
8
8
  end
9
- end
9
+ end
@@ -0,0 +1,15 @@
1
+ class CreateContentContentViews < ActiveRecord::Migration
2
+ def change
3
+ create_table :content_content_views do |t|
4
+ t.string :name
5
+ t.string :ancestry
6
+ t.integer :originator_id
7
+ t.string :originator_type
8
+
9
+ t.timestamps
10
+ end
11
+ add_index(:content_content_views, :ancestry,:name=>'content_view_ancestry_index')
12
+ add_index :content_content_views, [:originator_id, :originator_type]
13
+ add_index :content_content_views, :originator_type
14
+ end
15
+ end
@@ -0,0 +1,11 @@
1
+ class CreateContentAvailableContentViews < ActiveRecord::Migration
2
+ def change
3
+ create_table :content_available_content_views do |t|
4
+ t.references :environment, :null =>false
5
+ t.references :content_view, :null =>false
6
+ t.references :operatingsystem
7
+ t.boolean :archived
8
+ t.boolean :default
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,9 @@
1
+ class CreateContentContentViewHosts < ActiveRecord::Migration
2
+ def change
3
+ create_table :content_content_view_hosts do |t|
4
+ t.references :host, :null =>false
5
+ t.references :content_view, :null =>false
6
+ end
7
+ add_index(:content_content_view_hosts, [:content_view_id, :host_id],:name=>'content_content_view_hosts_index', :unique=>true)
8
+ end
9
+ end
@@ -0,0 +1,17 @@
1
+ class CreateContentRepositoryClones < ActiveRecord::Migration
2
+ def change
3
+ create_table :content_repository_clones do |t|
4
+ t.string :name
5
+ t.string :description
6
+ t.references :repository
7
+ t.string :relative_path
8
+ t.string :pulp_id
9
+ t.string :status
10
+ t.datetime :last_published
11
+
12
+ t.timestamps
13
+ end
14
+ add_index :content_repository_clones, :repository_id
15
+ add_index :content_repository_clones, :pulp_id, :unique => true
16
+ end
17
+ end
@@ -0,0 +1,12 @@
1
+ class CreateContentContentViewRepositoryClones < ActiveRecord::Migration
2
+ def change
3
+ create_table :content_content_view_repository_clones do |t|
4
+ t.references :content_view
5
+ t.references :repository_clone
6
+
7
+ t.timestamps
8
+ end
9
+ add_index :content_content_view_repository_clones, :content_view_id, :name => 'cv_repo_clone_cv_id'
10
+ add_index :content_content_view_repository_clones, :repository_clone_id, :name => 'cv_repo_clone_clone_id'
11
+ end
12
+ end
@@ -1,3 +1,5 @@
1
+ require 'deface'
2
+
1
3
  module Content
2
4
  ENGINE_NAME = "content"
3
5
  class Engine < ::Rails::Engine
@@ -1,3 +1,3 @@
1
1
  module Content
2
- VERSION = "0.2"
2
+ VERSION = "0.3"
3
3
  end
@@ -0,0 +1,21 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
2
+
3
+ one:
4
+ name: MyString
5
+ description: MyString
6
+ repository:
7
+ relative_path: MyString
8
+ content_view:
9
+ pulp_id: MyString
10
+ status: MyString
11
+ last_published: 2013-08-13 14:04:55
12
+
13
+ two:
14
+ name: MyString
15
+ description: MyString
16
+ repository:
17
+ relative_path: MyString
18
+ content_view:
19
+ pulp_id: MyString
20
+ status: MyString
21
+ last_published: 2013-08-13 14:04:55
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class Content::RepositoryCloneTest < ActiveSupport::TestCase
4
+ # test "the truth" do
5
+ # assert true
6
+ # end
7
+ end