foreman_puppet 6.2.0 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/foreman_puppet/locale/ca/foreman_puppet.js +36 -0
  3. data/app/assets/javascripts/foreman_puppet/locale/cs_CZ/foreman_puppet.js +36 -0
  4. data/app/assets/javascripts/foreman_puppet/locale/de/foreman_puppet.js +36 -0
  5. data/app/assets/javascripts/foreman_puppet/locale/en/foreman_puppet.js +36 -0
  6. data/app/assets/javascripts/foreman_puppet/locale/en_GB/foreman_puppet.js +36 -0
  7. data/app/assets/javascripts/foreman_puppet/locale/es/foreman_puppet.js +36 -0
  8. data/app/assets/javascripts/foreman_puppet/locale/fr/foreman_puppet.js +36 -0
  9. data/app/assets/javascripts/foreman_puppet/locale/gl/foreman_puppet.js +36 -0
  10. data/app/assets/javascripts/foreman_puppet/locale/it/foreman_puppet.js +36 -0
  11. data/app/assets/javascripts/foreman_puppet/locale/ja/foreman_puppet.js +36 -0
  12. data/app/assets/javascripts/foreman_puppet/locale/ka/foreman_puppet.js +36 -0
  13. data/app/assets/javascripts/foreman_puppet/locale/ko/foreman_puppet.js +36 -0
  14. data/app/assets/javascripts/foreman_puppet/locale/nl_NL/foreman_puppet.js +36 -0
  15. data/app/assets/javascripts/foreman_puppet/locale/pl/foreman_puppet.js +36 -0
  16. data/app/assets/javascripts/foreman_puppet/locale/pt_BR/foreman_puppet.js +36 -0
  17. data/app/assets/javascripts/foreman_puppet/locale/ru/foreman_puppet.js +36 -0
  18. data/app/assets/javascripts/foreman_puppet/locale/sv_SE/foreman_puppet.js +36 -0
  19. data/app/assets/javascripts/foreman_puppet/locale/zh_CN/foreman_puppet.js +36 -0
  20. data/app/assets/javascripts/foreman_puppet/locale/zh_TW/foreman_puppet.js +36 -0
  21. data/app/controllers/concerns/foreman_puppet/extensions/api_v2_registration_controller_extensions.rb +21 -0
  22. data/app/models/concerns/foreman_puppet/extensions/host_common.rb +1 -2
  23. data/app/views/foreman_puppet/puppetclasses/index.html.erb +1 -1
  24. data/lib/foreman_puppet/engine.rb +1 -0
  25. data/lib/foreman_puppet/version.rb +1 -1
  26. data/locale/ca/foreman_puppet.po +36 -0
  27. data/locale/cs_CZ/foreman_puppet.po +36 -0
  28. data/locale/de/foreman_puppet.po +36 -0
  29. data/locale/en/foreman_puppet.po +36 -0
  30. data/locale/en_GB/foreman_puppet.po +36 -0
  31. data/locale/es/foreman_puppet.po +36 -0
  32. data/locale/foreman_puppet.pot +63 -2
  33. data/locale/fr/foreman_puppet.po +36 -0
  34. data/locale/gl/foreman_puppet.po +36 -0
  35. data/locale/it/foreman_puppet.po +36 -0
  36. data/locale/ja/foreman_puppet.po +36 -0
  37. data/locale/ka/foreman_puppet.po +36 -0
  38. data/locale/ko/foreman_puppet.po +36 -0
  39. data/locale/nl_NL/foreman_puppet.po +36 -0
  40. data/locale/pl/foreman_puppet.po +36 -0
  41. data/locale/pt_BR/foreman_puppet.po +36 -0
  42. data/locale/ru/foreman_puppet.po +36 -0
  43. data/locale/sv_SE/foreman_puppet.po +36 -0
  44. data/locale/zh_CN/foreman_puppet.po +36 -0
  45. data/locale/zh_TW/foreman_puppet.po +36 -0
  46. data/test/integration/foreman_puppet/smartclass_parameter_js_test.rb +2 -0
  47. data/test/models/foreman_puppet/host_test.rb +14 -2
  48. data/test/models/foreman_puppet/hostgroup_test.rb +12 -0
  49. data/webpack/global_index.js +21 -0
  50. data/webpack/src/foreman_class_edit.js +2 -2
  51. data/webpack/src/foreman_puppet_host_form.js +1 -1
  52. data/webpack/src/foreman_puppet_host_form.test.js +3 -4
  53. metadata +55 -55
  54. data/locale/en/foreman_puppet.edit.po +0 -0
@@ -118,6 +118,9 @@ msgstr "Изменить окружение"
118
118
  msgid "Change Puppet Master"
119
119
  msgstr "Изменить мастер-сервер Puppet"
120
120
 
121
+ msgid "Changed"
122
+ msgstr ""
123
+
121
124
  msgid "Changed environments"
122
125
  msgstr "Изменение окружений"
123
126
 
@@ -157,6 +160,9 @@ msgstr ""
157
160
  msgid "Copy to clipboard"
158
161
  msgstr ""
159
162
 
163
+ msgid "Corrective Change"
164
+ msgstr ""
165
+
160
166
  msgid "Couldn't find any ENC data for this host"
161
167
  msgstr ""
162
168
 
@@ -271,12 +277,18 @@ msgstr ""
271
277
  msgid "Facts"
272
278
  msgstr "Факты"
273
279
 
280
+ msgid "Failed"
281
+ msgstr ""
282
+
274
283
  msgid "Failed to import %{klass} for %{name}: doesn't exists in our database - ignoring"
275
284
  msgstr "Не удалось импортировать %{klass} для %{name}: не найден в нашей базе данных. Игнорируется..."
276
285
 
277
286
  msgid "Failed to set %{proxy_type} proxy for %{host}."
278
287
  msgstr "Не удалось настроить %{proxy_type} в качестве прокси для %{host}."
279
288
 
289
+ msgid "Failed to start"
290
+ msgstr ""
291
+
280
292
  msgid "Failed to update environments and Puppet classes from the on-disk Puppet installation: %s"
281
293
  msgstr "Не удалось обновить окружения и классы Puppet в соответствии с дисковой установкой Puppet: %s"
282
294
 
@@ -418,6 +430,9 @@ msgstr ""
418
430
  msgid "Invalid proxy selected!"
419
431
  msgstr "Выбран неверный прокси."
420
432
 
433
+ msgid "Last configuration status"
434
+ msgstr ""
435
+
421
436
  msgid "List all Puppet class IDs for host"
422
437
  msgstr "Список всех кодов классов Puppet для узла"
423
438
 
@@ -493,12 +508,18 @@ msgstr "Слить все совпадающие значения (только
493
508
  msgid "Name"
494
509
  msgstr "Имя"
495
510
 
511
+ msgid "Never"
512
+ msgstr ""
513
+
496
514
  msgid "New"
497
515
  msgstr "Новое"
498
516
 
499
517
  msgid "No changes to your environments detected"
500
518
  msgstr "Нет изменений в окружениях"
501
519
 
520
+ msgid "No configuration status available"
521
+ msgstr ""
522
+
502
523
  msgid "No environment selected!"
503
524
  msgstr "Окружение не выбрано."
504
525
 
@@ -562,6 +583,9 @@ msgstr "Организации"
562
583
  msgid "Original value info"
563
584
  msgstr "Сведения об исходном значении"
564
585
 
586
+ msgid "Out of sync"
587
+ msgstr ""
588
+
565
589
  msgid "Overridden"
566
590
  msgstr ""
567
591
 
@@ -646,6 +670,9 @@ msgstr "Описание внешних узлов Puppet в формате YAML
646
670
  msgid "Puppet interval"
647
671
  msgstr "Интервал Puppet"
648
672
 
673
+ msgid "Puppet metrics"
674
+ msgstr ""
675
+
649
676
  msgid "Puppet parameter"
650
677
  msgstr "Параметр Puppet"
651
678
 
@@ -682,6 +709,12 @@ msgstr "Отчеты"
682
709
  msgid "Required parameter without value.<br/><b>Please override!</b><br/>"
683
710
  msgstr "Обязательный параметр без значения.<br/><b>Необходимо переопределить.</b><br/>"
684
711
 
712
+ msgid "Restarted"
713
+ msgstr ""
714
+
715
+ msgid "Scheduled"
716
+ msgstr ""
717
+
685
718
  msgid "Select environment"
686
719
  msgstr "Выберите окружение"
687
720
 
@@ -718,6 +751,9 @@ msgstr "Показать значение переопределения для
718
751
  msgid "Show template combination"
719
752
  msgstr "Показать комбинацию шаблонов"
720
753
 
754
+ msgid "Skipped"
755
+ msgstr ""
756
+
721
757
  msgid "Smart Class Parameter"
722
758
  msgstr "Смарт-параметры"
723
759
 
@@ -113,6 +113,9 @@ msgstr "Byt Miljö"
113
113
  msgid "Change Puppet Master"
114
114
  msgstr ""
115
115
 
116
+ msgid "Changed"
117
+ msgstr ""
118
+
116
119
  msgid "Changed environments"
117
120
  msgstr "Ändrade miljöer"
118
121
 
@@ -152,6 +155,9 @@ msgstr ""
152
155
  msgid "Copy to clipboard"
153
156
  msgstr ""
154
157
 
158
+ msgid "Corrective Change"
159
+ msgstr ""
160
+
155
161
  msgid "Couldn't find any ENC data for this host"
156
162
  msgstr ""
157
163
 
@@ -266,12 +272,18 @@ msgstr ""
266
272
  msgid "Facts"
267
273
  msgstr "Fakta"
268
274
 
275
+ msgid "Failed"
276
+ msgstr ""
277
+
269
278
  msgid "Failed to import %{klass} for %{name}: doesn't exists in our database - ignoring"
270
279
  msgstr "Misslyckades med att importera %{klass} på grund av att %{name}: inte existerar i vår databas - ignorerar"
271
280
 
272
281
  msgid "Failed to set %{proxy_type} proxy for %{host}."
273
282
  msgstr ""
274
283
 
284
+ msgid "Failed to start"
285
+ msgstr ""
286
+
275
287
  msgid "Failed to update environments and Puppet classes from the on-disk Puppet installation: %s"
276
288
  msgstr ""
277
289
 
@@ -413,6 +425,9 @@ msgstr ""
413
425
  msgid "Invalid proxy selected!"
414
426
  msgstr ""
415
427
 
428
+ msgid "Last configuration status"
429
+ msgstr ""
430
+
416
431
  msgid "List all Puppet class IDs for host"
417
432
  msgstr ""
418
433
 
@@ -488,12 +503,18 @@ msgstr ""
488
503
  msgid "Name"
489
504
  msgstr "Namn"
490
505
 
506
+ msgid "Never"
507
+ msgstr ""
508
+
491
509
  msgid "New"
492
510
  msgstr "Ny"
493
511
 
494
512
  msgid "No changes to your environments detected"
495
513
  msgstr ""
496
514
 
515
+ msgid "No configuration status available"
516
+ msgstr ""
517
+
497
518
  msgid "No environment selected!"
498
519
  msgstr "Ingen miljö vald!"
499
520
 
@@ -557,6 +578,9 @@ msgstr "Organisationer"
557
578
  msgid "Original value info"
558
579
  msgstr ""
559
580
 
581
+ msgid "Out of sync"
582
+ msgstr ""
583
+
560
584
  msgid "Overridden"
561
585
  msgstr ""
562
586
 
@@ -641,6 +665,9 @@ msgstr "Puppet externa noder YAML-export"
641
665
  msgid "Puppet interval"
642
666
  msgstr ""
643
667
 
668
+ msgid "Puppet metrics"
669
+ msgstr ""
670
+
644
671
  msgid "Puppet parameter"
645
672
  msgstr ""
646
673
 
@@ -677,6 +704,12 @@ msgstr "Rapporter"
677
704
  msgid "Required parameter without value.<br/><b>Please override!</b><br/>"
678
705
  msgstr ""
679
706
 
707
+ msgid "Restarted"
708
+ msgstr ""
709
+
710
+ msgid "Scheduled"
711
+ msgstr ""
712
+
680
713
  msgid "Select environment"
681
714
  msgstr "Välj miljö"
682
715
 
@@ -713,6 +746,9 @@ msgstr ""
713
746
  msgid "Show template combination"
714
747
  msgstr ""
715
748
 
749
+ msgid "Skipped"
750
+ msgstr ""
751
+
716
752
  msgid "Smart Class Parameter"
717
753
  msgstr "Smart Klassparameter"
718
754
 
@@ -117,6 +117,9 @@ msgstr "改变环境"
117
117
  msgid "Change Puppet Master"
118
118
  msgstr "更改 Puppet 主服务器"
119
119
 
120
+ msgid "Changed"
121
+ msgstr ""
122
+
120
123
  msgid "Changed environments"
121
124
  msgstr "修改的环境"
122
125
 
@@ -156,6 +159,9 @@ msgstr "配置管理"
156
159
  msgid "Copy to clipboard"
157
160
  msgstr ""
158
161
 
162
+ msgid "Corrective Change"
163
+ msgstr ""
164
+
159
165
  msgid "Couldn't find any ENC data for this host"
160
166
  msgstr "无法找到此主机的任何 ENC 数据"
161
167
 
@@ -270,12 +276,18 @@ msgstr "错误!"
270
276
  msgid "Facts"
271
277
  msgstr "Facts"
272
278
 
279
+ msgid "Failed"
280
+ msgstr ""
281
+
273
282
  msgid "Failed to import %{klass} for %{name}: doesn't exists in our database - ignoring"
274
283
  msgstr "为 %{name} 导入 %{klass} 失败:不存在于我们的数据库中 -- 忽略"
275
284
 
276
285
  msgid "Failed to set %{proxy_type} proxy for %{host}."
277
286
  msgstr "无法为 %{host} 设置 {proxy_type} 代理服务器。"
278
287
 
288
+ msgid "Failed to start"
289
+ msgstr ""
290
+
279
291
  msgid "Failed to update environments and Puppet classes from the on-disk Puppet installation: %s"
280
292
  msgstr "无法使用磁盘 Puppet 安装更新环境及 Puppet 类别:%s"
281
293
 
@@ -417,6 +429,9 @@ msgstr "从 %s 继承的类"
417
429
  msgid "Invalid proxy selected!"
418
430
  msgstr "所选代理服务器无效!"
419
431
 
432
+ msgid "Last configuration status"
433
+ msgstr ""
434
+
420
435
  msgid "List all Puppet class IDs for host"
421
436
  msgstr "列出主机的所有 Puppet 类 ID"
422
437
 
@@ -492,12 +507,18 @@ msgstr "合并所有匹配的值(仅用于阵列/哈希类型)"
492
507
  msgid "Name"
493
508
  msgstr "名称"
494
509
 
510
+ msgid "Never"
511
+ msgstr ""
512
+
495
513
  msgid "New"
496
514
  msgstr "新"
497
515
 
498
516
  msgid "No changes to your environments detected"
499
517
  msgstr "未探测到您的环境有任何变化"
500
518
 
519
+ msgid "No configuration status available"
520
+ msgstr ""
521
+
501
522
  msgid "No environment selected!"
502
523
  msgstr "没有选择环境!"
503
524
 
@@ -561,6 +582,9 @@ msgstr "机构"
561
582
  msgid "Original value info"
562
583
  msgstr "原始值信息"
563
584
 
585
+ msgid "Out of sync"
586
+ msgstr ""
587
+
564
588
  msgid "Overridden"
565
589
  msgstr "覆盖"
566
590
 
@@ -645,6 +669,9 @@ msgstr "Puppet 外部节点 YAML 转储"
645
669
  msgid "Puppet interval"
646
670
  msgstr "Puppet 间隔"
647
671
 
672
+ msgid "Puppet metrics"
673
+ msgstr ""
674
+
648
675
  msgid "Puppet parameter"
649
676
  msgstr "Puppet 参数"
650
677
 
@@ -681,6 +708,12 @@ msgstr "报表"
681
708
  msgid "Required parameter without value.<br/><b>Please override!</b><br/>"
682
709
  msgstr "需要的参数没有值。<br/><b>请覆盖</b><br/>"
683
710
 
711
+ msgid "Restarted"
712
+ msgstr ""
713
+
714
+ msgid "Scheduled"
715
+ msgstr ""
716
+
684
717
  msgid "Select environment"
685
718
  msgstr "选择环境"
686
719
 
@@ -717,6 +750,9 @@ msgstr "显示具体智能类别参数的替代值"
717
750
  msgid "Show template combination"
718
751
  msgstr "显示模板组合"
719
752
 
753
+ msgid "Skipped"
754
+ msgstr ""
755
+
720
756
  msgid "Smart Class Parameter"
721
757
  msgstr "智能代理参数"
722
758
 
@@ -112,6 +112,9 @@ msgstr "更改環境"
112
112
  msgid "Change Puppet Master"
113
113
  msgstr "改變 Puppet Master"
114
114
 
115
+ msgid "Changed"
116
+ msgstr ""
117
+
115
118
  msgid "Changed environments"
116
119
  msgstr "已更改的環境"
117
120
 
@@ -151,6 +154,9 @@ msgstr ""
151
154
  msgid "Copy to clipboard"
152
155
  msgstr ""
153
156
 
157
+ msgid "Corrective Change"
158
+ msgstr ""
159
+
154
160
  msgid "Couldn't find any ENC data for this host"
155
161
  msgstr ""
156
162
 
@@ -265,12 +271,18 @@ msgstr ""
265
271
  msgid "Facts"
266
272
  msgstr "詳情"
267
273
 
274
+ msgid "Failed"
275
+ msgstr ""
276
+
268
277
  msgid "Failed to import %{klass} for %{name}: doesn't exists in our database - ignoring"
269
278
  msgstr "為 %{name} 匯入 %{klass} 失敗:不存在我們的資料庫中 - 將被忽略"
270
279
 
271
280
  msgid "Failed to set %{proxy_type} proxy for %{host}."
272
281
  msgstr "設定 %{proxy_type} 代理給 %{host} 時失敗。"
273
282
 
283
+ msgid "Failed to start"
284
+ msgstr ""
285
+
274
286
  msgid "Failed to update environments and Puppet classes from the on-disk Puppet installation: %s"
275
287
  msgstr ""
276
288
 
@@ -412,6 +424,9 @@ msgstr ""
412
424
  msgid "Invalid proxy selected!"
413
425
  msgstr "選擇了不正確的代理!"
414
426
 
427
+ msgid "Last configuration status"
428
+ msgstr ""
429
+
415
430
  msgid "List all Puppet class IDs for host"
416
431
  msgstr "列出主機的所有 Puppet 類別 ID"
417
432
 
@@ -487,12 +502,18 @@ msgstr "合併所有相符的值(只有陣列 / 雜湊類型)"
487
502
  msgid "Name"
488
503
  msgstr "名稱"
489
504
 
505
+ msgid "Never"
506
+ msgstr ""
507
+
490
508
  msgid "New"
491
509
  msgstr "新增"
492
510
 
493
511
  msgid "No changes to your environments detected"
494
512
  msgstr "未偵測到您的環境遭到變更"
495
513
 
514
+ msgid "No configuration status available"
515
+ msgstr ""
516
+
496
517
  msgid "No environment selected!"
497
518
  msgstr "未選擇環境!"
498
519
 
@@ -556,6 +577,9 @@ msgstr "組織"
556
577
  msgid "Original value info"
557
578
  msgstr "原始值資訊"
558
579
 
580
+ msgid "Out of sync"
581
+ msgstr ""
582
+
559
583
  msgid "Overridden"
560
584
  msgstr ""
561
585
 
@@ -640,6 +664,9 @@ msgstr "Puppet 外部節點 YAML 傾印"
640
664
  msgid "Puppet interval"
641
665
  msgstr "Puppet 間隔"
642
666
 
667
+ msgid "Puppet metrics"
668
+ msgstr ""
669
+
643
670
  msgid "Puppet parameter"
644
671
  msgstr "Puppet 參數"
645
672
 
@@ -676,6 +703,12 @@ msgstr "報告"
676
703
  msgid "Required parameter without value.<br/><b>Please override!</b><br/>"
677
704
  msgstr "必要的參數未提供值。<br/><b>請覆寫!</b> <br/>"
678
705
 
706
+ msgid "Restarted"
707
+ msgstr ""
708
+
709
+ msgid "Scheduled"
710
+ msgstr ""
711
+
679
712
  msgid "Select environment"
680
713
  msgstr "選擇環境"
681
714
 
@@ -712,6 +745,9 @@ msgstr "顯示特定智慧類別參數的置換值"
712
745
  msgid "Show template combination"
713
746
  msgstr "顯示範本組合"
714
747
 
748
+ msgid "Skipped"
749
+ msgstr ""
750
+
715
751
  msgid "Smart Class Parameter"
716
752
  msgstr "智慧類別參數"
717
753
 
@@ -74,6 +74,8 @@ module ForemanPuppet
74
74
  within(:xpath, '//table') do
75
75
  click_link 'ssl'
76
76
  end
77
+ # see: https://projects.theforeman.org/issues/37251
78
+ page.driver.browser.file_detector = nil if page.driver.browser.respond_to?(:file_detector=)
77
79
  fill_in 'puppetclass_lookup_key_description', with: 'test'
78
80
  fill_in 'puppetclass_lookup_key_default_value', with: 'false'
79
81
  assert_submit_button(puppetclass_lookup_keys_path)
@@ -172,7 +172,7 @@ module ForemanPuppet
172
172
  host.expects(:template_kinds).returns(template_kinds)
173
173
  template_kinds.each do |kind|
174
174
  ::ProvisioningTemplate.expects(:find_template)
175
- .with(kind: kind.name, operatingsystem_id: host.operatingsystem.id, hostgroup_id: host.hostgroup.id, environment_id: host.puppet.environment.id)
175
+ .with({ kind: kind.name, operatingsystem_id: host.operatingsystem.id, hostgroup_id: host.hostgroup.id, environment_id: host.puppet.environment.id })
176
176
  .returns(stub(name: "default #{kind.name}"))
177
177
  end
178
178
  assert_equal template_kinds.map { |k| "default #{k.name}" }, host.available_template_kinds.map(&:name)
@@ -183,7 +183,7 @@ module ForemanPuppet
183
183
  host.expects(:template_kinds).returns(template_kinds)
184
184
  template_kinds.each do |kind|
185
185
  ::ProvisioningTemplate.expects(:find_template)
186
- .with(kind: kind.name, operatingsystem_id: host.operatingsystem.id, hostgroup_id: host.hostgroup.id, environment_id: nil)
186
+ .with({ kind: kind.name, operatingsystem_id: host.operatingsystem.id, hostgroup_id: host.hostgroup.id, environment_id: nil })
187
187
  .returns(stub(name: "default #{kind.name}"))
188
188
  end
189
189
  assert_equal template_kinds.map { |k| "default #{k.name}" }, host.available_template_kinds.map(&:name)
@@ -325,5 +325,17 @@ module ForemanPuppet
325
325
  h.save!
326
326
  assert_empty h.puppet.config_groups
327
327
  end
328
+
329
+ test 'assign a puppet class to host without puppet facet' do
330
+ puppet_class = FactoryBot.create(:puppetclass)
331
+ host = FactoryBot.create(:host)
332
+ # This would raise the following exception
333
+ # NoMethodError: undefined method `<<' for #<ActiveRecord::Relation []>
334
+ host.puppetclasses << puppet_class
335
+
336
+ assert_not_nil host.puppet
337
+ assert_includes host.puppet.puppetclasses, puppet_class
338
+ assert_includes host.puppetclasses, puppet_class
339
+ end
328
340
  end
329
341
  end
@@ -10,5 +10,17 @@ module ForemanPuppet
10
10
  assert_equal 1, hostgroups.count
11
11
  assert_equal hostgroups.pluck(:id).sort, hostgroups.map(&:id).sort
12
12
  end
13
+
14
+ test 'assign a puppet class to hostgroup without puppet facet' do
15
+ puppet_class = FactoryBot.create(:puppetclass)
16
+ hostgroup = FactoryBot.create(:hostgroup)
17
+ # This would raise the following exception
18
+ # NoMethodError: undefined method `<<' for #<ActiveRecord::Relation []>
19
+ hostgroup.puppetclasses << puppet_class
20
+
21
+ assert_not_nil hostgroup.puppet
22
+ assert_includes hostgroup.puppet.puppetclasses, puppet_class
23
+ assert_includes hostgroup.puppetclasses, puppet_class
24
+ end
13
25
  end
14
26
  end
@@ -1,4 +1,6 @@
1
1
  import { registerReducer } from 'foremanReact/common/MountingService';
2
+ import { registerColumns } from 'foremanReact/components/HostsIndex/Columns/core';
3
+ import { translate as __ } from 'foremanReact/common/I18n';
2
4
  import reducers from './src/reducers';
3
5
  import { registerFills } from './src/Extends/Fills';
4
6
  import { registerLegacy } from './legacy';
@@ -9,3 +11,22 @@ registerReducer('puppet', reducers);
9
11
  registerFills();
10
12
  // TODO: the checkForUnavailablePuppetclasses is very nasty
11
13
  registerLegacy();
14
+
15
+ // register columns for React hosts index page
16
+ const puppetHostsIndexColumns = [
17
+ {
18
+ columnName: 'environment',
19
+ title: __('Puppet env'),
20
+ isSorted: true,
21
+ wrapper: hostDetails => hostDetails.environment_name,
22
+ weight: 2700,
23
+ },
24
+ ];
25
+
26
+ puppetHostsIndexColumns.forEach(column => {
27
+ column.tableName = 'hosts';
28
+ column.categoryName = 'Puppet';
29
+ column.categoryKey = 'puppet';
30
+ });
31
+
32
+ registerColumns(puppetHostsIndexColumns);
@@ -154,7 +154,7 @@ export function addConfigGroup(item) {
154
154
  .addClass('selected-marker')
155
155
  .hide();
156
156
 
157
- const puppetclassIds = $.parseJSON($(item).attr('data-puppetclass-ids'));
157
+ const puppetclassIds = JSON.parse($(item).attr('data-puppetclass-ids'));
158
158
  const inheritedIds = _getInheritedIds();
159
159
 
160
160
  $.each(puppetclassIds, (index, puppetclassId) => {
@@ -182,7 +182,7 @@ export function removeConfigGroup(item) {
182
182
  .tooltip('hide');
183
183
  $(`#selected_config_group_${id}`).remove();
184
184
 
185
- const puppetclassIds = $.parseJSON($(item).attr('data-puppetclass-ids'));
185
+ const puppetclassIds = JSON.parse($(item).attr('data-puppetclass-ids'));
186
186
  const inheritedIds = _getInheritedIds();
187
187
 
188
188
  $.each(puppetclassIds, (index, puppetclassId) => {
@@ -110,7 +110,7 @@ export function checkForUnavailablePuppetclasses() {
110
110
  ${warningMessage}
111
111
  </span>`;
112
112
 
113
- if (unavailableClasses.size() > 0) {
113
+ if (unavailableClasses.length > 0) {
114
114
  if (puppetEncTab.find('#puppetclasses_unavailable_warning').length <= 0) {
115
115
  tab.prepend('<span class="pficon pficon-warning-triangle-o"></span> ');
116
116
  puppetEncTab.prepend(warning);
@@ -37,7 +37,7 @@ describe('checkForUnavailablePuppetclasses', () => {
37
37
  );
38
38
 
39
39
  checkForUnavailablePuppetclasses();
40
- expect($('#puppetclasses_unavailable_warning').size()).toBe(1);
40
+ expect($('#puppetclasses_unavailable_warning').length).toBe(1);
41
41
  });
42
42
 
43
43
  it('does not add a warning if no unavailable classes are found', () => {
@@ -48,8 +48,7 @@ describe('checkForUnavailablePuppetclasses', () => {
48
48
  expect(
49
49
  $('#hostgroup .help-block')
50
50
  .first()
51
- .children()
52
- .size()
51
+ .children().length
53
52
  ).toBe(0);
54
53
  });
55
54
 
@@ -59,7 +58,7 @@ describe('checkForUnavailablePuppetclasses', () => {
59
58
  );
60
59
  checkForUnavailablePuppetclasses();
61
60
  setTimeout(() => {
62
- expect($('a .pficon').size()).toBe(1);
61
+ expect($('a .pficon').length).toBe(1);
63
62
  }, 100);
64
63
  });
65
64
  });