foreman_scc_manager 2.2.3 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/app/assets/javascripts/foreman_scc_manager/locale/de/foreman_scc_manager.js +592 -0
  4. data/app/assets/javascripts/foreman_scc_manager/locale/el/foreman_scc_manager.js +592 -0
  5. data/app/assets/javascripts/foreman_scc_manager/locale/en/foreman_scc_manager.js +592 -0
  6. data/app/assets/javascripts/foreman_scc_manager/locale/fr/foreman_scc_manager.js +592 -0
  7. data/app/assets/javascripts/foreman_scc_manager/locale/ja/foreman_scc_manager.js +592 -0
  8. data/app/assets/javascripts/foreman_scc_manager/locale/ka/foreman_scc_manager.js +592 -0
  9. data/app/assets/javascripts/foreman_scc_manager/locale/zh_CN/foreman_scc_manager.js +592 -0
  10. data/app/controllers/api/v2/scc_accounts_controller.rb +21 -17
  11. data/app/controllers/api/v2/scc_products_controller.rb +2 -2
  12. data/app/controllers/scc_accounts_controller.rb +14 -8
  13. data/app/lib/actions/scc_manager/subscribe_product.rb +14 -14
  14. data/app/lib/actions/scc_manager/sync_products.rb +6 -6
  15. data/app/lib/actions/scc_manager/sync_repositories.rb +5 -5
  16. data/app/models/scc_account.rb +2 -2
  17. data/app/models/scc_product.rb +4 -4
  18. data/app/views/api/v2/scc_products/main.json.rabl +1 -1
  19. data/db/migrate/20200520281300_fix_scc_permissions.rb +1 -1
  20. data/db/migrate/20210713092440_add_permissions.rb +1 -1
  21. data/db/migrate/20220429102717_populate_scc_katello_repositories.rb +1 -0
  22. data/lib/foreman_scc_manager/engine.rb +41 -46
  23. data/lib/foreman_scc_manager/version.rb +1 -1
  24. data/lib/tasks/rubocop.rake +2 -2
  25. data/lib/tasks/setup_authentication_token.rake +1 -1
  26. data/locale/Makefile +8 -10
  27. data/locale/fr/LC_MESSAGES/foreman_scc_manager.mo +0 -0
  28. data/locale/fr/foreman_scc_manager.po +601 -0
  29. data/package.json +12 -15
  30. data/test/controllers/api/v2/scc_accounts_test.rb +21 -21
  31. data/test/controllers/scc_accounts_controller_test.rb +9 -9
  32. data/test/features/sync_test.rb +9 -9
  33. data/test/fixtures/models/scc_repositories.yml +1 -1
  34. data/test/models/scc_account_test.rb +3 -3
  35. data/test/models/scc_product_test.rb +1 -1
  36. data/test/support/fixtures_support.rb +1 -1
  37. data/test/test_plugin_helper.rb +4 -4
  38. data/webpack/components/SCCProductPage/components/SCCProductPicker/components/SCCTreePicker/components/SCCRepoPicker/index.js +8 -8
  39. data/webpack/components/SCCProductPage/components/SCCProductPicker/components/SCCTreePicker/index.js +4 -12
  40. data/webpack/components/SCCProductPage/components/SCCProductView/components/SCCRepoView/index.js +4 -4
  41. metadata +14 -20
  42. data/locale/action_names.rb +0 -88
@@ -13,7 +13,7 @@ class Api::V2::SccAccountsControllerTest < ActionController::TestCase
13
13
  headers: {
14
14
  'Accept' => 'application/vnd.scc.suse.com.v4+json',
15
15
  'Authorization' => 'Basic b25ldXNlcjpvbmVwYXNz',
16
- 'Host' => 'scc.example.com'
16
+ 'Host' => 'scc.example.com',
17
17
  }
18
18
  ).to_return(
19
19
  status: 200,
@@ -35,12 +35,12 @@ class Api::V2::SccAccountsControllerTest < ActionController::TestCase
35
35
  cache_control: 'max-age=0, private, must-revalidate',
36
36
  set_cookie: [
37
37
  'XSRF-TOKEN=TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBp%0Ac2NpbmcgZWxpdCwgc2VkIGRvIGVpdXNtb2QgdGVtcG9yIGluY2l; path=/; secure',
38
- 'Uy#u~osh#oh3ahv.op0OII; Expires=Fri, 02-Mar-2029 15:07:20 GMT; Path=/'
38
+ 'Uy#u~osh#oh3ahv.op0OII; Expires=Fri, 02-Mar-2029 15:07:20 GMT; Path=/',
39
39
  ],
40
40
  x_request_id: '67450237-e4aa-4994-a47d-ed3ce142555b',
41
41
  x_runtime: '0.144083',
42
42
  strict_transport_security: 'max-age=15552000, max-age=300',
43
- content_encoding: 'gzip'
43
+ content_encoding: 'gzip',
44
44
  }
45
45
  )
46
46
 
@@ -52,7 +52,7 @@ class Api::V2::SccAccountsControllerTest < ActionController::TestCase
52
52
  headers: {
53
53
  'Accept' => 'application/vnd.scc.suse.com.v4+json',
54
54
  'Authorization' => 'Basic b25ldXNlcjpvbmVwYXNz',
55
- 'Host' => 'scc.example.com'
55
+ 'Host' => 'scc.example.com',
56
56
  }
57
57
  ).to_return(
58
58
  status: 200,
@@ -74,12 +74,12 @@ class Api::V2::SccAccountsControllerTest < ActionController::TestCase
74
74
  cache_control: 'max-age=0, private, must-revalidate',
75
75
  set_cookie: [
76
76
  'XSRF-TOKEN=SEZSwgerzOHlW5vYxxcVxrRQ3J4lKMmwGAIXpDyuTyCtcgQqrkMDlSdlxhU6rQp71%2Fdic6jiKgVbJB6vCeAJ2A%3D%3D; path=/; secure',
77
- 'TbBx+jfg=v1XitvAA@@ncY; Expires=Thu, 04-Oct-2029 13:14:57 GMT; Path=/'
77
+ 'TbBx+jfg=v1XitvAA@@ncY; Expires=Thu, 04-Oct-2029 13:14:57 GMT; Path=/',
78
78
  ],
79
79
  x_request_id: '2418bd69-efab-4d78-9a73-63570744d2cb',
80
80
  x_runtime: '0.645444',
81
81
  strict_transport_security: 'max-age=15552000, max-age=300',
82
- content_encoding: 'gzip'
82
+ content_encoding: 'gzip',
83
83
  }
84
84
  )
85
85
  ############
@@ -91,7 +91,7 @@ class Api::V2::SccAccountsControllerTest < ActionController::TestCase
91
91
  headers: {
92
92
  'Accept' => 'application/vnd.scc.suse.com.v4+json',
93
93
  'Authorization' => 'Basic b25ldXNlcjpvbmVwYXNz',
94
- 'Host' => 'scc.example.com'
94
+ 'Host' => 'scc.example.com',
95
95
  }
96
96
  ).to_return(
97
97
  status: 200,
@@ -114,12 +114,12 @@ class Api::V2::SccAccountsControllerTest < ActionController::TestCase
114
114
  cache_control: 'max-age=0, private, must-revalidate',
115
115
  set_cookie: [
116
116
  'XSRF-TOKEN=EABKsiefcpa7dMNEXRixmihKeUfIvXF4AwmNQt2wZG5Fm%2FPKvR0%2FMBDVV5lZJ3p4waUAcds2xWv42vbKg9GQhg%3D%3D; path=/; secure',
117
- 'TbBx+jfg=v1jitvAA@@UII; Expires=Thu, 08-Mar-2029 15:37:15 GMT; Path=/'
117
+ 'TbBx+jfg=v1jitvAA@@UII; Expires=Thu, 08-Mar-2029 15:37:15 GMT; Path=/',
118
118
  ],
119
119
  x_request_id: 'd2797941-1aed-499c-8e06-b4cb52515443',
120
120
  x_runtime: '6.671012',
121
121
  strict_transport_security: 'max-age=15552000, max-age=300',
122
- content_encoding: 'gzip'
122
+ content_encoding: 'gzip',
123
123
  }
124
124
  )
125
125
  # products page2
@@ -128,7 +128,7 @@ class Api::V2::SccAccountsControllerTest < ActionController::TestCase
128
128
  headers: {
129
129
  'Accept' => 'application/vnd.scc.suse.com.v4+json',
130
130
  'Authorization' => 'Basic b25ldXNlcjpvbmVwYXNz',
131
- 'Host' => 'scc.example.com'
131
+ 'Host' => 'scc.example.com',
132
132
  }
133
133
  ).to_return(
134
134
  status: 200,
@@ -151,12 +151,12 @@ class Api::V2::SccAccountsControllerTest < ActionController::TestCase
151
151
  cache_control: 'max-age=0, private, must-revalidate',
152
152
  set_cookie: [
153
153
  'XSRF-TOKEN=z3bGc45lQxf%2FXq7qN7cwzJrK1zcw4e7uuskVCPejeN0zv3ExUcb8ev3jhGnDGJaSz3ZwV7Dk0SdLII%2FOcI2eEw%3D%3D; path=/; secure',
154
- 'TbBx+jfg=v1oytvAA@@I73; Expires=Thu, 08-Mar-2029 15:37:23 GMT; Path=/'
154
+ 'TbBx+jfg=v1oytvAA@@I73; Expires=Thu, 08-Mar-2029 15:37:23 GMT; Path=/',
155
155
  ],
156
156
  x_request_id: '17e6707a-1134-403d-a49c-7344442446c1',
157
157
  x_runtime: '6.671012',
158
158
  strict_transport_security: 'max-age=15552000, max-age=300',
159
- content_encoding: 'gzip'
159
+ content_encoding: 'gzip',
160
160
  }
161
161
  )
162
162
  end
@@ -203,28 +203,28 @@ class Api::V2::SccAccountsControllerTest < ActionController::TestCase
203
203
 
204
204
  test 'should update scc_account' do
205
205
  account = scc_accounts(:two)
206
- put :update, params: { id: account.id, :scc_account => { :interval => 'weekly' } }
206
+ put :update, params: { id: account.id, scc_account: { :interval => 'weekly' } }
207
207
  assert_equal 'weekly', assigns(:scc_account).interval
208
208
  assert_response :ok
209
209
  end
210
210
 
211
211
  test 'should refuse update scc_account with invalid interval' do
212
212
  account = scc_accounts(:two)
213
- put :update, params: { id: account.id, :scc_account => { :interval => 'yearly' } }
213
+ put :update, params: { id: account.id, scc_account: { :interval => 'yearly' } }
214
214
  assert_equal 'yearly', assigns(:scc_account).interval
215
215
  assert_response :unprocessable_entity
216
216
  end
217
217
 
218
218
  test 'should refuse update scc_account with empty date' do
219
219
  account = scc_accounts(:two)
220
- put :update, params: { id: account.id, :scc_account => { :interval => 'weekly', :sync_date => '' } }
220
+ put :update, params: { id: account.id, scc_account: { :interval => 'weekly', :sync_date => '' } }
221
221
  assert_response :unprocessable_entity
222
222
  assert_error_message 'Sync date must be a valid datetime'
223
223
  end
224
224
 
225
225
  test 'should fail to update scc_account with interval set and invalid date' do
226
226
  account = scc_accounts(:two)
227
- put :update, params: { id: account.id, :scc_account => { :sync_date => 'invalid_date', :interval => 'weekly' } }
227
+ put :update, params: { id: account.id, scc_account: { :sync_date => 'invalid_date', :interval => 'weekly' } }
228
228
 
229
229
  assert_response :unprocessable_entity
230
230
  assert_error_message 'Sync date must be a valid datetime'
@@ -232,7 +232,7 @@ class Api::V2::SccAccountsControllerTest < ActionController::TestCase
232
232
 
233
233
  test 'should fail to update scc_account with empty name' do
234
234
  account = scc_accounts(:two)
235
- put :update, params: { id: account.id, :scc_account => { :name => '', :sync_date => Time.now, :interval => 'weekly' } }
235
+ put :update, params: { id: account.id, scc_account: { :name => '', :sync_date => Time.now, :interval => 'weekly' } }
236
236
 
237
237
  assert_response :unprocessable_entity
238
238
  assert_error_message "Name can't be blank"
@@ -240,7 +240,7 @@ class Api::V2::SccAccountsControllerTest < ActionController::TestCase
240
240
 
241
241
  test 'should fail to update scc_account with empty login' do
242
242
  account = scc_accounts(:two)
243
- put :update, params: { id: account.id, :scc_account => { :login => '', :sync_date => Time.now, :interval => 'weekly' } }
243
+ put :update, params: { id: account.id, scc_account: { :login => '', :sync_date => Time.now, :interval => 'weekly' } }
244
244
 
245
245
  assert_response :unprocessable_entity
246
246
  assert_error_message "Login can't be blank"
@@ -248,7 +248,7 @@ class Api::V2::SccAccountsControllerTest < ActionController::TestCase
248
248
 
249
249
  test 'should fail to update scc_account with empty base_url' do
250
250
  account = scc_accounts(:two)
251
- put :update, params: { id: account.id, :scc_account => { :base_url => '', :sync_date => Time.now, :interval => 'weekly' } }
251
+ put :update, params: { id: account.id, scc_account: { :base_url => '', :sync_date => Time.now, :interval => 'weekly' } }
252
252
 
253
253
  assert_response :unprocessable_entity
254
254
  assert_error_message "Base url can't be blank"
@@ -268,7 +268,7 @@ class Api::V2::SccAccountsControllerTest < ActionController::TestCase
268
268
  headers: {
269
269
  'Accept' => 'application/vnd.scc.suse.com.v4+json',
270
270
  'Authorization' => 'Basic b25ldXNlcjpvbmVwYXNz',
271
- 'Host' => 'scc.example.com'
271
+ 'Host' => 'scc.example.com',
272
272
  }
273
273
  ).to_return(status: 404)
274
274
  account = scc_accounts(:one)
@@ -294,7 +294,7 @@ class Api::V2::SccAccountsControllerTest < ActionController::TestCase
294
294
  headers: {
295
295
  'Accept' => 'application/vnd.scc.suse.com.v4+json',
296
296
  'Authorization' => 'Basic b25ldXNlcjpvbmVwYXNz',
297
- 'Host' => 'scc.example.com'
297
+ 'Host' => 'scc.example.com',
298
298
  }
299
299
  ).to_return(status: 404)
300
300
  account = scc_accounts(:one)
@@ -19,7 +19,7 @@ class SccAccountsControllerTest < ActionController::TestCase
19
19
  'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
20
20
  'Authorization' => auth,
21
21
  'Host' => host,
22
- 'User-Agent' => "rest-client/2.1.0 (linux x86_64) ruby/#{RUBY_VERSION}p#{RUBY_PATCHLEVEL}"
22
+ 'User-Agent' => "rest-client/2.1.0 (linux x86_64) ruby/#{RUBY_VERSION}p#{RUBY_PATCHLEVEL}",
23
23
  }
24
24
  )
25
25
  .to_return(status: 200, body: '', headers: {})
@@ -74,14 +74,14 @@ class SccAccountsControllerTest < ActionController::TestCase
74
74
 
75
75
  test 'should update scc_account' do
76
76
  account = scc_accounts(:two)
77
- put :update, params: { id: account.id, :scc_account => { :sync_date => Time.now, :interval => 'weekly' } }, session: set_session_user
77
+ put :update, params: { id: account.id, scc_account: { :sync_date => Time.now, :interval => 'weekly' } }, session: set_session_user
78
78
  assert_redirected_to '/scc_accounts'
79
79
  assert_equal 'weekly', SccAccount.find(account.id).interval
80
80
  end
81
81
 
82
82
  test 'should update scc_account with empty date if interval not set' do
83
83
  account = scc_accounts(:two)
84
- put :update, params: { id: account.id, :scc_account => { :name => 'new_name', :sync_date => '', :interval => 'never' } }, session: set_session_user
84
+ put :update, params: { id: account.id, scc_account: { :name => 'new_name', :sync_date => '', :interval => 'never' } }, session: set_session_user
85
85
 
86
86
  assert_equal 'new_name', SccAccount.find(account.id).name
87
87
  end
@@ -89,42 +89,42 @@ class SccAccountsControllerTest < ActionController::TestCase
89
89
  test 'updates scc_account even if the date is invalid' do
90
90
  # @todo reminder to fix this in the future
91
91
  account = scc_accounts(:two)
92
- put :update, params: { id: account.id, :scc_account => { :name => 'new_name', :sync_date => 'invalid_date', :interval => 'never' } }, session: set_session_user
92
+ put :update, params: { id: account.id, scc_account: { :name => 'new_name', :sync_date => 'invalid_date', :interval => 'never' } }, session: set_session_user
93
93
 
94
94
  assert_not_equal account.name, SccAccount.find(account.id).name
95
95
  end
96
96
 
97
97
  test 'should fail to update scc_account with interval set and empty date' do
98
98
  account = scc_accounts(:two)
99
- put :update, params: { id: account.id, :scc_account => { :sync_date => '', :interval => 'weekly' } }, session: set_session_user
99
+ put :update, params: { id: account.id, scc_account: { :sync_date => '', :interval => 'weekly' } }, session: set_session_user
100
100
 
101
101
  assert_equal SccAccount.find(account.id).sync_date, account.sync_date
102
102
  end
103
103
 
104
104
  test 'should fail to update scc_account with interval set and invalid date' do
105
105
  account = scc_accounts(:two)
106
- put :update, params: { id: account.id, :scc_account => { :sync_date => 'invalid_date', :interval => 'weekly' } }, session: set_session_user
106
+ put :update, params: { id: account.id, scc_account: { :sync_date => 'invalid_date', :interval => 'weekly' } }, session: set_session_user
107
107
 
108
108
  assert_equal SccAccount.find(account.id).sync_date, account.sync_date
109
109
  end
110
110
 
111
111
  test 'should fail to update scc_account with empty name' do
112
112
  account = scc_accounts(:two)
113
- put :update, params: { id: account.id, :scc_account => { :name => '', :sync_date => Time.now, :interval => 'weekly' } }, session: set_session_user
113
+ put :update, params: { id: account.id, scc_account: { :name => '', :sync_date => Time.now, :interval => 'weekly' } }, session: set_session_user
114
114
 
115
115
  assert_equal account.name, SccAccount.find(account.id).name
116
116
  end
117
117
 
118
118
  test 'should fail to update scc_account with empty login' do
119
119
  account = scc_accounts(:two)
120
- put :update, params: { id: account.id, :scc_account => { :login => '', :sync_date => Time.now, :interval => 'weekly' } }, session: set_session_user
120
+ put :update, params: { id: account.id, scc_account: { :login => '', :sync_date => Time.now, :interval => 'weekly' } }, session: set_session_user
121
121
 
122
122
  assert_equal account.login, SccAccount.find(account.id).login
123
123
  end
124
124
 
125
125
  test 'should fail to update scc_account with empty base url' do
126
126
  account = scc_accounts(:two)
127
- put :update, params: { id: account.id, :scc_account => { :base_url => '', :sync_date => Time.now, :interval => 'weekly' } }, session: set_session_user
127
+ put :update, params: { id: account.id, scc_account: { :base_url => '', :sync_date => Time.now, :interval => 'weekly' } }, session: set_session_user
128
128
 
129
129
  assert_equal account.base_url, SccAccount.find(account.id).base_url
130
130
  end
@@ -9,7 +9,7 @@ class SccAccountSyncTest < ActiveSupport::TestCase
9
9
  headers: {
10
10
  'Accept' => 'application/vnd.scc.suse.com.v4+json',
11
11
  'Authorization' => 'Basic b25ldXNlcjpvbmVwYXNz',
12
- 'Host' => 'scc.example.com'
12
+ 'Host' => 'scc.example.com',
13
13
  }
14
14
  ).to_return(
15
15
  status: 200,
@@ -31,12 +31,12 @@ class SccAccountSyncTest < ActiveSupport::TestCase
31
31
  cache_control: 'max-age=0, private, must-revalidate',
32
32
  set_cookie: [
33
33
  'XSRF-TOKEN=TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBp%0Ac2NpbmcgZWxpdCwgc2VkIGRvIGVpdXNtb2QgdGVtcG9yIGluY2l; path=/; secure',
34
- 'Uy#u~osh#oh3ahv.op0OII; Expires=Fri, 02-Mar-2029 15:07:20 GMT; Path=/'
34
+ 'Uy#u~osh#oh3ahv.op0OII; Expires=Fri, 02-Mar-2029 15:07:20 GMT; Path=/',
35
35
  ],
36
36
  x_request_id: '67450237-e4aa-4994-a47d-ed3ce142555b',
37
37
  x_runtime: '0.144083',
38
38
  strict_transport_security: 'max-age=15552000, max-age=300',
39
- content_encoding: 'gzip'
39
+ content_encoding: 'gzip',
40
40
  }
41
41
  )
42
42
  ############
@@ -48,7 +48,7 @@ class SccAccountSyncTest < ActiveSupport::TestCase
48
48
  headers: {
49
49
  'Accept' => 'application/vnd.scc.suse.com.v4+json',
50
50
  'Authorization' => 'Basic b25ldXNlcjpvbmVwYXNz',
51
- 'Host' => 'scc.example.com'
51
+ 'Host' => 'scc.example.com',
52
52
  }
53
53
  ).to_return(
54
54
  status: 200,
@@ -71,12 +71,12 @@ class SccAccountSyncTest < ActiveSupport::TestCase
71
71
  cache_control: 'max-age=0, private, must-revalidate',
72
72
  set_cookie: [
73
73
  'XSRF-TOKEN=EABKsiefcpa7dMNEXRixmihKeUfIvXF4AwmNQt2wZG5Fm%2FPKvR0%2FMBDVV5lZJ3p4waUAcds2xWv42vbKg9GQhg%3D%3D; path=/; secure',
74
- 'TbBx+jfg=v1jitvAA@@UII; Expires=Thu, 08-Mar-2029 15:37:15 GMT; Path=/'
74
+ 'TbBx+jfg=v1jitvAA@@UII; Expires=Thu, 08-Mar-2029 15:37:15 GMT; Path=/',
75
75
  ],
76
76
  x_request_id: 'd2797941-1aed-499c-8e06-b4cb52515443',
77
77
  x_runtime: '6.671012',
78
78
  strict_transport_security: 'max-age=15552000, max-age=300',
79
- content_encoding: 'gzip'
79
+ content_encoding: 'gzip',
80
80
  }
81
81
  )
82
82
  # products page2
@@ -85,7 +85,7 @@ class SccAccountSyncTest < ActiveSupport::TestCase
85
85
  headers: {
86
86
  'Accept' => 'application/vnd.scc.suse.com.v4+json',
87
87
  'Authorization' => 'Basic b25ldXNlcjpvbmVwYXNz',
88
- 'Host' => 'scc.example.com'
88
+ 'Host' => 'scc.example.com',
89
89
  }
90
90
  ).to_return(
91
91
  status: 200,
@@ -108,12 +108,12 @@ class SccAccountSyncTest < ActiveSupport::TestCase
108
108
  cache_control: 'max-age=0, private, must-revalidate',
109
109
  set_cookie: [
110
110
  'XSRF-TOKEN=z3bGc45lQxf%2FXq7qN7cwzJrK1zcw4e7uuskVCPejeN0zv3ExUcb8ev3jhGnDGJaSz3ZwV7Dk0SdLII%2FOcI2eEw%3D%3D; path=/; secure',
111
- 'TbBx+jfg=v1oytvAA@@I73; Expires=Thu, 08-Mar-2029 15:37:23 GMT; Path=/'
111
+ 'TbBx+jfg=v1oytvAA@@I73; Expires=Thu, 08-Mar-2029 15:37:23 GMT; Path=/',
112
112
  ],
113
113
  x_request_id: '17e6707a-1134-403d-a49c-7344442446c1',
114
114
  x_runtime: '6.671012',
115
115
  strict_transport_security: 'max-age=15552000, max-age=300',
116
- content_encoding: 'gzip'
116
+ content_encoding: 'gzip',
117
117
  }
118
118
  )
119
119
  end
@@ -13,7 +13,7 @@ repo_<%= i %>:
13
13
  installer_updates: false
14
14
  <% end %>
15
15
 
16
- repo_9:
16
+ repo9:
17
17
  id: 9
18
18
  scc_account_id: 1
19
19
  scc_id: 63
@@ -24,7 +24,7 @@ class SccAccountCreateTest < ActiveSupport::TestCase
24
24
  # base_url has a default value set in DB
25
25
  # base_url: 'https://scc.example.org',
26
26
  login: 'account1',
27
- password: 'secret'
27
+ password: 'secret',
28
28
  }
29
29
 
30
30
  # for every key in hash try to create account without it set
@@ -114,8 +114,8 @@ end
114
114
  class SccAccountUpdateReposTest < ActiveSupport::TestCase
115
115
  def setup
116
116
  @account = scc_accounts(:one)
117
- test_repo = scc_repositories(:repo_9)
118
- @account.scc_repositories = SccProduct.where(name: 'repo_9')
117
+ test_repo = scc_repositories(:repo9)
118
+ @account.scc_repositories = SccProduct.where(name: 'repo9')
119
119
  # generate test data
120
120
  @repo_data = { 'name' => test_repo.name,
121
121
  'id' => test_repo.scc_id,
@@ -22,7 +22,7 @@ class SccProductCreateTest < ActiveSupport::TestCase
22
22
 
23
23
  test 'pretty_description' do
24
24
  assert_equal @product_with_normal_description.description,
25
- @product_with_normal_description.pretty_description
25
+ @product_with_normal_description.pretty_description
26
26
  assert_equal @product.pretty_description, 'lorem ipsum dolor sit amet'
27
27
  assert_equal @product_with_ugly_description.pretty_description, 'lorem ipsum dolor sit amet'
28
28
  end
@@ -5,7 +5,7 @@ module ForemanSccManager
5
5
  scc_products: ::SccProduct,
6
6
  scc_repositories: ::SccRepository,
7
7
  katello_root_repositories: ::Katello::RootRepository,
8
- scc_katello_repositories: SccKatelloRepository
8
+ scc_katello_repositories: SccKatelloRepository,
9
9
  }.freeze
10
10
 
11
11
  def self.set_fixture_classes(test_class)
@@ -19,17 +19,17 @@ module FixtureTestCase
19
19
 
20
20
  # Fixtures are copied into a separate path to combine with Foreman fixtures. This directory
21
21
  # is kept out of version control.
22
- self.fixture_path = "#{Rails.root}/tmp/combined_fixtures/"
22
+ self.fixture_path = Rails.root.join('tmp/combined_fixtures/')
23
23
  FileUtils.rm_rf(self.fixture_path) if File.directory?(self.fixture_path)
24
24
  Dir.mkdir(self.fixture_path)
25
25
  FileUtils.cp(Dir.glob("#{ForemanSccManager::Engine.root}/test/fixtures/models/*"), self.fixture_path)
26
26
  FileUtils.cp(Dir.glob("#{ForemanSccManager::Engine.root}/test/fixtures/files/*"), self.fixture_path)
27
27
  FileUtils.cp(Dir.glob("#{ForemanSccManager::Engine.root}/test/fixtures/controllers/*"), self.fixture_path)
28
- FileUtils.cp(Dir.glob("#{Rails.root}/test/fixtures/*"), self.fixture_path)
28
+ FileUtils.cp(Dir.glob(Rails.root.join('test/fixtures/*')), self.fixture_path)
29
29
  fixtures(:all)
30
- FIXTURES = load_fixtures(ActiveRecord::Base)
30
+ fixtures_loaded = load_fixtures(ActiveRecord::Base)
31
31
 
32
- User.current = ::User.unscoped.find(FIXTURES['users']['admin']['id'])
32
+ User.current = ::User.unscoped.find(fixtures_loaded['users']['admin']['id'])
33
33
  end
34
34
  end
35
35
 
@@ -8,7 +8,7 @@ import './styles.scss';
8
8
  const createRepoSelectOption = (repo, disableRepos) => (
9
9
  <SelectOption
10
10
  key={repo.id}
11
- isDisabled={repo.katello_root_repository_id !== null || disableRepos}
11
+ isDisabled={repo.katello_repository_id !== null || disableRepos}
12
12
  value={repo.name}
13
13
  />
14
14
  );
@@ -30,14 +30,14 @@ const setRepoSelection = (
30
30
  (repo) =>
31
31
  (!repo.name.includes('Debug') &&
32
32
  !repo.name.includes('Source-Pool') &&
33
- repo.katello_root_repository_id === null) ||
34
- repo.katello_root_repository_id !== null
33
+ repo.katello_repository_id === null) ||
34
+ repo.katello_repository_id !== null
35
35
  );
36
36
  } else {
37
37
  res = sccRepos;
38
38
  }
39
39
  } else {
40
- res = sccRepos.filter((repo) => repo.katello_root_repository_id !== null);
40
+ res = sccRepos.filter((repo) => repo.katello_repository_id !== null);
41
41
  }
42
42
  return res.map((repo) => repo.name);
43
43
  };
@@ -83,7 +83,7 @@ const SCCRepoPicker = ({
83
83
  .filter(
84
84
  (repo) =>
85
85
  selectedRepos.includes(repo.name) &&
86
- repo.katello_root_repository_id === null
86
+ repo.katello_repository_id === null
87
87
  )
88
88
  .map((repo) => repo.id),
89
89
  sccRepos
@@ -91,7 +91,7 @@ const SCCRepoPicker = ({
91
91
  .filter(
92
92
  (repo) =>
93
93
  selectedRepos.includes(repo.name) &&
94
- repo.katello_root_repository_id === null
94
+ repo.katello_repository_id === null
95
95
  )
96
96
  .map((repo) => repo.name)
97
97
  );
@@ -120,7 +120,7 @@ const SCCRepoPicker = ({
120
120
  .filter(
121
121
  (repo) =>
122
122
  selectedRepos.includes(repo.name) &&
123
- repo.katello_root_repository_id === null
123
+ repo.katello_repository_id === null
124
124
  )
125
125
  .map((repo) => repo.id),
126
126
  sccRepos
@@ -128,7 +128,7 @@ const SCCRepoPicker = ({
128
128
  .filter(
129
129
  (repo) =>
130
130
  selectedRepos.includes(repo.name) &&
131
- repo.katello_root_repository_id === null
131
+ repo.katello_repository_id === null
132
132
  )
133
133
  .map((repo) => repo.name)
134
134
  );
@@ -33,11 +33,11 @@ const addParentToTree = (tree, par) => {
33
33
 
34
34
  const addSCCRepoPickerToTree = (
35
35
  tree,
36
- disableRepos,
37
36
  activateDebugFilter,
38
37
  setSelectedReposFromChild
39
38
  ) => {
40
- tree.customBadgeContent[0] = (
39
+ tree.customBadgeContent = [];
40
+ tree.customBadgeContent.push(
41
41
  <Tooltip content={__('Filter repositories')}>
42
42
  <SCCRepoPicker
43
43
  sccRepos={tree.scc_repositories}
@@ -47,7 +47,7 @@ const addSCCRepoPickerToTree = (
47
47
  sccProductId={tree.id}
48
48
  sccProductName={tree.name}
49
49
  setSelectedReposFromChild={setSelectedReposFromChild}
50
- />{' '}
50
+ />
51
51
  </Tooltip>
52
52
  );
53
53
  return tree;
@@ -59,14 +59,8 @@ const setupTreeViewListItem = (
59
59
  activateDebugFilter,
60
60
  setSelectedReposFromChild
61
61
  ) => {
62
- tree.customBadgeContent = [];
63
62
  addCheckBoxToTree(tree);
64
- addSCCRepoPickerToTree(
65
- tree,
66
- tree.product_id === null,
67
- activateDebugFilter,
68
- setSelectedReposFromChild
69
- );
63
+ addSCCRepoPickerToTree(tree, activateDebugFilter, setSelectedReposFromChild);
70
64
  if ('children' in tree) {
71
65
  tree.children = tree.children.map((p) =>
72
66
  setupTreeViewListItem(
@@ -90,7 +84,6 @@ const checkAllParents = (
90
84
  tree.checkProps.checked = true;
91
85
  addSCCRepoPickerToTree(
92
86
  tree,
93
- false,
94
87
  activateDebugFilter,
95
88
  setSelectedReposFromChild
96
89
  );
@@ -114,7 +107,6 @@ const uncheckAllChildren = (
114
107
  tree.checkProps.checked = false;
115
108
  addSCCRepoPickerToTree(
116
109
  tree,
117
- true,
118
110
  activateDebugFilter,
119
111
  setSelectedReposFromChild
120
112
  );
@@ -16,7 +16,7 @@ import './styles.scss';
16
16
 
17
17
  const createKatelloRepoLink = (repo, sccProductId) => {
18
18
  const url = foremanUrl(
19
- `/products/${sccProductId}/repositories/${repo.katello_root_repository_id}`
19
+ `/products/${sccProductId}/repositories/${repo.katello_repository_id}`
20
20
  );
21
21
  return (
22
22
  <Tooltip content={__('Go to Repository page')}>
@@ -35,7 +35,7 @@ const createRepoDropDownItem = (repo, sccProductId) => (
35
35
  component="button"
36
36
  icon={
37
37
  repo.subscription_valid ? (
38
- repo.katello_root_repository_id !== null ? (
38
+ repo.katello_repository_id !== null ? (
39
39
  <Icon name="check" type="fa" />
40
40
  ) : (
41
41
  <Tooltip content={__('Repository not imported')}>
@@ -49,7 +49,7 @@ const createRepoDropDownItem = (repo, sccProductId) => (
49
49
  )
50
50
  }
51
51
  >
52
- {repo.katello_root_repository_id !== null
52
+ {repo.katello_repository_id !== null
53
53
  ? createKatelloRepoLink(repo, sccProductId)
54
54
  : repo.name}
55
55
  </DropdownItem>
@@ -88,7 +88,7 @@ const SCCRepoView = ({ sccRepos, sccProductId }) => {
88
88
  >
89
89
  {sprintf(
90
90
  __('Repositories (%s/%s)'),
91
- sccRepos.filter((r) => r.katello_root_repository_id !== null)
91
+ sccRepos.filter((r) => r.katello_repository_id !== null)
92
92
  .length,
93
93
  sccRepos.length
94
94
  )}
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: 2.2.3
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ATIX AG
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-16 00:00:00.000000000 Z
11
+ date: 2024-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rdoc
@@ -31,33 +31,19 @@ dependencies:
31
31
  - !ruby/object:Gem::Version
32
32
  version: 6.3.1
33
33
  - !ruby/object:Gem::Dependency
34
- name: rubocop
34
+ name: theforeman-rubocop
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: 0.89.0
39
+ version: 0.1.0
40
40
  type: :development
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: 0.89.0
47
- - !ruby/object:Gem::Dependency
48
- name: rubocop-rails
49
- requirement: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - "~>"
52
- - !ruby/object:Gem::Version
53
- version: 2.8.1
54
- type: :development
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- requirements:
58
- - - "~>"
59
- - !ruby/object:Gem::Version
60
- version: 2.8.1
46
+ version: 0.1.0
61
47
  - !ruby/object:Gem::Dependency
62
48
  name: webmock
63
49
  requirement: !ruby/object:Gem::Requirement
@@ -97,6 +83,13 @@ files:
97
83
  - LICENSE
98
84
  - README.md
99
85
  - Rakefile
86
+ - app/assets/javascripts/foreman_scc_manager/locale/de/foreman_scc_manager.js
87
+ - app/assets/javascripts/foreman_scc_manager/locale/el/foreman_scc_manager.js
88
+ - app/assets/javascripts/foreman_scc_manager/locale/en/foreman_scc_manager.js
89
+ - app/assets/javascripts/foreman_scc_manager/locale/fr/foreman_scc_manager.js
90
+ - app/assets/javascripts/foreman_scc_manager/locale/ja/foreman_scc_manager.js
91
+ - app/assets/javascripts/foreman_scc_manager/locale/ka/foreman_scc_manager.js
92
+ - app/assets/javascripts/foreman_scc_manager/locale/zh_CN/foreman_scc_manager.js
100
93
  - app/assets/javascripts/foreman_scc_manager/scc_accounts.js.coffee
101
94
  - app/controllers/api/v2/scc_accounts_controller.rb
102
95
  - app/controllers/api/v2/scc_products_controller.rb
@@ -166,7 +159,6 @@ files:
166
159
  - lib/tasks/setup_authentication_token.rake
167
160
  - lib/tasks/test.rake
168
161
  - locale/Makefile
169
- - locale/action_names.rb
170
162
  - locale/de/LC_MESSAGES/foreman_scc_manager.mo
171
163
  - locale/de/foreman_scc_manager.po
172
164
  - locale/el/LC_MESSAGES/foreman_scc_manager.mo
@@ -174,6 +166,8 @@ files:
174
166
  - locale/en/LC_MESSAGES/foreman_scc_manager.mo
175
167
  - locale/en/foreman_scc_manager.po
176
168
  - locale/foreman_scc_manager.pot
169
+ - locale/fr/LC_MESSAGES/foreman_scc_manager.mo
170
+ - locale/fr/foreman_scc_manager.po
177
171
  - locale/gemspec.rb
178
172
  - locale/ja/LC_MESSAGES/foreman_scc_manager.mo
179
173
  - locale/ja/foreman_scc_manager.po