foreman_discovery 26.1.2 → 26.2.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 (72) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/foreman_discovery/locale/ca/foreman_discovery.js +1 -1
  3. data/app/assets/javascripts/foreman_discovery/locale/cs_CZ/foreman_discovery.js +1 -1
  4. data/app/assets/javascripts/foreman_discovery/locale/de/foreman_discovery.js +1 -1
  5. data/app/assets/javascripts/foreman_discovery/locale/en/foreman_discovery.js +841 -0
  6. data/app/assets/javascripts/foreman_discovery/locale/en_GB/foreman_discovery.js +1 -1
  7. data/app/assets/javascripts/foreman_discovery/locale/es/foreman_discovery.js +1 -1
  8. data/app/assets/javascripts/foreman_discovery/locale/fr/foreman_discovery.js +3 -3
  9. data/app/assets/javascripts/foreman_discovery/locale/gl/foreman_discovery.js +1 -1
  10. data/app/assets/javascripts/foreman_discovery/locale/it/foreman_discovery.js +1 -1
  11. data/app/assets/javascripts/foreman_discovery/locale/ja/foreman_discovery.js +4 -4
  12. data/app/assets/javascripts/foreman_discovery/locale/ka/foreman_discovery.js +1 -1
  13. data/app/assets/javascripts/foreman_discovery/locale/ko/foreman_discovery.js +2 -2
  14. data/app/assets/javascripts/foreman_discovery/locale/pt_BR/foreman_discovery.js +1 -1
  15. data/app/assets/javascripts/foreman_discovery/locale/ru/foreman_discovery.js +1 -1
  16. data/app/assets/javascripts/foreman_discovery/locale/sv_SE/foreman_discovery.js +1 -1
  17. data/app/assets/javascripts/foreman_discovery/locale/zh_CN/foreman_discovery.js +2 -2
  18. data/app/assets/javascripts/foreman_discovery/locale/zh_TW/foreman_discovery.js +1 -1
  19. data/app/controllers/foreman_discovery/concerns/hosts_controller_extensions.rb +10 -0
  20. data/app/services/foreman_discovery/host_converter.rb +1 -1
  21. data/db/seeds.d/60_discovery_proxy_feature.rb +1 -1
  22. data/lib/foreman_discovery/version.rb +1 -1
  23. data/locale/ca/LC_MESSAGES/foreman_discovery.mo +0 -0
  24. data/locale/ca/foreman_discovery.po +1 -1
  25. data/locale/cs_CZ/LC_MESSAGES/foreman_discovery.mo +0 -0
  26. data/locale/cs_CZ/foreman_discovery.po +1 -1
  27. data/locale/de/LC_MESSAGES/foreman_discovery.mo +0 -0
  28. data/locale/de/foreman_discovery.po +2 -2
  29. data/locale/en/LC_MESSAGES/foreman_discovery.mo +0 -0
  30. data/locale/en/foreman_discovery.po +840 -0
  31. data/locale/en_GB/LC_MESSAGES/foreman_discovery.mo +0 -0
  32. data/locale/en_GB/foreman_discovery.po +1 -1
  33. data/locale/es/LC_MESSAGES/foreman_discovery.mo +0 -0
  34. data/locale/es/foreman_discovery.po +1 -1
  35. data/locale/foreman_discovery.pot +2 -2
  36. data/locale/fr/LC_MESSAGES/foreman_discovery.mo +0 -0
  37. data/locale/fr/foreman_discovery.po +3 -3
  38. data/locale/gl/LC_MESSAGES/foreman_discovery.mo +0 -0
  39. data/locale/gl/foreman_discovery.po +1 -1
  40. data/locale/it/LC_MESSAGES/foreman_discovery.mo +0 -0
  41. data/locale/it/foreman_discovery.po +1 -1
  42. data/locale/ja/LC_MESSAGES/foreman_discovery.mo +0 -0
  43. data/locale/ja/foreman_discovery.po +4 -4
  44. data/locale/ka/LC_MESSAGES/foreman_discovery.mo +0 -0
  45. data/locale/ka/foreman_discovery.po +1 -1
  46. data/locale/ko/LC_MESSAGES/foreman_discovery.mo +0 -0
  47. data/locale/ko/foreman_discovery.po +2 -2
  48. data/locale/pt_BR/LC_MESSAGES/foreman_discovery.mo +0 -0
  49. data/locale/pt_BR/foreman_discovery.po +1 -1
  50. data/locale/ru/LC_MESSAGES/foreman_discovery.mo +0 -0
  51. data/locale/ru/foreman_discovery.po +1 -1
  52. data/locale/sv_SE/LC_MESSAGES/foreman_discovery.mo +0 -0
  53. data/locale/sv_SE/foreman_discovery.po +1 -1
  54. data/locale/zh_CN/LC_MESSAGES/foreman_discovery.mo +0 -0
  55. data/locale/zh_CN/foreman_discovery.po +2 -2
  56. data/locale/zh_TW/LC_MESSAGES/foreman_discovery.mo +0 -0
  57. data/locale/zh_TW/foreman_discovery.po +1 -1
  58. data/package.json +4 -3
  59. data/test/functional/foreman_discovery/concerns/hosts_controller_extensions_test.rb +41 -0
  60. data/test/unit/discovered_extensions_test.rb +2 -2
  61. data/webpack/src/ForemanDiscovery/DiscoveredHosts/Components/EmptyState/__test__/EmptyState.test.js +31 -6
  62. data/webpack/src/ForemanDiscovery/DiscoveryRules/Components/__test__/EmptyState.test.js +32 -14
  63. metadata +5 -11
  64. data/webpack/__mocks__/foremanReact/common/I18n.js +0 -3
  65. data/webpack/__mocks__/foremanReact/common/helpers.js +0 -1
  66. data/webpack/__mocks__/foremanReact/common/index.js +0 -5
  67. data/webpack/__mocks__/foremanReact/components/common/EmptyState/DefaultEmptyState.js +0 -71
  68. data/webpack/__mocks__/foremanReact/components/common/EmptyState/EmptyStatePattern.js +0 -76
  69. data/webpack/__mocks__/foremanReact/components/common/EmptyState/EmptyStatePropTypes.js +0 -29
  70. data/webpack/__mocks__/foremanReact/components/common/EmptyState/index.js +0 -5
  71. data/webpack/src/ForemanDiscovery/DiscoveredHosts/Components/EmptyState/__test__/__snapshots__/EmptyState.test.js.snap +0 -16
  72. data/webpack/src/ForemanDiscovery/DiscoveryRules/Components/__test__/__snapshots__/EmptyState.test.js.snap +0 -22
@@ -10,7 +10,7 @@
10
10
  # Lukáš Zapletal, 2015
11
11
  msgid ""
12
12
  msgstr ""
13
- "Project-Id-Version: foreman_discovery 26.0.2\n"
13
+ "Project-Id-Version: foreman_discovery 26.1.2\n"
14
14
  "Report-Msgid-Bugs-To: \n"
15
15
  "PO-Revision-Date: 2013-11-15 17:25+0000\n"
16
16
  "Last-Translator: Andi Chandler <andi@gowling.com>, 2015-2019,2023\n"
@@ -11,7 +11,7 @@
11
11
  # Sergio Ocón-Cárdenas, 2014
12
12
  msgid ""
13
13
  msgstr ""
14
- "Project-Id-Version: foreman_discovery 26.0.2\n"
14
+ "Project-Id-Version: foreman_discovery 26.1.2\n"
15
15
  "Report-Msgid-Bugs-To: \n"
16
16
  "PO-Revision-Date: 2013-11-15 17:25+0000\n"
17
17
  "Last-Translator: Sergio Ocón-Cárdenas, 2014\n"
@@ -8,8 +8,8 @@ msgid ""
8
8
  msgstr ""
9
9
  "Project-Id-Version: foreman_discovery 1.0.0\n"
10
10
  "Report-Msgid-Bugs-To: \n"
11
- "POT-Creation-Date: 2025-10-07 14:18+0200\n"
12
- "PO-Revision-Date: 2025-10-07 14:18+0200\n"
11
+ "POT-Creation-Date: 2026-03-09 12:47+0000\n"
12
+ "PO-Revision-Date: 2026-03-09 12:47+0000\n"
13
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
15
15
  "Language: \n"
@@ -8,7 +8,7 @@
8
8
  # Pierre-Emmanuel Dutang <dutangp@gmail.com>, 2014,2016-2017
9
9
  msgid ""
10
10
  msgstr ""
11
- "Project-Id-Version: foreman_discovery 26.0.2\n"
11
+ "Project-Id-Version: foreman_discovery 26.1.2\n"
12
12
  "Report-Msgid-Bugs-To: \n"
13
13
  "PO-Revision-Date: 2013-11-15 17:25+0000\n"
14
14
  "Last-Translator: Baptiste Agasse <baptiste.agasse@gmail.com>, 2018-2019\n"
@@ -660,7 +660,7 @@ msgid "Select all items in this page"
660
660
  msgstr "Sélectionner tous les éléments de cette page"
661
661
 
662
662
  msgid "Select location"
663
- msgstr "Sélectionner une localisation"
663
+ msgstr "Sélectionner un emplacement"
664
664
 
665
665
  msgid "Select organization"
666
666
  msgstr "Choisir une organisation"
@@ -795,7 +795,7 @@ msgid "must start with a letter or ERB."
795
795
  msgstr "doit commencer par une lettre ou par ERB."
796
796
 
797
797
  msgid "must start with a letter. Allowed characters: `a-z`, `A-Z`, `0-9` and `-`. Max length is 62 characters."
798
- msgstr ""
798
+ msgstr "doit commencer par une lettre. Caractères utilisés: `a-z`, `A-Z`, `0-9` and `-`. La longueur maximale est de 62 caractères."
799
799
 
800
800
  msgid "not required if it's a virtual machine"
801
801
  msgstr "non requis s'il s'agit d'une machine virtuelle"
@@ -5,7 +5,7 @@
5
5
  # Translators:
6
6
  msgid ""
7
7
  msgstr ""
8
- "Project-Id-Version: foreman_discovery 26.0.2\n"
8
+ "Project-Id-Version: foreman_discovery 26.1.2\n"
9
9
  "Report-Msgid-Bugs-To: \n"
10
10
  "PO-Revision-Date: 2013-11-15 17:25+0000\n"
11
11
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
@@ -7,7 +7,7 @@
7
7
  # caifti <caifti@gmail.com>, 2014
8
8
  msgid ""
9
9
  msgstr ""
10
- "Project-Id-Version: foreman_discovery 26.0.2\n"
10
+ "Project-Id-Version: foreman_discovery 26.1.2\n"
11
11
  "Report-Msgid-Bugs-To: \n"
12
12
  "PO-Revision-Date: 2013-11-15 17:25+0000\n"
13
13
  "Last-Translator: caifti <caifti@gmail.com>, 2014\n"
@@ -8,7 +8,7 @@
8
8
  # 山田 修司 🍣 Shuji Yamada <uzy.exe@gmail.com>, 2015
9
9
  msgid ""
10
10
  msgstr ""
11
- "Project-Id-Version: foreman_discovery 26.0.2\n"
11
+ "Project-Id-Version: foreman_discovery 26.1.2\n"
12
12
  "Report-Msgid-Bugs-To: \n"
13
13
  "PO-Revision-Date: 2013-11-15 17:25+0000\n"
14
14
  "Last-Translator: 山田 修司 🍣 Shuji Yamada <uzy.exe@gmail.com>, 2015\n"
@@ -543,7 +543,7 @@ msgid "One or more hosts with failed discovery due to error: %s"
543
543
  msgstr "エラーが原因で 1 つ以上のホストの検出に失敗しました: %s"
544
544
 
545
545
  msgid "Option 'url' must be provided"
546
- msgstr "オプション 'url' を指定する必要があります。"
546
+ msgstr "オプション 'url' を指定する必要があります"
547
547
 
548
548
  msgid "Option 'url' must be valid URI: %s"
549
549
  msgstr "オプション 'url' は有効な URI でなければなりません: %s"
@@ -789,7 +789,7 @@ msgid "must start with a letter or ERB."
789
789
  msgstr "文字または ERB で開始する必要があります。"
790
790
 
791
791
  msgid "must start with a letter. Allowed characters: `a-z`, `A-Z`, `0-9` and `-`. Max length is 62 characters."
792
- msgstr ""
792
+ msgstr "文字で開始する必要があります。許可される文字: `a-z`、`A-Z`、`0-9`、および `-`。最大長は 62 文字です。"
793
793
 
794
794
  msgid "not required if it's a virtual machine"
795
795
  msgstr "仮想マシンの場合は不要です"
@@ -825,7 +825,7 @@ msgid "required if host is managed and value is not inherited from host group"
825
825
  msgstr "ホストが管理されており、値がホストグループから継承されていない場合に必須です"
826
826
 
827
827
  msgid "required if host is managed, does not have IPv4 IP / Subnet, or the value is not inherited from the host group"
828
- msgstr "ホストが管理対象の場合、IPv4 IP/サブネットがない場合、または値がホストグループから継承されていない場合は必須です。"
828
+ msgstr "ホストが管理対象の場合、IPv4 IP/サブネットがない場合、または値がホストグループから継承されていない場合は必須です"
829
829
 
830
830
  msgid "required if not imaged based provisioning and host is managed and value is not inherited from host group"
831
831
  msgstr "イメージベースのプロビジョニングでない場合で、ホストが管理されており、値がホストグループから継承されていない場合に必須です"
@@ -5,7 +5,7 @@
5
5
  # Translators:
6
6
  msgid ""
7
7
  msgstr ""
8
- "Project-Id-Version: foreman_discovery 26.0.2\n"
8
+ "Project-Id-Version: foreman_discovery 26.1.2\n"
9
9
  "Report-Msgid-Bugs-To: \n"
10
10
  "PO-Revision-Date: 2013-11-15 17:25+0000\n"
11
11
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
@@ -6,7 +6,7 @@
6
6
  # Ewoud Kohl van Wijngaarden <ewoud+transifex@kohlvanwijngaarden.nl>, 2022
7
7
  msgid ""
8
8
  msgstr ""
9
- "Project-Id-Version: foreman_discovery 26.0.2\n"
9
+ "Project-Id-Version: foreman_discovery 26.1.2\n"
10
10
  "Report-Msgid-Bugs-To: \n"
11
11
  "PO-Revision-Date: 2013-11-15 17:25+0000\n"
12
12
  "Last-Translator: Ewoud Kohl van Wijngaarden <ewoud+transifex@kohlvanwijngaarde"
@@ -787,7 +787,7 @@ msgid "must start with a letter or ERB."
787
787
  msgstr "문자 또는 ERB로 시작해야 합니다."
788
788
 
789
789
  msgid "must start with a letter. Allowed characters: `a-z`, `A-Z`, `0-9` and `-`. Max length is 62 characters."
790
- msgstr ""
790
+ msgstr "반드시 영문자로 시작해야 합니다. 허용되는 문자는 `az`, `AZ`, `0-9`, `-`입니다. 최대 길이는 62자입니다."
791
791
 
792
792
  msgid "not required if it's a virtual machine"
793
793
  msgstr "가상 머신의 경우 필요하지 않습니다"
@@ -13,7 +13,7 @@
13
13
  # Valeria S Silva <valeriassilva@live.com>, 2015
14
14
  msgid ""
15
15
  msgstr ""
16
- "Project-Id-Version: foreman_discovery 26.0.2\n"
16
+ "Project-Id-Version: foreman_discovery 26.1.2\n"
17
17
  "Report-Msgid-Bugs-To: \n"
18
18
  "PO-Revision-Date: 2013-11-15 17:25+0000\n"
19
19
  "Last-Translator: Valeria S Silva <valeriassilva@live.com>, 2015\n"
@@ -10,7 +10,7 @@
10
10
  # Yulia <yulia.poyarkova@redhat.com>, 2016
11
11
  msgid ""
12
12
  msgstr ""
13
- "Project-Id-Version: foreman_discovery 26.0.2\n"
13
+ "Project-Id-Version: foreman_discovery 26.1.2\n"
14
14
  "Report-Msgid-Bugs-To: \n"
15
15
  "PO-Revision-Date: 2013-11-15 17:25+0000\n"
16
16
  "Last-Translator: Yulia <yulia.poyarkova@redhat.com>, 2016\n"
@@ -8,7 +8,7 @@
8
8
  # johnny.westerlund <johnny.westerlund@gmail.com>, 2014
9
9
  msgid ""
10
10
  msgstr ""
11
- "Project-Id-Version: foreman_discovery 26.0.2\n"
11
+ "Project-Id-Version: foreman_discovery 26.1.2\n"
12
12
  "Report-Msgid-Bugs-To: \n"
13
13
  "PO-Revision-Date: 2013-11-15 17:25+0000\n"
14
14
  "Last-Translator: johnny.westerlund <johnny.westerlund@gmail.com>, 2014\n"
@@ -6,7 +6,7 @@
6
6
  # Ewoud Kohl van Wijngaarden <ewoud+transifex@kohlvanwijngaarden.nl>, 2024
7
7
  msgid ""
8
8
  msgstr ""
9
- "Project-Id-Version: foreman_discovery 26.0.2\n"
9
+ "Project-Id-Version: foreman_discovery 26.1.2\n"
10
10
  "Report-Msgid-Bugs-To: \n"
11
11
  "PO-Revision-Date: 2013-11-15 17:25+0000\n"
12
12
  "Last-Translator: Ewoud Kohl van Wijngaarden <ewoud+transifex@kohlvanwijngaarde"
@@ -788,7 +788,7 @@ msgid "must start with a letter or ERB."
788
788
  msgstr "必须以字母或 ERB 开始。"
789
789
 
790
790
  msgid "must start with a letter. Allowed characters: `a-z`, `A-Z`, `0-9` and `-`. Max length is 62 characters."
791
- msgstr ""
791
+ msgstr "必须以一个字母开始。允许的字符:'a-z'、'A-Z'、'0-9' 和 '-'。最大长度为 62 个字符。"
792
792
 
793
793
  msgid "not required if it's a virtual machine"
794
794
  msgstr "如果是虚拟机,则不需要"
@@ -5,7 +5,7 @@
5
5
  # Translators:
6
6
  msgid ""
7
7
  msgstr ""
8
- "Project-Id-Version: foreman_discovery 26.0.2\n"
8
+ "Project-Id-Version: foreman_discovery 26.1.2\n"
9
9
  "Report-Msgid-Bugs-To: \n"
10
10
  "PO-Revision-Date: 2013-11-15 17:25+0000\n"
11
11
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
data/package.json CHANGED
@@ -5,9 +5,9 @@
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "lint": "tfm-lint --plugin -d /webpack",
8
- "test": "tfm-test --plugin",
9
- "test:watch": "tfm-test --plugin --watchAll",
10
- "test:current": "tfm-test --plugin --watch",
8
+ "test": "tfm-test --plugin --config jest.config.js",
9
+ "test:watch": "tfm-test --plugin --config jest.config.js --watchAll",
10
+ "test:current": "tfm-test --plugin --config jest.config.js --watch",
11
11
  "publish-coverage": "tfm-publish-coverage",
12
12
  "create-react-component": "yo react-domain"
13
13
  },
@@ -25,6 +25,7 @@
25
25
  "@babel/core": "^7.7.0",
26
26
  "@theforeman/builder": ">= 0",
27
27
  "@theforeman/eslint-plugin-foreman": ">= 0",
28
+ "@theforeman/find-foreman": ">= 0",
28
29
  "@theforeman/test": ">= 0",
29
30
  "eslint": "^6.7.2",
30
31
  "prettier": "^1.19.1",
@@ -50,6 +50,47 @@ module ForemanDiscovery
50
50
  assert_instance_of Host::Managed, assigns(:host)
51
51
  end
52
52
  end
53
+
54
+ describe 'find_resource' do
55
+ include FactImporterIsolation
56
+ allow_transactions_for_any_importer
57
+
58
+ setup do
59
+ @facts = {
60
+ "interfaces" => "lo,eth0",
61
+ "ipaddress" => "192.168.100.42",
62
+ "ipaddress_eth0" => "192.168.100.42",
63
+ "macaddress_eth0" => "AA:BB:CC:DD:EE:FF",
64
+ "discovery_bootif" => "AA:BB:CC:DD:EE:FF",
65
+ "physicalprocessorcount" => "42",
66
+ "discovery_version" => "3.0.0",
67
+ }
68
+ end
69
+
70
+ test 'finds a discovered host directly without converting it' do
71
+ host = discover_host_from_facts(@facts)
72
+ get :build_errors, params: { id: host.id }, session: set_session_user
73
+
74
+ assert_response :success
75
+ assert_instance_of Host::Discovered, assigns(:host)
76
+ assert_equal host, assigns(:host)
77
+ end
78
+
79
+ test 'falls back to the core lookup for a managed host' do
80
+ host = FactoryBot.create(:host, :managed)
81
+ get :build_errors, params: { id: host.id }, session: set_session_user
82
+
83
+ assert_response :success
84
+ assert_instance_of Host::Managed, assigns(:host)
85
+ assert_equal host, assigns(:host)
86
+ end
87
+
88
+ test 'renders not found for an unknown host id' do
89
+ get :build_errors, params: { id: 0 }, session: set_session_user
90
+
91
+ assert_response :not_found
92
+ end
93
+ end
53
94
  end
54
95
  end
55
96
  end
@@ -238,8 +238,8 @@ class DiscoveredExtensionsTest < ActiveSupport::TestCase
238
238
  ::ForemanDiscovery::HostConverter.unstub(:unused_ip_for_host)
239
239
  facts = @facts_ipv6.merge({"somefact" => "abc"})
240
240
  domain = FactoryBot.create(:domain)
241
- subnet = FactoryBot.create(:subnet_ipv6, :tftp, :dhcp, :network => "2001:db8::/32", :mask => "ffff:ffff::", :name => "ipv6_discovered", :ipam => IPAM::MODES[:eui64], :organizations => [Organization.find_by_name("Organization 1")], :locations => [Location.find_by_name("Location 1")])
242
- subnet2 = FactoryBot.create(:subnet_ipv6, :tftp, :dhcp, :network => "2001:db9::/32", :mask => "ffff:ffff::", :name => "ipv6_provision", :ipam => IPAM::MODES[:eui64], :organizations => [Organization.find_by_name("Organization 1")], :locations => [Location.find_by_name("Location 1")])
241
+ subnet = FactoryBot.create(:subnet_ipv6, :tftp, :dhcp, :network => "2001:db8::", :mask => "ffff:ffff::", :name => "ipv6_discovered", :ipam => IPAM::MODES[:eui64], :organizations => [Organization.find_by_name("Organization 1")], :locations => [Location.find_by_name("Location 1")])
242
+ subnet2 = FactoryBot.create(:subnet_ipv6, :tftp, :dhcp, :network => "2001:db9::", :mask => "ffff:ffff::", :name => "ipv6_provision", :ipam => IPAM::MODES[:eui64], :organizations => [Organization.find_by_name("Organization 1")], :locations => [Location.find_by_name("Location 1")])
243
243
  host = discover_host_from_facts(facts)
244
244
  assert_equal subnet, host.subnet6
245
245
  hostgroup = FactoryBot.create(:hostgroup, :with_rootpass, :with_os, :pxe_loader => "PXELinux BIOS", :subnet6 => subnet2, :domain => domain)
@@ -1,12 +1,37 @@
1
- import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
1
+ import React from 'react';
2
+ import { screen } from '@testing-library/react';
3
+ import { rtlHelpers } from 'foremanReact/common/testHelpers';
2
4
 
3
5
  import ForemanEmptyState from '../EmptyState';
4
6
 
5
- const fixtures = {
6
- 'render with Props': { docUrl: 'https://foreman.example.com' },
7
- };
7
+ const docUrl = 'https://foreman.example.com';
8
8
 
9
9
  describe('ForemanEmptyState', () => {
10
- describe('rendering', () =>
11
- testComponentSnapshotsWithFixtures(ForemanEmptyState, fixtures));
10
+ it('renders discovered hosts empty state content', () => {
11
+ rtlHelpers.renderWithStore(<ForemanEmptyState docUrl={docUrl} />);
12
+
13
+ expect(
14
+ screen.getByRole('heading', { name: 'Foreman Discovery', level: 5 })
15
+ ).toBeInTheDocument();
16
+ expect(
17
+ screen.getByText(
18
+ 'No discovered hosts found in this context. This page shows discovered bare-metal or virtual nodes waiting to be provisioned.'
19
+ )
20
+ ).toBeInTheDocument();
21
+ expect(
22
+ screen.getByText('For more information please see')
23
+ ).toBeInTheDocument();
24
+
25
+ const docLink = screen.getByRole('link', { name: 'documentation' });
26
+ expect(docLink).toHaveAttribute('href', docUrl);
27
+ expect(docLink).toHaveAttribute('target', '_blank');
28
+ expect(docLink).toHaveAttribute('rel', 'external noreferrer noopener');
29
+
30
+ expect(screen.queryByText('Create Rule')).not.toBeInTheDocument();
31
+ expect(
32
+ document.querySelector(
33
+ '[data-ouia-component-id="empty-state-action-button"]'
34
+ )
35
+ ).not.toBeInTheDocument();
36
+ });
12
37
  });
@@ -1,19 +1,37 @@
1
- import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
2
- import ForemanEmptyState from '../EmptyState';
1
+ import React from 'react';
2
+ import { screen } from '@testing-library/react';
3
+ import { rtlHelpers } from 'foremanReact/common/testHelpers';
3
4
 
4
- const action = {
5
- title: 'action-title',
6
- url: `action-url`,
7
- };
5
+ import ForemanEmptyState from '../EmptyState';
8
6
 
9
- const fixtures = {
10
- 'render with Props': {
11
- docUrl: 'https://foreman.example.com',
12
- action,
13
- },
14
- };
7
+ const docUrl = 'https://foreman.example.com';
15
8
 
16
9
  describe('ForemanEmptyState', () => {
17
- describe('rendering', () =>
18
- testComponentSnapshotsWithFixtures(ForemanEmptyState, fixtures));
10
+ it('renders discovery rules empty state content', () => {
11
+ rtlHelpers.renderWithStore(<ForemanEmptyState docUrl={docUrl} />);
12
+
13
+ expect(
14
+ screen.getByRole('heading', { name: 'Discovery Rules', level: 5 })
15
+ ).toBeInTheDocument();
16
+ expect(
17
+ screen.getByText(
18
+ 'No Discovery Rules found in this context. Create Discovery Rules to perform automated provisioning on Discovered Hosts'
19
+ )
20
+ ).toBeInTheDocument();
21
+ expect(
22
+ screen.getByText('For more information please see')
23
+ ).toBeInTheDocument();
24
+
25
+ const docLink = screen.getByRole('link', { name: 'documentation' });
26
+ expect(docLink).toHaveAttribute('href', docUrl);
27
+ expect(docLink).toHaveAttribute('target', '_blank');
28
+ expect(docLink).toHaveAttribute('rel', 'external noreferrer noopener');
29
+
30
+ const actionButton = screen.getByText('Create Rule');
31
+ expect(actionButton).toBeInTheDocument();
32
+ expect(actionButton).toHaveAttribute(
33
+ 'data-ouia-component-id',
34
+ 'empty-state-action-button'
35
+ );
36
+ });
19
37
  });
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_discovery
3
3
  version: !ruby/object:Gem::Version
4
- version: 26.1.2
4
+ version: 26.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aditi Puntambekar
@@ -90,6 +90,7 @@ files:
90
90
  - app/assets/javascripts/foreman_discovery/locale/ca/foreman_discovery.js
91
91
  - app/assets/javascripts/foreman_discovery/locale/cs_CZ/foreman_discovery.js
92
92
  - app/assets/javascripts/foreman_discovery/locale/de/foreman_discovery.js
93
+ - app/assets/javascripts/foreman_discovery/locale/en/foreman_discovery.js
93
94
  - app/assets/javascripts/foreman_discovery/locale/en_GB/foreman_discovery.js
94
95
  - app/assets/javascripts/foreman_discovery/locale/es/foreman_discovery.js
95
96
  - app/assets/javascripts/foreman_discovery/locale/fr/foreman_discovery.js
@@ -222,6 +223,8 @@ files:
222
223
  - locale/cs_CZ/foreman_discovery.po
223
224
  - locale/de/LC_MESSAGES/foreman_discovery.mo
224
225
  - locale/de/foreman_discovery.po
226
+ - locale/en/LC_MESSAGES/foreman_discovery.mo
227
+ - locale/en/foreman_discovery.po
225
228
  - locale/en_GB/LC_MESSAGES/foreman_discovery.mo
226
229
  - locale/en_GB/foreman_discovery.po
227
230
  - locale/es/LC_MESSAGES/foreman_discovery.mo
@@ -292,23 +295,14 @@ files:
292
295
  - test/unit/managed_extensions_test.rb
293
296
  - test/unit/ui_notifications/destroy_host_test.rb
294
297
  - test/unit/ui_notifications/new_host_test.rb
295
- - webpack/__mocks__/foremanReact/common/I18n.js
296
- - webpack/__mocks__/foremanReact/common/helpers.js
297
- - webpack/__mocks__/foremanReact/common/index.js
298
- - webpack/__mocks__/foremanReact/components/common/EmptyState/DefaultEmptyState.js
299
- - webpack/__mocks__/foremanReact/components/common/EmptyState/EmptyStatePattern.js
300
- - webpack/__mocks__/foremanReact/components/common/EmptyState/EmptyStatePropTypes.js
301
- - webpack/__mocks__/foremanReact/components/common/EmptyState/index.js
302
298
  - webpack/index.js
303
299
  - webpack/src/ForemanDiscovery/DiscoveredHosts/Components/EmptyState/EmptyState.js
304
300
  - webpack/src/ForemanDiscovery/DiscoveredHosts/Components/EmptyState/__test__/EmptyState.test.js
305
- - webpack/src/ForemanDiscovery/DiscoveredHosts/Components/EmptyState/__test__/__snapshots__/EmptyState.test.js.snap
306
301
  - webpack/src/ForemanDiscovery/DiscoveredHosts/Components/EmptyState/index.js
307
302
  - webpack/src/ForemanDiscovery/DiscoveredHosts/index.js
308
303
  - webpack/src/ForemanDiscovery/DiscoveryRules/Components/EmptyState/EmptyState.js
309
304
  - webpack/src/ForemanDiscovery/DiscoveryRules/Components/EmptyState/index.js
310
305
  - webpack/src/ForemanDiscovery/DiscoveryRules/Components/__test__/EmptyState.test.js
311
- - webpack/src/ForemanDiscovery/DiscoveryRules/Components/__test__/__snapshots__/EmptyState.test.js.snap
312
306
  - webpack/src/ForemanDiscovery/DiscoveryRules/index.js
313
307
  - webpack/src/reducers.js
314
308
  homepage: https://github.com/theforeman/foreman_discovery
@@ -329,7 +323,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
329
323
  - !ruby/object:Gem::Version
330
324
  version: '0'
331
325
  requirements: []
332
- rubygems_version: 4.0.3
326
+ rubygems_version: 4.0.20
333
327
  specification_version: 4
334
328
  summary: MaaS Discovery Plugin for Foreman
335
329
  test_files:
@@ -1,3 +0,0 @@
1
- export const translate = s => s;
2
-
3
- export const ngettext = s => s;
@@ -1 +0,0 @@
1
- export const foremanUrl = path => `${window.URL_PREFIX}${path}`;
@@ -1,5 +0,0 @@
1
- import EmptyStatePattern from '../components/common/EmptyState/EmptyStatePattern';
2
- import DefaultEmptyState from '../components/common/EmptyState/DefaultEmptyState';
3
-
4
- export default DefaultEmptyState;
5
- export { EmptyStatePattern };
@@ -1,71 +0,0 @@
1
- import React from 'react';
2
- import { useDispatch } from 'react-redux';
3
- import { push } from 'connected-react-router';
4
- import { Button } from '@patternfly/react-core';
5
- import EmptyStatePattern from './EmptyStatePattern';
6
- import { defaultEmptyStatePropTypes } from './EmptyStatePropTypes';
7
-
8
- const DefaultEmptyState = props => {
9
- const {
10
- icon,
11
- iconType,
12
- header,
13
- description,
14
- documentation,
15
- action,
16
- secondaryActions,
17
- } = props;
18
-
19
- const dispatch = useDispatch();
20
- const actionButtonClickHandler = ({ url, onClick }) => {
21
- if (onClick) onClick();
22
- else if (url) dispatch(push(url));
23
- };
24
-
25
- const ActionButton = action ? (
26
- <Button
27
- component="a"
28
- onClick={() => actionButtonClickHandler(action)}
29
- variant="primary"
30
- ouiaId="empty-state-primary-action-button"
31
- >
32
- {action.title}
33
- </Button>
34
- ) : null;
35
-
36
- const SecondaryButton = secondaryActions
37
- ? secondaryActions.map(({ title, url, onClick }) => (
38
- <Button
39
- component="a"
40
- key={`sec-button-${title}`}
41
- onClick={() => actionButtonClickHandler({ url, onClick })}
42
- variant="secondary"
43
- ouiaId="empty-state-secondary-action-button"
44
- >
45
- {title}
46
- </Button>
47
- ))
48
- : null;
49
-
50
- return (
51
- <EmptyStatePattern
52
- icon={icon}
53
- iconType={iconType}
54
- header={header}
55
- description={description}
56
- documentation={documentation}
57
- action={ActionButton}
58
- secondaryActions={SecondaryButton}
59
- />
60
- );
61
- };
62
-
63
- DefaultEmptyState.propTypes = defaultEmptyStatePropTypes;
64
-
65
- DefaultEmptyState.defaultProps = {
66
- icon: 'add-circle-o',
67
- secondaryActions: [],
68
- iconType: 'pf',
69
- };
70
-
71
- export default DefaultEmptyState;
@@ -1,76 +0,0 @@
1
- import React from 'react';
2
- import { Icon } from 'patternfly-react';
3
- import {
4
- EmptyState,
5
- EmptyStateVariant,
6
- EmptyStateBody,
7
- EmptyStateActions,
8
- EmptyStateHeader,
9
- EmptyStateFooter,
10
- } from '@patternfly/react-core';
11
- import { emptyStatePatternPropTypes } from './EmptyStatePropTypes';
12
- import { translate as __ } from '../../../common/I18n';
13
-
14
- const EmptyStatePattern = props => {
15
- const {
16
- documentation,
17
- action,
18
- secondaryActions,
19
- iconType,
20
- icon,
21
- header,
22
- description,
23
- } = props;
24
-
25
- const DocumentationBlock = () => {
26
- if (!documentation) {
27
- return null;
28
- }
29
- // The documentation prop can also be a customized node
30
- if (React.isValidElement(documentation)) {
31
- return documentation;
32
- }
33
- const {
34
- label = __('For more information please see '), // eslint-disable-line react/prop-types
35
- buttonLabel = __('documentation'), // eslint-disable-line react/prop-types
36
- url, // eslint-disable-line react/prop-types
37
- } = documentation;
38
- return (
39
- <span>
40
- {label}
41
- <a href={url}>{buttonLabel}</a>
42
- </span>
43
- );
44
- };
45
-
46
- return (
47
- <EmptyState variant={EmptyStateVariant.xl}>
48
- <span className="empty-state-icon">
49
- {/* TODO: Add pf4 icons, Redmine issue: #30865 */}
50
- <Icon name={icon} type={iconType} size="2x" />
51
- </span>
52
- <EmptyStateHeader titleText={<>{header}</>} headingLevel="h5" />
53
- <EmptyStateBody>
54
- <div className="empty-state-description">{description}</div>
55
- <DocumentationBlock />
56
- </EmptyStateBody>
57
- <EmptyStateFooter>
58
- {action}
59
- <EmptyStateActions>{secondaryActions}</EmptyStateActions>
60
- </EmptyStateFooter>
61
- </EmptyState>
62
- );
63
- };
64
-
65
- EmptyStatePattern.propTypes = emptyStatePatternPropTypes;
66
-
67
- EmptyStatePattern.defaultProps = {
68
- icon: 'add-circle-o',
69
- secondaryActions: [],
70
- documentation: {
71
- url: '#',
72
- },
73
- iconType: 'pf',
74
- };
75
-
76
- export default EmptyStatePattern;