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.
- checksums.yaml +4 -4
- data/README.md +13 -0
- data/app/controllers/foreman_inventory_upload/uploads_controller.rb +11 -0
- data/app/controllers/insights_cloud/hits_controller.rb +24 -0
- data/app/controllers/insights_cloud/settings_controller.rb +8 -0
- data/app/models/insights_hit.rb +5 -1
- data/app/models/setting/rh_cloud.rb +8 -6
- data/app/overrides/layouts/base/styles.html.erb.deface +2 -0
- data/app/services/foreman_rh_cloud/cloud_connector.rb +59 -0
- data/app/views/layouts/foreman_rh_cloud/application.html.erb +0 -4
- data/config/Gemfile.lock.gh_test +830 -0
- data/config/database.yml.example +17 -0
- data/config/package-lock.json.gh_test +35653 -0
- data/config/routes.rb +12 -3
- data/lib/foreman_inventory_upload.rb +1 -1
- data/lib/foreman_inventory_upload/generators/archived_report.rb +1 -1
- data/lib/foreman_rh_cloud/engine.rb +15 -5
- data/lib/foreman_rh_cloud/version.rb +1 -1
- data/lib/tasks/rh_cloud_inventory.rake +23 -0
- data/package.json +18 -17
- data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.js +3 -2
- data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListActions.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/ListItem.js +33 -15
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/__tests__/__snapshots__/ListItem.test.js.snap +43 -43
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatus.js +6 -7
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js +5 -4
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/__tests__/__snapshots__/ListItemStatus.test.js.snap +19 -34
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListActions.test.js +2 -2
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountList.test.js.snap +3 -3
- data/webpack/ForemanInventoryUpload/Components/AccountList/accountList.scss +28 -5
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/AutoUploadSwitcher.js +6 -9
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/AutoUploadSwitcherActions.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/__tests__/AutoUploadSwitcherActions.test.js +2 -2
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/__tests__/__snapshots__/AutoUploadSwitcher.test.js.snap +5 -28
- data/webpack/ForemanInventoryUpload/Components/Dashboard/DashboardActions.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js +2 -2
- data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/ExcludePackagesSwitcher.js +6 -9
- data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/ExcludePackagesSwitcherActions.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/ExcludePackagesSwitcherActions.test.js +2 -2
- data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/__snapshots__/ExcludePackagesSwitcher.test.js.snap +5 -28
- data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/__snapshots__/integration.test.js.snap +5 -0
- data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/integration.test.js +2 -2
- data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/HostObfuscationSwitcher.js +6 -9
- data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/HostObfuscationSwitcherActions.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/__tests__/HostObfuscationSwitcherActions.test.js +2 -2
- data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/__tests__/__snapshots__/HostObfuscationSwitcher.test.js.snap +5 -28
- data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilterReducer.js +6 -3
- data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/__snapshots__/integration.test.js.snap +5 -0
- data/webpack/ForemanInventoryUpload/Components/InventorySettings/InventorySettings.js +2 -2
- data/webpack/ForemanInventoryUpload/Components/InventorySettings/{inventorySettings.scss → InventorySettings.scss} +2 -5
- data/webpack/ForemanInventoryUpload/Components/InventorySettings/__tests__/__snapshots__/InventorySettings.test.js.snap +1 -1
- data/webpack/ForemanInventoryUpload/Components/IpsObfuscationSwitcher/IpsObfuscationSwitcher.js +6 -8
- data/webpack/ForemanInventoryUpload/Components/IpsObfuscationSwitcher/IpsObfuscationSwitcherActions.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/IpsObfuscationSwitcher/__tests__/IpsObfuscationSwitcherActions.test.js +2 -2
- data/webpack/ForemanInventoryUpload/Components/IpsObfuscationSwitcher/__tests__/__snapshots__/IpsObfuscationSwitcher.test.js.snap +5 -28
- data/webpack/ForemanInventoryUpload/Components/PageHeader/PageHeader.js +10 -18
- data/webpack/ForemanInventoryUpload/Components/PageHeader/PageHeader.scss +19 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/PageTitle.js +53 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/{components/DocsButton/__tests__/DocsButton.test.js → __tests__/PageTitle.test.js} +3 -3
- data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/__snapshots__/PageHeader.test.js.snap +12 -38
- data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/__snapshots__/PageTitle.test.js.snap +43 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/CloudConnectorActions.js +27 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/CloudConnectorButton.js +51 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/CloudConnectorConstants.js +6 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/CloudConnectorSelectors.js +14 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/__tests__/CloudConnectorActions.test.js +9 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/__tests__/CloudConnectorButton.test.js +22 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/__tests__/__snapshots__/CloudConnectorActions.test.js.snap +11 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/__tests__/__snapshots__/CloudConnectorButton.test.js.snap +48 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudConnectorButton/index.js +27 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButton.js +7 -9
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonActions.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/SyncButtonActions.test.js +2 -2
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/SyncButton.test.js.snap +7 -9
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/ToolbarButtons/ToolbarButtons.js +2 -4
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/ToolbarButtons/__tests__/__snapshots__/ToolbarButtons.test.js.snap +1 -2
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/ToolbarButtons/toolbarButtons.scss +1 -2
- data/webpack/ForemanInventoryUpload/Components/Terminal/terminal.scss +1 -0
- data/webpack/ForemanInventoryUpload/ForemanInventoryConstants.js +2 -2
- data/webpack/ForemanInventoryUpload/ForemanInventoryUpload.js +8 -14
- data/webpack/ForemanInventoryUpload/__tests__/__snapshots__/ForemanInventoryUpload.test.js.snap +7 -10
- data/webpack/ForemanRhCloudPages.js +19 -0
- data/webpack/InsightsCloudSync/Components/InsightsHeader/InsightsHeader.scss +4 -0
- data/webpack/InsightsCloudSync/Components/InsightsHeader/index.js +16 -0
- data/webpack/InsightsCloudSync/Components/InsightsSettings/InsightsSettingsActions.js +1 -1
- data/webpack/InsightsCloudSync/Components/InsightsSettings/__tests__/InsightsSettingsActions.test.js +2 -2
- data/webpack/InsightsCloudSync/Components/InsightsSettings/insightsSettings.scss +1 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTable.js +121 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableActions.js +129 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableConstants.js +55 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableHelpers.js +31 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableReducer.js +28 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableSelectors.js +74 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/SelectAllAlert.js +65 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/InsightsTable.test.js +13 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/InsightsTableSelectors.test.js +58 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/__snapshots__/InsightsTable.test.js.snap +168 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/__snapshots__/InsightsTableSelectors.test.js.snap +88 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/fixtures.js +104 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/components/EmptyState.js +53 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/index.js +45 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/table.scss +1 -0
- data/webpack/InsightsCloudSync/Components/NoTokenEmptyState.js +79 -0
- data/webpack/InsightsCloudSync/Components/__tests__/InsightsHeader.test.js +10 -0
- data/webpack/InsightsCloudSync/Components/__tests__/NoTokenEmptyState.test.js +19 -0
- data/webpack/InsightsCloudSync/Components/__tests__/__snapshots__/InsightsHeader.test.js.snap +13 -0
- data/webpack/InsightsCloudSync/Components/__tests__/__snapshots__/NoTokenEmptyState.test.js.snap +214 -0
- data/webpack/InsightsCloudSync/InsightsCloudSync.js +45 -44
- data/webpack/InsightsCloudSync/InsightsCloudSync.test.js +10 -2
- data/webpack/InsightsCloudSync/InsightsCloudSyncActions.js +1 -1
- data/webpack/InsightsCloudSync/InsightsCloudSyncConstants.js +15 -1
- data/webpack/InsightsCloudSync/InsightsCloudSyncHelpers.js +7 -0
- data/webpack/InsightsCloudSync/InsightsCloudSyncReducers.js +2 -0
- data/webpack/InsightsCloudSync/__snapshots__/InsightsCloudSync.test.js.snap +45 -62
- data/webpack/InsightsCloudSync/index.js +11 -3
- data/webpack/InsightsHostDetailsTab/InsightsTabActions.js +1 -1
- data/webpack/InsightsHostDetailsTab/__tests__/InsightsTabActions.test.js +2 -2
- data/webpack/__mocks__/foremanReact/Root/Context/ForemanContext.js +1 -0
- data/webpack/__mocks__/foremanReact/constants.js +19 -0
- data/webpack/__mocks__/foremanReact/redux/API/APISelectors.js +24 -0
- data/webpack/__mocks__/foremanReact/redux/API/index.js +11 -0
- data/webpack/__mocks__/foremanReact/routes/RouterSelector.js +2 -0
- data/webpack/__mocks__/foremanReact/routes/common/PageLayout/PageLayout.js +10 -0
- data/webpack/common/Switcher/HelpLabel.js +30 -0
- data/webpack/common/Switcher/SwitcherPF4.js +36 -0
- data/webpack/common/Switcher/SwitcherPF4.scss +10 -0
- data/webpack/common/Switcher/__tests__/HelpLabel.test.js +13 -0
- data/webpack/common/Switcher/__tests__/SwitcherPF4.test.js +14 -0
- data/webpack/common/Switcher/__tests__/__snapshots__/HelpLabel.test.js.snap +20 -0
- data/webpack/common/Switcher/__tests__/__snapshots__/SwitcherPF4.test.js.snap +22 -0
- data/webpack/global_index.js +2 -0
- metadata +96 -34
- data/app/controllers/foreman_rh_cloud/react_controller.rb +0 -11
- data/app/views/foreman_rh_cloud/react/insights_cloud.html.erb +0 -1
- data/app/views/foreman_rh_cloud/react/inventory_upload.html.erb +0 -1
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/listItem.scss +0 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/listItemStatus.scss +0 -16
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/autoUploadSwitcher.scss +0 -3
- data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/excludePackagesSwitcher.scss +0 -3
- data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/HostObfuscationSwitcher.scss +0 -3
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/DocsButton/DocsButton.js +0 -18
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/DocsButton/__tests__/__snapshots__/DocsButton.test.js.snap +0 -21
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/DocsButton/index.js +0 -1
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/HistoryButton/HistoryButton.js +0 -19
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/HistoryButton/__tests__/HistoryButton.test.js +0 -12
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/HistoryButton/__tests__/__snapshots__/HistoryButton.test.js.snap +0 -22
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/HistoryButton/index.js +0 -1
- data/webpack/ForemanInventoryUpload/Components/PageHeader/pageHeader.scss +0 -3
- 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
|
-
|
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#
|
25
|
-
get 'insights_cloud', to: 'react#
|
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
|
@@ -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', '-
|
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
|
-
'
|
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: :
|
59
|
-
menu :top_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|
|
@@ -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": "
|
25
|
+
"@theforeman/vendor": "~4.14.0"
|
26
26
|
},
|
27
27
|
"devDependencies": {
|
28
|
-
"@babel/core": "
|
29
|
-
"@
|
30
|
-
"@theforeman/
|
31
|
-
"@theforeman/
|
32
|
-
"@theforeman/
|
33
|
-
"@theforeman/
|
34
|
-
"
|
35
|
-
"eslint": "
|
36
|
-
"eslint
|
37
|
-
"
|
38
|
-
"
|
39
|
-
"stylelint": "
|
40
|
-
"stylelint-config-standard": "
|
41
|
-
"surge": "
|
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": "
|
45
|
-
"react-intl": "
|
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 {
|
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 <
|
46
|
+
return <Accordion className="account-list">{items}</Accordion>;
|
46
47
|
}
|
47
48
|
}
|
48
49
|
|
@@ -1,22 +1,40 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import {
|
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
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
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
|
-
<
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
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
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
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
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
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
|
-
|
48
|
-
|
49
|
-
</
|
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-
|
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
|
-
<
|
15
|
+
<Grid hasGutter className="status">
|
16
|
+
<GridItem span={6} className="item">
|
18
17
|
<p>{__('Generating')}</p>
|
19
18
|
{generatingStatusIcon}
|
20
|
-
</
|
21
|
-
<
|
19
|
+
</GridItem>
|
20
|
+
<GridItem span={6} className="item">
|
22
21
|
<p>{__('Uploading')}</p>
|
23
22
|
{uploadingStatusIcon}
|
24
|
-
</
|
23
|
+
</GridItem>
|
25
24
|
</Grid>
|
26
25
|
);
|
27
26
|
};
|
@@ -1,10 +1,11 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import {
|
2
|
+
import { Spinner } from '@patternfly/react-core';
|
3
|
+
import { CheckIcon, TimesIcon } from '@patternfly/react-icons';
|
3
4
|
|
4
5
|
const STATUS_ICONS = {
|
5
|
-
success: <
|
6
|
-
failure: <
|
7
|
-
running: <Spinner
|
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
|
-
|
8
|
-
fluid={false}
|
6
|
+
hasGutter={true}
|
9
7
|
>
|
10
|
-
<
|
11
|
-
bsClass="col"
|
8
|
+
<GridItem
|
12
9
|
className="item"
|
13
|
-
|
14
|
-
sm={6}
|
10
|
+
span={6}
|
15
11
|
>
|
16
12
|
<p>
|
17
13
|
Generating
|
18
14
|
</p>
|
19
|
-
<
|
20
|
-
|
21
|
-
|
15
|
+
<CheckIcon
|
16
|
+
color="currentColor"
|
17
|
+
noVerticalAlign={false}
|
18
|
+
size="sm"
|
22
19
|
/>
|
23
|
-
</
|
24
|
-
<
|
25
|
-
bsClass="col"
|
20
|
+
</GridItem>
|
21
|
+
<GridItem
|
26
22
|
className="item"
|
27
|
-
|
28
|
-
sm={6}
|
23
|
+
span={6}
|
29
24
|
>
|
30
25
|
<p>
|
31
26
|
Uploading
|
32
27
|
</p>
|
33
28
|
<Spinner
|
34
|
-
|
35
|
-
inline={true}
|
36
|
-
inverse={false}
|
37
|
-
loading={true}
|
38
|
-
size="xs"
|
29
|
+
size="sm"
|
39
30
|
/>
|
40
|
-
</
|
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
|
-
|
49
|
-
fluid={false}
|
38
|
+
hasGutter={true}
|
50
39
|
>
|
51
|
-
<
|
52
|
-
bsClass="col"
|
40
|
+
<GridItem
|
53
41
|
className="item"
|
54
|
-
|
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
|
-
</
|
64
|
-
<
|
65
|
-
bsClass="col"
|
50
|
+
</GridItem>
|
51
|
+
<GridItem
|
66
52
|
className="item"
|
67
|
-
|
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
|
-
</
|
61
|
+
</GridItem>
|
77
62
|
</Grid>
|
78
63
|
`;
|