foreman_scc_manager 1.1.2 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b0a839f167e9297e51379e38f984ab7616df52a6
4
- data.tar.gz: a11cf8558d2cea9c44485a09095c7049d5c9267a
3
+ metadata.gz: d296a7acbef13daa1e12d2f5fd87cde248487a46
4
+ data.tar.gz: 8d3377991fc0dded2f0b4e72498bbc90081d6ea8
5
5
  SHA512:
6
- metadata.gz: 456b05429cf1acdad480f499f8a001d8133125b1e14b64d92564d8c79ffb3ebdff7ce0cb8294e082563d0c0fd465639320a711384559a1618960e6d4e8fc0b09
7
- data.tar.gz: 504fc281da2f0cd519bc5e67e1735dcb1393b6079f76895ad50086813a4412a1406aae0d5778845fb640c475c34ae1444efa83ca8d53d7039629628450b5fba6
6
+ metadata.gz: 5c94a4f70faeab6138a5d3a41e65d5ea59e17cdea4c5df585ff402bc8118ba01ee9a51783d2213bc287534700ef9a430955b3a18016ebd53f61ffcdd23d24603
7
+ data.tar.gz: 91b77311d51017259a86f688b9de1491f00603d6cb8e932c2fc1b642be6c698c147a1cfb90611b3d80fc8fcd928eb4002fb7c017b13f1ffb6f5d03ccaa2172e1
@@ -91,7 +91,11 @@ class SccAccount < ActiveRecord::Base
91
91
  # rewire product to product relationships
92
92
  upstream_products.each do |up|
93
93
  extensions = scc_products.where(scc_id: up['extensions'].map { |ext| ext['id'] })
94
- scc_products.find_by!(scc_id: up['id']).update!(scc_extensions: extensions)
94
+ begin
95
+ scc_products.find_by!(scc_id: up['id']).update!(scc_extensions: extensions)
96
+ rescue ActiveRecord::RecordNotFound
97
+ logger.info "Failed to find parent scc_product '#{up['name']}'."
98
+ end
95
99
  end
96
100
  end
97
101
  end
@@ -1,4 +1,4 @@
1
1
  class SccExtending < ActiveRecord::Base
2
- belongs_to :scc_product
3
- belongs_to :scc_extension, class_name: :SccProduct
2
+ belongs_to :scc_product, inverse_of: :scc_extendings
3
+ belongs_to :scc_extension, class_name: :SccProduct, inverse_of: :inverse_scc_extendings
4
4
  end
@@ -8,9 +8,10 @@ class SccProduct < ActiveRecord::Base
8
8
  belongs_to :product, class_name: 'Katello::Product'
9
9
  has_one :organization, through: :scc_account
10
10
  has_and_belongs_to_many :scc_repositories
11
- has_many :scc_extendings, dependent: :destroy
11
+ has_many :scc_extendings, inverse_of: :scc_product, dependent: :destroy
12
12
  has_many :scc_extensions, through: :scc_extendings
13
13
  has_many :inverse_scc_extendings,
14
+ inverse_of: :scc_extension,
14
15
  dependent: :destroy,
15
16
  class_name: :SccExtending,
16
17
  foreign_key: :scc_extension_id
@@ -1,24 +1,25 @@
1
- <% javascript 'foreman_scc_manager/scc_accounts' %>
1
+ <% javascript 'foreman_scc_manager/scc_accounts' %>
2
2
  <%= form_for([:bulk_subscribe, @scc_account], method: :put) do |f| %>
3
- <% def render_list_node(f, scc_product, parent_id = nil) %>
4
- <li>
5
- <span class="scc_product_checkbox" id="<%= "scc_product_span_#{scc_product.id}" %>" <%= "data-parent=scc_product_span_#{parent_id}" if parent_id %>>
6
- <% if scc_product.product %>
7
- <%= check_box_tag("scc_account[scc_unsubscribe_product_ids][]", scc_product.id, true, disabled: true) %>
8
- <% else %>
9
- <%= check_box_tag("scc_account[scc_subscribe_product_ids][]", scc_product.id, false) %>
10
- <% end %>
11
- </span>
12
- <%= scc_product.friendly_name %>
13
- <% if scc_product.scc_extensions.any? %>
14
- <ul>
15
- <% scc_product.scc_extensions.order(:friendly_name).each do |scc_extension| %>
16
- <% render_list_node(f, scc_extension, scc_product.id) %>
17
- <% end %>
18
- </ul>
19
- <% end %>
20
- </li>
21
- <% end %>
3
+ <% def render_list_node(f, scc_product, parent_id = nil) %>
4
+ <li>
5
+ <span class="scc_product_checkbox" id="<%= "scc_product_span_#{scc_product.id}" %>" <%= "data-parent=scc_product_span_#{parent_id}" if parent_id %>>
6
+ <% if scc_product.product %>
7
+ <%= check_box_tag("scc_account[scc_unsubscribe_product_ids][]", scc_product.id, true, disabled: true) %>
8
+ <% else %>
9
+ <%= check_box_tag("scc_account[scc_subscribe_product_ids][]", scc_product.id, false) %>
10
+ <% end %>
11
+ </span>
12
+ <%= scc_product.friendly_name %>
13
+ <% if scc_product.scc_extensions.any? %>
14
+ <ul>
15
+ <% scc_product.scc_extensions.order(:friendly_name).each do |scc_extension| %>
16
+ <% render_list_node(f, scc_extension, scc_product.id) %>
17
+ <% end %>
18
+ </ul>
19
+ <% end %>
20
+ </li>
21
+ <% end %>
22
+
22
23
  <%= f.hidden_field :prevent_missing, value: 1 %>
23
24
  <ul class="nav nav-tabs" data-tabs="tabs">
24
25
  <li class="active"><a href="#primary" data-toggle="tab"><%= _("SUSE Customer Center") %></a></li>
@@ -27,15 +28,16 @@
27
28
  <div class="tab-content">
28
29
  <div class="tab-pane active pre-scrollable" id="primary">
29
30
  <ul>
30
- <% if @scc_account.synced %>
31
- <% @scc_account.scc_products.where(product_type: 'base').order(:friendly_name).each do |scc_product| %>
32
- <% render_list_node(f, scc_product) %>
33
- <% end %>
34
- <% else %>
35
- <%= _('Please sync your SUSE subscriptions first.') %>
36
- <% end %>
31
+ <% if @scc_account.synced %>
32
+ <% @scc_account.scc_products.where(product_type: 'base').order(:friendly_name).each do |scc_product| %>
33
+ <% render_list_node(f, scc_product) %>
34
+ <% end %>
35
+ <% else %>
36
+ <%= _('Please sync your SUSE subscriptions first.') %>
37
+ <% submit_disabled = true %>
38
+ <% end %>
37
39
  </ul>
38
40
  </div>
39
- <%= submit_or_cancel f %>
41
+ <%= submit_or_cancel f, false, {disabled: submit_disabled || false} %>
40
42
  </div>
41
43
  <% end %>
@@ -1,3 +1,3 @@
1
1
  module ForemanSccManager
2
- VERSION = '1.1.2'.freeze
2
+ VERSION = '1.1.3'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_scc_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - ATIX AG
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-13 00:00:00.000000000 Z
11
+ date: 2017-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails