foreman_rh_cloud 3.0.14 → 3.0.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +13 -0
  3. data/app/controllers/foreman_inventory_upload/uploads_controller.rb +11 -0
  4. data/app/controllers/insights_cloud/hits_controller.rb +24 -0
  5. data/app/controllers/insights_cloud/settings_controller.rb +8 -0
  6. data/app/models/insights_hit.rb +5 -1
  7. data/app/models/setting/rh_cloud.rb +8 -6
  8. data/app/overrides/layouts/base/styles.html.erb.deface +2 -0
  9. data/app/services/foreman_rh_cloud/cloud_connector.rb +59 -0
  10. data/app/views/layouts/foreman_rh_cloud/application.html.erb +0 -4
  11. data/config/Gemfile.lock.gh_test +830 -0
  12. data/config/database.yml.example +17 -0
  13. data/config/package-lock.json.gh_test +35653 -0
  14. data/config/routes.rb +12 -3
  15. data/lib/foreman_inventory_upload.rb +1 -1
  16. data/lib/foreman_inventory_upload/generators/archived_report.rb +1 -1
  17. data/lib/foreman_rh_cloud/engine.rb +15 -5
  18. data/lib/foreman_rh_cloud/version.rb +1 -1
  19. data/lib/tasks/rh_cloud_inventory.rake +23 -0
  20. data/package.json +18 -17
  21. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.js +3 -2
  22. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListActions.js +1 -1
  23. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/ListItem.js +33 -15
  24. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/__tests__/__snapshots__/ListItem.test.js.snap +43 -43
  25. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatus.js +6 -7
  26. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js +5 -4
  27. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/__tests__/__snapshots__/ListItemStatus.test.js.snap +19 -34
  28. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListActions.test.js +2 -2
  29. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountList.test.js.snap +3 -3
  30. data/webpack/ForemanInventoryUpload/Components/AccountList/accountList.scss +28 -5
  31. data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/AutoUploadSwitcher.js +6 -9
  32. data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/AutoUploadSwitcherActions.js +1 -1
  33. data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/__tests__/AutoUploadSwitcherActions.test.js +2 -2
  34. data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/__tests__/__snapshots__/AutoUploadSwitcher.test.js.snap +5 -28
  35. data/webpack/ForemanInventoryUpload/Components/Dashboard/DashboardActions.js +1 -1
  36. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js +2 -2
  37. data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/ExcludePackagesSwitcher.js +6 -9
  38. data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/ExcludePackagesSwitcherActions.js +1 -1
  39. data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/ExcludePackagesSwitcherActions.test.js +2 -2
  40. data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/__snapshots__/ExcludePackagesSwitcher.test.js.snap +5 -28
  41. data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/__snapshots__/integration.test.js.snap +5 -0
  42. data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/integration.test.js +2 -2
  43. data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/HostObfuscationSwitcher.js +6 -9
  44. data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/HostObfuscationSwitcherActions.js +1 -1
  45. data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/__tests__/HostObfuscationSwitcherActions.test.js +2 -2
  46. data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/__tests__/__snapshots__/HostObfuscationSwitcher.test.js.snap +5 -28
  47. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilterReducer.js +6 -3
  48. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/__snapshots__/integration.test.js.snap +5 -0
  49. data/webpack/ForemanInventoryUpload/Components/InventorySettings/InventorySettings.js +2 -2
  50. data/webpack/ForemanInventoryUpload/Components/InventorySettings/{inventorySettings.scss → InventorySettings.scss} +2 -5
  51. data/webpack/ForemanInventoryUpload/Components/InventorySettings/__tests__/__snapshots__/InventorySettings.test.js.snap +1 -1
  52. data/webpack/ForemanInventoryUpload/Components/IpsObfuscationSwitcher/IpsObfuscationSwitcher.js +6 -8
  53. data/webpack/ForemanInventoryUpload/Components/IpsObfuscationSwitcher/IpsObfuscationSwitcherActions.js +1 -1
  54. data/webpack/ForemanInventoryUpload/Components/IpsObfuscationSwitcher/__tests__/IpsObfuscationSwitcherActions.test.js +2 -2
  55. data/webpack/ForemanInventoryUpload/Components/IpsObfuscationSwitcher/__tests__/__snapshots__/IpsObfuscationSwitcher.test.js.snap +5 -28
  56. data/webpack/ForemanInventoryUpload/Components/PageHeader/PageHeader.js +10 -18
  57. data/webpack/ForemanInventoryUpload/Components/PageHeader/PageHeader.scss +19 -0
  58. data/webpack/ForemanInventoryUpload/Components/PageHeader/PageTitle.js +53 -0
  59. data/webpack/ForemanInventoryUpload/Components/PageHeader/{components/DocsButton/__tests__/DocsButton.test.js → __tests__/PageTitle.test.js} +3 -3
  60. data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/__snapshots__/PageHeader.test.js.snap +12 -38
  61. data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/__snapshots__/PageTitle.test.js.snap +43 -0
  62. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/CloudConnectorActions.js +27 -0
  63. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/CloudConnectorButton.js +51 -0
  64. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/CloudConnectorConstants.js +6 -0
  65. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/CloudConnectorSelectors.js +14 -0
  66. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/__tests__/CloudConnectorActions.test.js +9 -0
  67. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/__tests__/CloudConnectorButton.test.js +22 -0
  68. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/__tests__/__snapshots__/CloudConnectorActions.test.js.snap +11 -0
  69. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/__tests__/__snapshots__/CloudConnectorButton.test.js.snap +48 -0
  70. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/index.js +27 -0
  71. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButton.js +7 -9
  72. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonActions.js +1 -1
  73. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/SyncButtonActions.test.js +2 -2
  74. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/SyncButton.test.js.snap +7 -9
  75. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/ToolbarButtons/ToolbarButtons.js +2 -4
  76. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/ToolbarButtons/__tests__/__snapshots__/ToolbarButtons.test.js.snap +1 -2
  77. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/ToolbarButtons/toolbarButtons.scss +1 -2
  78. data/webpack/ForemanInventoryUpload/Components/Terminal/terminal.scss +1 -0
  79. data/webpack/ForemanInventoryUpload/ForemanInventoryConstants.js +2 -2
  80. data/webpack/ForemanInventoryUpload/ForemanInventoryUpload.js +8 -14
  81. data/webpack/ForemanInventoryUpload/__tests__/__snapshots__/ForemanInventoryUpload.test.js.snap +7 -10
  82. data/webpack/ForemanRhCloudPages.js +19 -0
  83. data/webpack/InsightsCloudSync/Components/InsightsHeader/InsightsHeader.scss +4 -0
  84. data/webpack/InsightsCloudSync/Components/InsightsHeader/index.js +16 -0
  85. data/webpack/InsightsCloudSync/Components/InsightsSettings/InsightsSettingsActions.js +1 -1
  86. data/webpack/InsightsCloudSync/Components/InsightsSettings/__tests__/InsightsSettingsActions.test.js +2 -2
  87. data/webpack/InsightsCloudSync/Components/InsightsSettings/insightsSettings.scss +1 -0
  88. data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTable.js +121 -0
  89. data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableActions.js +129 -0
  90. data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableConstants.js +55 -0
  91. data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableHelpers.js +31 -0
  92. data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableReducer.js +28 -0
  93. data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableSelectors.js +74 -0
  94. data/webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js +65 -0
  95. data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/InsightsTable.test.js +13 -0
  96. data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/InsightsTableSelectors.test.js +58 -0
  97. data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/__snapshots__/InsightsTable.test.js.snap +168 -0
  98. data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/__snapshots__/InsightsTableSelectors.test.js.snap +88 -0
  99. data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/fixtures.js +104 -0
  100. data/webpack/InsightsCloudSync/Components/InsightsTable/components/EmptyState.js +53 -0
  101. data/webpack/InsightsCloudSync/Components/InsightsTable/index.js +45 -0
  102. data/webpack/InsightsCloudSync/Components/InsightsTable/table.scss +1 -0
  103. data/webpack/InsightsCloudSync/Components/NoTokenEmptyState.js +79 -0
  104. data/webpack/InsightsCloudSync/Components/__tests__/InsightsHeader.test.js +10 -0
  105. data/webpack/InsightsCloudSync/Components/__tests__/NoTokenEmptyState.test.js +19 -0
  106. data/webpack/InsightsCloudSync/Components/__tests__/__snapshots__/InsightsHeader.test.js.snap +13 -0
  107. data/webpack/InsightsCloudSync/Components/__tests__/__snapshots__/NoTokenEmptyState.test.js.snap +214 -0
  108. data/webpack/InsightsCloudSync/InsightsCloudSync.js +45 -44
  109. data/webpack/InsightsCloudSync/InsightsCloudSync.test.js +10 -2
  110. data/webpack/InsightsCloudSync/InsightsCloudSyncActions.js +1 -1
  111. data/webpack/InsightsCloudSync/InsightsCloudSyncConstants.js +15 -1
  112. data/webpack/InsightsCloudSync/InsightsCloudSyncHelpers.js +7 -0
  113. data/webpack/InsightsCloudSync/InsightsCloudSyncReducers.js +2 -0
  114. data/webpack/InsightsCloudSync/__snapshots__/InsightsCloudSync.test.js.snap +45 -62
  115. data/webpack/InsightsCloudSync/index.js +11 -3
  116. data/webpack/InsightsHostDetailsTab/InsightsTabActions.js +1 -1
  117. data/webpack/InsightsHostDetailsTab/__tests__/InsightsTabActions.test.js +2 -2
  118. data/webpack/__mocks__/foremanReact/Root/Context/ForemanContext.js +1 -0
  119. data/webpack/__mocks__/foremanReact/constants.js +19 -0
  120. data/webpack/__mocks__/foremanReact/redux/API/APISelectors.js +24 -0
  121. data/webpack/__mocks__/foremanReact/redux/API/index.js +11 -0
  122. data/webpack/__mocks__/foremanReact/routes/RouterSelector.js +2 -0
  123. data/webpack/__mocks__/foremanReact/routes/common/PageLayout/PageLayout.js +10 -0
  124. data/webpack/common/Switcher/HelpLabel.js +30 -0
  125. data/webpack/common/Switcher/SwitcherPF4.js +36 -0
  126. data/webpack/common/Switcher/SwitcherPF4.scss +10 -0
  127. data/webpack/common/Switcher/__tests__/HelpLabel.test.js +13 -0
  128. data/webpack/common/Switcher/__tests__/SwitcherPF4.test.js +14 -0
  129. data/webpack/common/Switcher/__tests__/__snapshots__/HelpLabel.test.js.snap +20 -0
  130. data/webpack/common/Switcher/__tests__/__snapshots__/SwitcherPF4.test.js.snap +22 -0
  131. data/webpack/global_index.js +2 -0
  132. metadata +96 -34
  133. data/app/controllers/foreman_rh_cloud/react_controller.rb +0 -11
  134. data/app/views/foreman_rh_cloud/react/insights_cloud.html.erb +0 -1
  135. data/app/views/foreman_rh_cloud/react/inventory_upload.html.erb +0 -1
  136. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/listItem.scss +0 -0
  137. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/listItemStatus.scss +0 -16
  138. data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/autoUploadSwitcher.scss +0 -3
  139. data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/excludePackagesSwitcher.scss +0 -3
  140. data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/HostObfuscationSwitcher.scss +0 -3
  141. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/DocsButton/DocsButton.js +0 -18
  142. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/DocsButton/__tests__/__snapshots__/DocsButton.test.js.snap +0 -21
  143. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/DocsButton/index.js +0 -1
  144. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/HistoryButton/HistoryButton.js +0 -19
  145. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/HistoryButton/__tests__/HistoryButton.test.js +0 -12
  146. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/HistoryButton/__tests__/__snapshots__/HistoryButton.test.js.snap +0 -22
  147. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/HistoryButton/index.js +0 -1
  148. data/webpack/ForemanInventoryUpload/Components/PageHeader/pageHeader.scss +0 -3
  149. data/webpack/__mocks__/foremanReact/API.js +0 -7
data/config/routes.rb CHANGED
@@ -11,17 +11,26 @@ Rails.application.routes.draw do
11
11
  post 'installed_packages_inclusion', to: 'uploads#installed_packages_inclusion'
12
12
  post 'ips_obfuscation', to: 'uploads#ips_obfuscation'
13
13
 
14
+ get 'cloud_connector', to: 'uploads#cloud_connector_status'
15
+ post 'cloud_connector', to: 'uploads#enable_cloud_connector'
16
+
14
17
  resources :tasks, only: [:create]
15
18
  end
16
19
 
17
20
  namespace :insights_cloud do
18
21
  resources :tasks, only: [:create]
19
22
  resource :settings, only: [:show, :update]
20
- get 'hits/:host_id', to: 'hits#index'
23
+ resources :hits, except: %i[show] do
24
+ collection do
25
+ get 'auto_complete_search'
26
+ end
27
+ end
28
+ match 'hits/:host_id', to: 'hits#show', via: :get
29
+ post 'save_token_and_sync', to: 'settings#save_token_and_sync'
21
30
  end
22
31
 
23
32
  namespace :foreman_rh_cloud do
24
- get 'inventory_upload', to: 'react#inventory_upload'
25
- get 'insights_cloud', to: 'react#insights_cloud'
33
+ get 'inventory_upload', to: '/react#index'
34
+ get 'insights_cloud', to: '/react#index' # Uses foreman's react controller
26
35
  end
27
36
  end
@@ -48,7 +48,7 @@ module ForemanInventoryUpload
48
48
  end
49
49
 
50
50
  def self.facts_archive_name(organization)
51
- "report_for_#{organization}.tar.gz"
51
+ "report_for_#{organization}.tar.xz"
52
52
  end
53
53
 
54
54
  def self.upload_url
@@ -28,7 +28,7 @@ module ForemanInventoryUpload
28
28
 
29
29
  @logger.info 'Archiving generated report'
30
30
  # success = system('tar', '-zcvf', @target, '-C', tmpdir, '.')
31
- Open3.popen2e('tar', '-zcvf', @target, '-C', tmpdir, '.') do |_in, out, wait_thr|
31
+ Open3.popen2e('tar', '-Jcvf', @target, '-C', tmpdir, '.') do |_in, out, wait_thr|
32
32
  @logger.info("tar: #{out.read}")
33
33
 
34
34
  if wait_thr.value.success?
@@ -1,5 +1,6 @@
1
1
  require 'katello'
2
2
  require 'redhat_access'
3
+ require 'foreman_ansible'
3
4
 
4
5
  module ForemanRhCloud
5
6
  class Engine < ::Rails::Engine
@@ -40,11 +41,21 @@ module ForemanRhCloud
40
41
  'foreman_inventory_upload/accounts': [:index],
41
42
  'foreman_inventory_upload/reports': [:last],
42
43
  'foreman_inventory_upload/uploads': [:auto_upload, :show_auto_upload, :download_file, :last],
43
- 'foreman_rh_cloud/react': [:inventory_upload]
44
+ 'react': [:index]
45
+ )
46
+ permission(
47
+ :view_insights_hits,
48
+ {
49
+ '/foreman_rh_cloud/insights_cloud': [:index], # for bookmarks and later for showing the page
50
+ 'insights_cloud/hits': [:index, :show, :auto_complete_search],
51
+ 'insights_cloud/settings': [:index, :show],
52
+ 'react': [:index],
53
+ },
54
+ :resource_type => ::InsightsHit.name
44
55
  )
45
56
  end
46
57
 
47
- plugin_permissions = [:view_foreman_rh_cloud, :generate_foreman_rh_cloud]
58
+ plugin_permissions = [:view_foreman_rh_cloud, :generate_foreman_rh_cloud, :view_insights_hits]
48
59
 
49
60
  role 'ForemanRhCloud', plugin_permissions, 'Role granting permissions to view the hosts inventory,
50
61
  generate a report, upload it to the cloud and download it locally'
@@ -55,8 +66,8 @@ module ForemanRhCloud
55
66
 
56
67
  # Adding a sub menu after hosts menu
57
68
  divider :top_menu, caption: N_('RH Cloud'), parent: :configure_menu
58
- menu :top_menu, :inventory_upload, caption: N_('Inventory Upload'), url_hash: { controller: :'foreman_rh_cloud/react', action: :inventory_upload }, parent: :configure_menu
59
- menu :top_menu, :insights_hits_import, caption: N_('Insights'), url_hash: { controller: :'foreman_rh_cloud/react', action: :insights_cloud }, parent: :configure_menu
69
+ menu :top_menu, :inventory_upload, caption: N_('Inventory Upload'), url: '/foreman_rh_cloud/inventory_upload', url_hash: { controller: :react, action: :index }, parent: :configure_menu
70
+ menu :top_menu, :insights_hits, caption: N_('Insights'), url: '/foreman_rh_cloud/insights_cloud', url_hash: { controller: :react, action: :index }, parent: :configure_menu
60
71
 
61
72
  register_facet InsightsFacet, :insights do
62
73
  configure_host do
@@ -80,7 +91,6 @@ module ForemanRhCloud
80
91
  ::Katello::UINotifications::Subscriptions::ManifestImportSuccess.include ForemanInventoryUpload::Notifications::ManifestImportSuccessNotificationOverride if defined?(Katello)
81
92
 
82
93
  ::Host::Managed.include RhCloudHost
83
- ::Host::Base.include RhCloudHost
84
94
  end
85
95
 
86
96
  initializer "foreman_rh_cloud.set_dynflow.config.on_init", :before => :finisher_hook do |_app|
@@ -1,3 +1,3 @@
1
1
  module ForemanRhCloud
2
- VERSION = '3.0.14'.freeze
2
+ VERSION = '3.0.15'.freeze
3
3
  end
@@ -2,6 +2,21 @@ require 'tempfile'
2
2
 
3
3
  namespace :rh_cloud_inventory do
4
4
  namespace :report do
5
+ desc 'Generate inventory report and send it to Red Hat cloud'
6
+ task generate_upload: [:environment, 'dynflow:client'] do
7
+ unless ENV['organization_id'].nil?
8
+ organizations = [ Organization.where(:id => ENV['organization_id']).first ]
9
+ else
10
+ organizations = Organization.unscoped.all
11
+ end
12
+
13
+ User.as_anonymous_admin do
14
+ organizations.each do |organization|
15
+ ForemanInventoryUpload::Async::GenerateReportJob.perform_now(ForemanInventoryUpload.generated_reports_folder, organization.id)
16
+ puts "Generated and uploaded inventory report for organization '#{organization.name}'"
17
+ end
18
+ end
19
+ end
5
20
  desc 'Generate inventory report to be sent to Red Hat cloud'
6
21
  task generate: :environment do
7
22
  portal_user = ENV['portal_user']
@@ -27,6 +42,14 @@ namespace :rh_cloud_inventory do
27
42
  end
28
43
  end
29
44
  end
45
+ desc 'Upload generated inventory report to Red Hat cloud'
46
+ task upload: [:environment, 'dynflow:client'] do
47
+ base_folder = ENV['target'] || ForemanInventoryUpload.generated_reports_folder
48
+ organization_id = ENV['organization_id']
49
+ report_file = ForemanInventoryUpload.facts_archive_name(organization_id)
50
+ ForemanInventoryUpload::Async::QueueForUploadJob.perform_now(base_folder, report_file, organization_id)
51
+ puts "Uploaded #{report_file}"
52
+ end
30
53
  end
31
54
 
32
55
  desc "Synchronize Insights hosts hits"
data/package.json CHANGED
@@ -22,26 +22,27 @@
22
22
  "url": "http://projects.theforeman.org/projects/foreman_rh_cloud/issues"
23
23
  },
24
24
  "peerDependencies": {
25
- "@theforeman/vendor": ">= 4.0.2"
25
+ "@theforeman/vendor": "~4.14.0"
26
26
  },
27
27
  "devDependencies": {
28
- "@babel/core": "^7.7.0",
29
- "@theforeman/builder": "^4.0.2",
30
- "@theforeman/stories": "^4.0.2",
31
- "@theforeman/test": "^4.0.2",
32
- "@theforeman/vendor-dev": "^4.0.2",
33
- "@theforeman/eslint-plugin-foreman": "^4.0.2",
34
- "babel-eslint": "^10.0.0",
35
- "eslint": "^6.7.2",
36
- "eslint-plugin-spellcheck": "^0.0.17",
37
- "prettier": "^1.13.5",
38
- "raf": "^3.4.0",
39
- "stylelint": "^9.3.0",
40
- "stylelint-config-standard": "^18.0.0",
41
- "surge": "^0.20.3"
28
+ "@babel/core": "~7.7.0",
29
+ "@redhat-cloud-services/frontend-components": "^2.5.0",
30
+ "@theforeman/builder": "~4.14.0",
31
+ "@theforeman/stories": "~4.14.0",
32
+ "@theforeman/test": "~4.14.0",
33
+ "@theforeman/vendor-dev": "~4.14.0",
34
+ "@theforeman/eslint-plugin-foreman": "~4.14.0",
35
+ "babel-eslint": "~10.0.0",
36
+ "eslint": "~6.7.2",
37
+ "eslint-plugin-spellcheck": "~0.0.17",
38
+ "prettier": "~1.19.1",
39
+ "stylelint": "~9.3.0",
40
+ "stylelint-config-standard": "~18.0.0",
41
+ "surge": "~0.20.3",
42
+ "redux-mock-store": "~1.2.2"
42
43
  },
43
44
  "dependencies": {
44
- "jed": "^1.1.1",
45
- "react-intl": "^2.8.0"
45
+ "jed": "~1.1.1",
46
+ "react-intl": "~2.8.0"
46
47
  }
47
48
  }
@@ -1,5 +1,6 @@
1
1
  import React, { Component } from 'react';
2
- import { ListView, noop } from 'patternfly-react';
2
+ import { noop } from 'foremanReact/common/helpers';
3
+ import { Accordion } from '@patternfly/react-core';
3
4
  import PropTypes from 'prop-types';
4
5
  import ListItem from './Components/ListItem';
5
6
  import EmptyState from './Components/EmptyState';
@@ -42,7 +43,7 @@ class AccountList extends Component {
42
43
  const account = accounts[accountID];
43
44
  return <ListItem key={index} accountID={accountID} account={account} />;
44
45
  });
45
- return <ListView className="account_list">{items}</ListView>;
46
+ return <Accordion className="account-list">{items}</Accordion>;
46
47
  }
47
48
  }
48
49
 
@@ -1,4 +1,4 @@
1
- import API from 'foremanReact/API';
1
+ import { API } from 'foremanReact/redux/API';
2
2
  import { addToast } from 'foremanReact/redux/actions/toasts';
3
3
  import { inventoryUrl } from '../../ForemanInventoryHelpers';
4
4
  import {
@@ -1,22 +1,40 @@
1
- import React from 'react';
2
- import { ListView } from 'patternfly-react';
1
+ import React, { useState } from 'react';
2
+ import {
3
+ AccordionItem,
4
+ AccordionToggle,
5
+ AccordionContent,
6
+ Label,
7
+ } from '@patternfly/react-core';
8
+ import { UserIcon } from '@patternfly/react-icons';
3
9
  import PropTypes from 'prop-types';
4
10
  import ListItemStatus from '../ListItemStatus';
5
11
  import Dashboard from '../../../Dashboard';
6
12
 
7
- const ListItem = ({ accountID, account }) => (
8
- <ListView.Item
9
- leftContent={<ListView.Icon name="user" />}
10
- heading={account.label}
11
- additionalInfo={[
12
- <ListItemStatus key={`${accountID}_status`} account={account} />,
13
- ]}
14
- stacked
15
- hideCloseIcon
16
- >
17
- <Dashboard accountID={accountID} account={account} />
18
- </ListView.Item>
19
- );
13
+ const ListItem = ({ accountID, account }) => {
14
+ const [isExpanded, setIsExpanded] = useState(false);
15
+ return (
16
+ <AccordionItem>
17
+ <AccordionToggle
18
+ onClick={() => setIsExpanded(currentValue => !currentValue)}
19
+ isExpanded={isExpanded}
20
+ >
21
+ <span>
22
+ <Label
23
+ className="account-icon"
24
+ variant="outline"
25
+ color="blue"
26
+ icon={<UserIcon />}
27
+ />
28
+ {account.label}
29
+ </span>
30
+ <ListItemStatus key={`${accountID}_status`} account={account} />
31
+ </AccordionToggle>
32
+ <AccordionContent isHidden={!isExpanded}>
33
+ <Dashboard accountID={accountID} account={account} />
34
+ </AccordionContent>
35
+ </AccordionItem>
36
+ );
37
+ };
20
38
 
21
39
  ListItem.propTypes = {
22
40
  accountID: PropTypes.string.isRequired,
@@ -1,50 +1,50 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`ListItem rendering render with Props 1`] = `
4
- <ListViewItem
5
- actions={null}
6
- additionalInfo={
7
- Array [
8
- <ListItemStatus
9
- account={
10
- Object {
11
- "generate_report_status": "unknown",
12
- "label": "default_org_name",
13
- "upload_report_status": "unknown",
14
- }
4
+ <AccordionItem>
5
+ <AccordionToggle
6
+ isExpanded={false}
7
+ onClick={[Function]}
8
+ >
9
+ <span>
10
+ <Label
11
+ className="account-icon"
12
+ color="blue"
13
+ icon={
14
+ <UserIcon
15
+ color="currentColor"
16
+ noVerticalAlign={false}
17
+ size="sm"
18
+ />
15
19
  }
16
- />,
17
- ]
18
- }
19
- checkboxInput={null}
20
- compoundExpand={false}
21
- compoundExpanded={false}
22
- description={null}
23
- heading="default_org_name"
24
- hideCloseIcon={true}
25
- initExpanded={false}
26
- leftContent={
27
- <ListViewIcon
28
- className=""
29
- name="user"
30
- size="sm"
31
- type="fa"
20
+ variant="outline"
21
+ />
22
+ default_org_name
23
+ </span>
24
+ <ListItemStatus
25
+ account={
26
+ Object {
27
+ "generate_report_status": "unknown",
28
+ "label": "default_org_name",
29
+ "upload_report_status": "unknown",
30
+ }
31
+ }
32
+ key="1_status"
32
33
  />
33
- }
34
- onCloseCompoundExpand={[Function]}
35
- onExpand={[Function]}
36
- onExpandClose={[Function]}
37
- stacked={true}
38
- >
39
- <Connect(Dashboard)
40
- account={
41
- Object {
42
- "generate_report_status": "unknown",
43
- "label": "default_org_name",
44
- "upload_report_status": "unknown",
34
+ </AccordionToggle>
35
+ <AccordionContent
36
+ isHidden={true}
37
+ >
38
+ <Connect(Dashboard)
39
+ account={
40
+ Object {
41
+ "generate_report_status": "unknown",
42
+ "label": "default_org_name",
43
+ "upload_report_status": "unknown",
44
+ }
45
45
  }
46
- }
47
- accountID="1"
48
- />
49
- </ListViewItem>
46
+ accountID="1"
47
+ />
48
+ </AccordionContent>
49
+ </AccordionItem>
50
50
  `;
@@ -1,8 +1,7 @@
1
1
  import React from 'react';
2
- import { Grid } from 'patternfly-react';
2
+ import { Grid, GridItem } from '@patternfly/react-core';
3
3
  import PropTypes from 'prop-types';
4
4
  import { translate as __ } from 'foremanReact/common/I18n';
5
- import './listItemStatus.scss';
6
5
  import { getStatusIconByRegex } from './ListItemStatusHelper';
7
6
 
8
7
  const ListItemStatus = ({ account }) => {
@@ -13,15 +12,15 @@ const ListItemStatus = ({ account }) => {
13
12
  account.upload_report_status
14
13
  );
15
14
  return (
16
- <Grid className="status">
17
- <Grid.Col sm={6} className="item">
15
+ <Grid hasGutter className="status">
16
+ <GridItem span={6} className="item">
18
17
  <p>{__('Generating')}</p>
19
18
  {generatingStatusIcon}
20
- </Grid.Col>
21
- <Grid.Col sm={6} className="item">
19
+ </GridItem>
20
+ <GridItem span={6} className="item">
22
21
  <p>{__('Uploading')}</p>
23
22
  {uploadingStatusIcon}
24
- </Grid.Col>
23
+ </GridItem>
25
24
  </Grid>
26
25
  );
27
26
  };
@@ -1,10 +1,11 @@
1
1
  import React from 'react';
2
- import { Icon, Spinner } from 'patternfly-react';
2
+ import { Spinner } from '@patternfly/react-core';
3
+ import { CheckIcon, TimesIcon } from '@patternfly/react-icons';
3
4
 
4
5
  const STATUS_ICONS = {
5
- success: <Icon name="check" />,
6
- failure: <Icon name="times" />,
7
- running: <Spinner loading inline size="xs" />,
6
+ success: <CheckIcon />,
7
+ failure: <TimesIcon />,
8
+ running: <Spinner size="sm" />,
8
9
  unknown: <span>--</span>,
9
10
  };
10
11
 
@@ -2,57 +2,44 @@
2
2
 
3
3
  exports[`ListItemStatus rendering render with Props 1`] = `
4
4
  <Grid
5
- bsClass="container"
6
5
  className="status"
7
- componentClass="div"
8
- fluid={false}
6
+ hasGutter={true}
9
7
  >
10
- <Col
11
- bsClass="col"
8
+ <GridItem
12
9
  className="item"
13
- componentClass="div"
14
- sm={6}
10
+ span={6}
15
11
  >
16
12
  <p>
17
13
  Generating
18
14
  </p>
19
- <Icon
20
- name="check"
21
- type="fa"
15
+ <CheckIcon
16
+ color="currentColor"
17
+ noVerticalAlign={false}
18
+ size="sm"
22
19
  />
23
- </Col>
24
- <Col
25
- bsClass="col"
20
+ </GridItem>
21
+ <GridItem
26
22
  className="item"
27
- componentClass="div"
28
- sm={6}
23
+ span={6}
29
24
  >
30
25
  <p>
31
26
  Uploading
32
27
  </p>
33
28
  <Spinner
34
- className=""
35
- inline={true}
36
- inverse={false}
37
- loading={true}
38
- size="xs"
29
+ size="sm"
39
30
  />
40
- </Col>
31
+ </GridItem>
41
32
  </Grid>
42
33
  `;
43
34
 
44
35
  exports[`ListItemStatus rendering render without Props 1`] = `
45
36
  <Grid
46
- bsClass="container"
47
37
  className="status"
48
- componentClass="div"
49
- fluid={false}
38
+ hasGutter={true}
50
39
  >
51
- <Col
52
- bsClass="col"
40
+ <GridItem
53
41
  className="item"
54
- componentClass="div"
55
- sm={6}
42
+ span={6}
56
43
  >
57
44
  <p>
58
45
  Generating
@@ -60,12 +47,10 @@ exports[`ListItemStatus rendering render without Props 1`] = `
60
47
  <span>
61
48
  --
62
49
  </span>
63
- </Col>
64
- <Col
65
- bsClass="col"
50
+ </GridItem>
51
+ <GridItem
66
52
  className="item"
67
- componentClass="div"
68
- sm={6}
53
+ span={6}
69
54
  >
70
55
  <p>
71
56
  Uploading
@@ -73,6 +58,6 @@ exports[`ListItemStatus rendering render without Props 1`] = `
73
58
  <span>
74
59
  --
75
60
  </span>
76
- </Col>
61
+ </GridItem>
77
62
  </Grid>
78
63
  `;