foreman_rh_cloud 3.0.21.1 → 3.0.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/insights_cloud/api/machine_telemetries_controller.rb +17 -7
- data/app/models/insights_client_report_status.rb +58 -0
- data/app/services/foreman_rh_cloud/cloud_auth.rb +12 -0
- data/app/services/foreman_rh_cloud/cloud_request.rb +14 -0
- data/app/services/foreman_rh_cloud/cloud_request_forwarder.rb +1 -6
- data/app/services/foreman_rh_cloud/remediations_retriever.rb +1 -4
- data/app/subscribers/foreman_rh_cloud/insights_subscriber.rb +9 -0
- data/lib/foreman_inventory_upload/generators/fact_helpers.rb +19 -0
- data/lib/foreman_inventory_upload/generators/slice.rb +6 -6
- data/lib/foreman_rh_cloud/engine.rb +4 -1
- data/lib/foreman_rh_cloud/version.rb +1 -1
- data/lib/insights_cloud/async/insights_full_sync.rb +4 -14
- data/lib/insights_cloud/async/insights_resolutions_sync.rb +1 -4
- data/lib/insights_cloud/async/insights_rules_sync.rb +2 -7
- data/lib/inventory_sync/async/inventory_full_sync.rb +2 -1
- data/lib/inventory_sync/async/inventory_scheduled_sync.rb +8 -0
- data/lib/inventory_sync/async/query_inventory_job.rb +1 -4
- data/lib/tasks/rh_cloud_inventory.rake +6 -0
- data/package.json +2 -2
- data/test/factories/inventory_upload_factories.rb +1 -1
- data/test/jobs/insights_full_sync_test.rb +3 -0
- data/test/jobs/insights_resolutions_sync_test.rb +3 -0
- data/test/jobs/insights_rules_sync_test.rb +3 -0
- data/test/jobs/inventory_full_sync_test.rb +3 -0
- data/test/models/insights_client_report_status_test.rb +77 -0
- data/test/unit/slice_generator_test.rb +66 -29
- data/webpack/ForemanInventoryUpload/Components/FullScreenModal/FullScreenModal.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/FullScreenModal/__tests__/__snapshots__/FullScreenModal.test.js.snap +1 -1
- data/webpack/ForemanInventoryUpload/Components/FullScreenModal/fullScreenModal.scss +14 -16
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonActions.js +28 -63
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/integrations.test.js.snap +2 -3
- data/webpack/ForemanInventoryUpload/Components/Terminal/Terminal.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/Terminal/__tests__/Terminal.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/Terminal/__tests__/__snapshots__/Terminal.test.js.snap +2 -2
- data/webpack/ForemanInventoryUpload/Components/Terminal/terminal.scss +25 -27
- data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableActions.js +19 -19
- data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/__snapshots__/InsightsTableActions.test.js.snap +14 -14
- data/webpack/InsightsCloudSync/Components/RemediationModal/RemediateButton.js +1 -0
- data/webpack/InsightsCloudSync/InsightsCloudSync.js +4 -1
- data/webpack/InsightsCloudSync/InsightsCloudSyncActions.js +44 -20
- data/webpack/InsightsCloudSync/InsightsCloudSyncConstants.js +2 -0
- data/webpack/InsightsCloudSync/__tests__/__snapshots__/InsightsCloudSyncActions.test.js.snap +11 -7
- data/webpack/common/ForemanTasks/ForemanTasksActions.js +64 -0
- data/webpack/common/ForemanTasks/ForemanTasksHelpers.js +7 -0
- data/webpack/common/ForemanTasks/index.js +1 -0
- metadata +10 -2
@@ -0,0 +1,64 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { get } from 'foremanReact/redux/API';
|
3
|
+
import { withInterval } from 'foremanReact/redux/middlewares/IntervalMiddleware';
|
4
|
+
import { addToast } from 'foremanReact/redux/actions/toasts';
|
5
|
+
import { translate as __ } from 'foremanReact/common/I18n';
|
6
|
+
import { foremanTaskDetailsUrl } from './ForemanTasksHelpers';
|
7
|
+
import { foremanUrl } from '../../ForemanRhCloudHelpers';
|
8
|
+
|
9
|
+
export const setupTaskPolling = ({
|
10
|
+
taskId,
|
11
|
+
key,
|
12
|
+
onTaskSuccess,
|
13
|
+
onTaskError,
|
14
|
+
taskErrorMessage,
|
15
|
+
dispatch,
|
16
|
+
}) =>
|
17
|
+
withInterval(
|
18
|
+
get({
|
19
|
+
key,
|
20
|
+
url: foremanTaskDetailsUrl(taskId),
|
21
|
+
handleSuccess: ({ data }, stopTaskInterval) => {
|
22
|
+
if (data.result === 'success') {
|
23
|
+
stopTaskInterval();
|
24
|
+
onTaskSuccess(data, dispatch);
|
25
|
+
}
|
26
|
+
if (data.result === 'error') {
|
27
|
+
stopTaskInterval();
|
28
|
+
if (taskErrorMessage === undefined) {
|
29
|
+
taskErrorMessage = errorData =>
|
30
|
+
`${__('The task failed with the following error:')} ${
|
31
|
+
errorData.humanized.errors
|
32
|
+
}`;
|
33
|
+
}
|
34
|
+
if (onTaskError === undefined) {
|
35
|
+
onTaskError = errorData =>
|
36
|
+
dispatch(defaultTaskErrorHandler(errorData, taskErrorMessage));
|
37
|
+
}
|
38
|
+
onTaskError(data, dispatch);
|
39
|
+
}
|
40
|
+
},
|
41
|
+
errorToast: error => `Could not get task details: ${error}`,
|
42
|
+
})
|
43
|
+
);
|
44
|
+
|
45
|
+
export const taskRelatedToast = (taskID, type, message) =>
|
46
|
+
addToast({
|
47
|
+
type,
|
48
|
+
message: (
|
49
|
+
<span>
|
50
|
+
{message}
|
51
|
+
<br />
|
52
|
+
<a
|
53
|
+
target="_blank"
|
54
|
+
rel="noopener noreferrer"
|
55
|
+
href={foremanUrl(`/foreman_tasks/tasks/${taskID}`)}
|
56
|
+
>
|
57
|
+
{__('view the task page for more details')}
|
58
|
+
</a>
|
59
|
+
</span>
|
60
|
+
),
|
61
|
+
});
|
62
|
+
|
63
|
+
const defaultTaskErrorHandler = (data, taskErrorMessage) =>
|
64
|
+
taskRelatedToast(data.id, 'error', taskErrorMessage(data));
|
@@ -0,0 +1 @@
|
|
1
|
+
export { setupTaskPolling, taskRelatedToast } from './ForemanTasksActions';
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_rh_cloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Foreman Red Hat Cloud team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-06-
|
11
|
+
date: 2021-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: katello
|
@@ -160,6 +160,7 @@ files:
|
|
160
160
|
- app/helpers/foreman_inventory_upload_helper.rb
|
161
161
|
- app/helpers/foreman_inventory_upload_host_helper.rb
|
162
162
|
- app/models/concerns/rh_cloud_host.rb
|
163
|
+
- app/models/insights_client_report_status.rb
|
163
164
|
- app/models/insights_facet.rb
|
164
165
|
- app/models/insights_hit.rb
|
165
166
|
- app/models/insights_resolution.rb
|
@@ -171,9 +172,11 @@ files:
|
|
171
172
|
- app/services/foreman_rh_cloud/branch_info.rb
|
172
173
|
- app/services/foreman_rh_cloud/cloud_auth.rb
|
173
174
|
- app/services/foreman_rh_cloud/cloud_connector.rb
|
175
|
+
- app/services/foreman_rh_cloud/cloud_request.rb
|
174
176
|
- app/services/foreman_rh_cloud/cloud_request_forwarder.rb
|
175
177
|
- app/services/foreman_rh_cloud/remediations_retriever.rb
|
176
178
|
- app/services/foreman_rh_cloud/template_renderer_helper.rb
|
179
|
+
- app/subscribers/foreman_rh_cloud/insights_subscriber.rb
|
177
180
|
- app/views/hosts/_insights_tab.html.erb
|
178
181
|
- app/views/job_templates/rh_cloud_remediations.erb
|
179
182
|
- app/views/layouts/foreman_rh_cloud/application.html.erb
|
@@ -245,6 +248,7 @@ files:
|
|
245
248
|
- test/jobs/insights_rules_sync_test.rb
|
246
249
|
- test/jobs/inventory_full_sync_test.rb
|
247
250
|
- test/jobs/upload_report_job_test.rb
|
251
|
+
- test/models/insights_client_report_status_test.rb
|
248
252
|
- test/test_plugin_helper.rb
|
249
253
|
- test/unit/archived_report_generator_test.rb
|
250
254
|
- test/unit/fact_helpers_test.rb
|
@@ -617,6 +621,9 @@ files:
|
|
617
621
|
- webpack/__tests__/__snapshots__/ForemanRhCloudHelpers.test.js.snap
|
618
622
|
- webpack/__tests__/__snapshots__/ForemanRhCloudSelectors.test.js.snap
|
619
623
|
- webpack/__tests__/__snapshots__/ForemanRhCloudTestHelpers.test.js.snap
|
624
|
+
- webpack/common/ForemanTasks/ForemanTasksActions.js
|
625
|
+
- webpack/common/ForemanTasks/ForemanTasksHelpers.js
|
626
|
+
- webpack/common/ForemanTasks/index.js
|
620
627
|
- webpack/common/Switcher/HelpLabel.js
|
621
628
|
- webpack/common/Switcher/SwitcherPF4.js
|
622
629
|
- webpack/common/Switcher/SwitcherPF4.scss
|
@@ -666,6 +673,7 @@ test_files:
|
|
666
673
|
- test/jobs/insights_rules_sync_test.rb
|
667
674
|
- test/jobs/inventory_full_sync_test.rb
|
668
675
|
- test/jobs/upload_report_job_test.rb
|
676
|
+
- test/models/insights_client_report_status_test.rb
|
669
677
|
- test/test_plugin_helper.rb
|
670
678
|
- test/unit/archived_report_generator_test.rb
|
671
679
|
- test/unit/fact_helpers_test.rb
|