foreman_rh_cloud 2.0.17 → 2.0.18
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.
- checksums.yaml +4 -4
- data/app/controllers/foreman_inventory_upload/accounts_controller.rb +2 -2
- data/app/controllers/foreman_inventory_upload/uploads_controller.rb +1 -8
- data/lib/foreman_inventory_upload.rb +2 -1
- data/lib/foreman_inventory_upload/generators/json_stream.rb +1 -1
- data/lib/foreman_rh_cloud/version.rb +1 -1
- data/package.json +1 -1
- data/test/controllers/accounts_controller_test.rb +1 -1
- data/test/unit/slice_generator_test.rb +1 -1
- data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.fixtures.js +3 -3
- data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.js +7 -7
- data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListHelper.js +6 -6
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/ListItem.fixtures.js +10 -1
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/ListItem.js +7 -7
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/__tests__/__snapshots__/ListItem.test.js.snap +11 -8
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListHelper.test.js +3 -3
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountList.test.js.snap +6 -6
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListActions.test.js.snap +3 -3
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListReducer.test.js.snap +3 -3
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListSelectors.test.js.snap +6 -6
- data/webpack/ForemanInventoryUpload/Components/Dashboard/DashboardActions.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js +4 -4
- metadata +16 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65a5f371cd3cf04391dc00f0a9e797e052830b67ebeda760259af082b10fd95f
|
4
|
+
data.tar.gz: 3441080128c415a951878e6471b7de44cb2ab10e3baee7b27065c97ee165c072
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '085d4e4e524e48a595b8833cf9777c0ebc6116cd88c28d7bdc01ff4b8080689d5d6ca334b4a4554f5978cf36f64baa3494d90ce63593c313887daff9fc19c0a9'
|
7
|
+
data.tar.gz: 2e073a6a25e049c41c4092854874dec161af475822055875ca042b472ea8c31c9bcdc89451840f83d752df95595e1127ae6d750716f5a5a71445eca3f7ce9be4
|
@@ -10,11 +10,11 @@ module ForemanInventoryUpload
|
|
10
10
|
upload_report_status = status_for(id, ForemanInventoryUpload::Async::UploadReportJob)
|
11
11
|
|
12
12
|
[
|
13
|
-
|
13
|
+
label,
|
14
14
|
{
|
15
15
|
generate_report_status: generate_report_status,
|
16
16
|
upload_report_status: upload_report_status,
|
17
|
-
|
17
|
+
id: id,
|
18
18
|
},
|
19
19
|
]
|
20
20
|
end
|
@@ -14,14 +14,7 @@ module ForemanInventoryUpload
|
|
14
14
|
files = Dir["{#{ForemanInventoryUpload.uploads_file_path(filename)},#{ForemanInventoryUpload.done_file_path(filename)}}"]
|
15
15
|
|
16
16
|
return send_file files.first, disposition: 'attachment', filename: filename unless files.empty?
|
17
|
-
|
18
|
-
end
|
19
|
-
|
20
|
-
def throw_flash_error(message)
|
21
|
-
process_error(
|
22
|
-
:redirect => foreman_inventory_upload_index_path,
|
23
|
-
:error_msg => message
|
24
|
-
)
|
17
|
+
raise ::Foreman::Exception.new("The report file doesn't exist")
|
25
18
|
end
|
26
19
|
|
27
20
|
def auto_upload
|
@@ -62,6 +62,7 @@ module ForemanInventoryUpload
|
|
62
62
|
end
|
63
63
|
|
64
64
|
def self.inventory_export_url
|
65
|
-
|
65
|
+
tags = URI.encode("satellite/satellite_instance_id=#{Foreman.instance_id}")
|
66
|
+
ForemanRhCloud.base_url + "/api/inventory/v1/hosts?tags=#{tags}"
|
66
67
|
end
|
67
68
|
end
|
data/package.json
CHANGED
@@ -21,7 +21,7 @@ class AccountsControllerTest < ActionController::TestCase
|
|
21
21
|
|
22
22
|
assert_response :success
|
23
23
|
actual = JSON.parse(response.body)
|
24
|
-
actual_account_statuses = actual['accounts'][test_org.
|
24
|
+
actual_account_statuses = actual['accounts'][test_org.label]
|
25
25
|
assert_equal 'generate_status_test', actual_account_statuses['generate_report_status']
|
26
26
|
assert_equal 'upload_status_test', actual_account_statuses['upload_report_status']
|
27
27
|
|
@@ -287,7 +287,7 @@ class SliceGeneratorTest < ActiveSupport::TestCase
|
|
287
287
|
end
|
288
288
|
|
289
289
|
test 'generates a report with satellite facts' do
|
290
|
-
hostgroup = FactoryBot.create(:hostgroup)
|
290
|
+
hostgroup = FactoryBot.create(:hostgroup, name: 'Special"name')
|
291
291
|
@host.hostgroup = hostgroup
|
292
292
|
@host.save!
|
293
293
|
|
@@ -2,17 +2,17 @@ import { noop } from 'patternfly-react';
|
|
2
2
|
|
3
3
|
export const accounts = {
|
4
4
|
Account1: {
|
5
|
-
|
5
|
+
id: 1,
|
6
6
|
upload_report_status: 'running',
|
7
7
|
generate_report_status: 'running',
|
8
8
|
},
|
9
9
|
Account2: {
|
10
|
-
|
10
|
+
id: 2,
|
11
11
|
upload_report_status: 'unknown',
|
12
12
|
generate_report_status: 'failure',
|
13
13
|
},
|
14
14
|
Account3: {
|
15
|
-
|
15
|
+
id: 3,
|
16
16
|
upload_report_status: 'success',
|
17
17
|
generate_report_status: 'running',
|
18
18
|
},
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import React, { Component } from 'react';
|
2
2
|
import { ListView, noop } from 'patternfly-react';
|
3
|
+
import { isEmpty } from 'lodash';
|
3
4
|
import PropTypes from 'prop-types';
|
4
5
|
import ListItem from './Components/ListItem';
|
5
6
|
import EmptyState from './Components/EmptyState';
|
@@ -23,24 +24,23 @@ class AccountList extends Component {
|
|
23
24
|
|
24
25
|
render() {
|
25
26
|
const { accounts, error, filterTerm } = this.props;
|
26
|
-
const
|
27
|
-
const filteredAccountIds = filterAccounts(accounts, accountIds, filterTerm);
|
27
|
+
const filteredAccount = filterAccounts(accounts, filterTerm);
|
28
28
|
|
29
29
|
if (error) {
|
30
30
|
return <ErrorState error={error} />;
|
31
31
|
}
|
32
32
|
|
33
|
-
if (
|
33
|
+
if (isEmpty(accounts)) {
|
34
34
|
return <EmptyState />;
|
35
35
|
}
|
36
36
|
|
37
|
-
if (
|
37
|
+
if (isEmpty(filteredAccount)) {
|
38
38
|
return <EmptyResults />;
|
39
39
|
}
|
40
40
|
|
41
|
-
const items =
|
42
|
-
const account = accounts[
|
43
|
-
return <ListItem key={index}
|
41
|
+
const items = Object.keys(filteredAccount).map((label, index) => {
|
42
|
+
const account = accounts[label];
|
43
|
+
return <ListItem key={index} label={label} account={account} />;
|
44
44
|
});
|
45
45
|
return <ListView className="account_list">{items}</ListView>;
|
46
46
|
}
|
@@ -1,10 +1,10 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
import { pickBy } from 'lodash';
|
2
|
+
|
3
|
+
export const filterAccounts = (accounts, filterTerm) => {
|
4
|
+
if (!filterTerm) return accounts;
|
5
5
|
|
6
6
|
const filterTermLowerCased = filterTerm.toLowerCase();
|
7
|
-
return
|
8
|
-
|
7
|
+
return pickBy(accounts, (value, key) =>
|
8
|
+
key.toLowerCase().includes(filterTermLowerCased)
|
9
9
|
);
|
10
10
|
};
|
@@ -4,26 +4,26 @@ import PropTypes from 'prop-types';
|
|
4
4
|
import ListItemStatus from '../ListItemStatus';
|
5
5
|
import Dashboard from '../../../Dashboard';
|
6
6
|
|
7
|
-
const ListItem = ({
|
7
|
+
const ListItem = ({ label, account }) => (
|
8
8
|
<ListView.Item
|
9
9
|
leftContent={<ListView.Icon name="user" />}
|
10
|
-
heading={
|
10
|
+
heading={label}
|
11
11
|
additionalInfo={[
|
12
|
-
<ListItemStatus key={`${
|
12
|
+
<ListItemStatus key={`${label}_status`} account={account} />,
|
13
13
|
]}
|
14
14
|
stacked
|
15
15
|
hideCloseIcon
|
16
16
|
>
|
17
|
-
<Dashboard accountID={
|
17
|
+
<Dashboard accountID={account.id} account={account} />
|
18
18
|
</ListView.Item>
|
19
19
|
);
|
20
20
|
|
21
21
|
ListItem.propTypes = {
|
22
|
-
|
22
|
+
label: PropTypes.string.isRequired,
|
23
23
|
account: PropTypes.shape({
|
24
24
|
generate_report_status: PropTypes.string,
|
25
25
|
upload_report_status: PropTypes.string,
|
26
|
-
|
26
|
+
id: PropTypes.number,
|
27
27
|
}),
|
28
28
|
};
|
29
29
|
|
@@ -31,7 +31,7 @@ ListItem.defaultProps = {
|
|
31
31
|
account: {
|
32
32
|
generate_report_status: 'unknown',
|
33
33
|
upload_report_status: 'unknown',
|
34
|
-
|
34
|
+
id: 0,
|
35
35
|
},
|
36
36
|
};
|
37
37
|
|
@@ -8,9 +8,11 @@ exports[`ListItem rendering render with Props 1`] = `
|
|
8
8
|
<ListItemStatus
|
9
9
|
account={
|
10
10
|
Object {
|
11
|
-
"
|
12
|
-
|
13
|
-
|
11
|
+
"test": Object {
|
12
|
+
"generate_report_status": "unknown",
|
13
|
+
"id": 1,
|
14
|
+
"upload_report_status": "unknown",
|
15
|
+
},
|
14
16
|
}
|
15
17
|
}
|
16
18
|
/>,
|
@@ -20,7 +22,7 @@ exports[`ListItem rendering render with Props 1`] = `
|
|
20
22
|
compoundExpand={false}
|
21
23
|
compoundExpanded={false}
|
22
24
|
description={null}
|
23
|
-
heading="
|
25
|
+
heading="test"
|
24
26
|
hideCloseIcon={true}
|
25
27
|
initExpanded={false}
|
26
28
|
leftContent={
|
@@ -39,12 +41,13 @@ exports[`ListItem rendering render with Props 1`] = `
|
|
39
41
|
<Connect(Dashboard)
|
40
42
|
account={
|
41
43
|
Object {
|
42
|
-
"
|
43
|
-
|
44
|
-
|
44
|
+
"test": Object {
|
45
|
+
"generate_report_status": "unknown",
|
46
|
+
"id": 1,
|
47
|
+
"upload_report_status": "unknown",
|
48
|
+
},
|
45
49
|
}
|
46
50
|
}
|
47
|
-
accountID="1"
|
48
51
|
/>
|
49
52
|
</ListViewItem>
|
50
53
|
`;
|
data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListHelper.test.js
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
import { filterAccounts } from '../AccountListHelper';
|
2
|
-
import { accounts
|
2
|
+
import { accounts } from '../AccountList.fixtures';
|
3
3
|
|
4
4
|
describe('AccountList helpers', () => {
|
5
5
|
it('account ids filter should return all accounts where label contains "test"', () => {
|
6
|
-
expect(filterAccounts(accounts,
|
6
|
+
expect(filterAccounts(accounts, 'AcCoUnT')).toEqual(accounts);
|
7
7
|
});
|
8
8
|
|
9
9
|
it('account ids filter should not match', () => {
|
10
|
-
expect(filterAccounts(accounts,
|
10
|
+
expect(filterAccounts(accounts, 'no_match')).toEqual({});
|
11
11
|
});
|
12
12
|
});
|
@@ -8,34 +8,34 @@ exports[`AccountList rendering render with props 1`] = `
|
|
8
8
|
account={
|
9
9
|
Object {
|
10
10
|
"generate_report_status": "running",
|
11
|
-
"
|
11
|
+
"id": 1,
|
12
12
|
"upload_report_status": "running",
|
13
13
|
}
|
14
14
|
}
|
15
|
-
accountID="Account1"
|
16
15
|
key="0"
|
16
|
+
label="Account1"
|
17
17
|
/>
|
18
18
|
<ListItem
|
19
19
|
account={
|
20
20
|
Object {
|
21
21
|
"generate_report_status": "failure",
|
22
|
-
"
|
22
|
+
"id": 2,
|
23
23
|
"upload_report_status": "unknown",
|
24
24
|
}
|
25
25
|
}
|
26
|
-
accountID="Account2"
|
27
26
|
key="1"
|
27
|
+
label="Account2"
|
28
28
|
/>
|
29
29
|
<ListItem
|
30
30
|
account={
|
31
31
|
Object {
|
32
32
|
"generate_report_status": "running",
|
33
|
-
"
|
33
|
+
"id": 3,
|
34
34
|
"upload_report_status": "success",
|
35
35
|
}
|
36
36
|
}
|
37
|
-
accountID="Account3"
|
38
37
|
key="2"
|
38
|
+
label="Account3"
|
39
39
|
/>
|
40
40
|
</ListView>
|
41
41
|
`;
|
@@ -8,17 +8,17 @@ Array [
|
|
8
8
|
"accounts": Object {
|
9
9
|
"Account1": Object {
|
10
10
|
"generate_report_status": "running",
|
11
|
-
"
|
11
|
+
"id": 1,
|
12
12
|
"upload_report_status": "running",
|
13
13
|
},
|
14
14
|
"Account2": Object {
|
15
15
|
"generate_report_status": "failure",
|
16
|
-
"
|
16
|
+
"id": 2,
|
17
17
|
"upload_report_status": "unknown",
|
18
18
|
},
|
19
19
|
"Account3": Object {
|
20
20
|
"generate_report_status": "running",
|
21
|
-
"
|
21
|
+
"id": 3,
|
22
22
|
"upload_report_status": "success",
|
23
23
|
},
|
24
24
|
},
|
@@ -23,17 +23,17 @@ Object {
|
|
23
23
|
"accounts": Object {
|
24
24
|
"Account1": Object {
|
25
25
|
"generate_report_status": "running",
|
26
|
-
"
|
26
|
+
"id": 1,
|
27
27
|
"upload_report_status": "running",
|
28
28
|
},
|
29
29
|
"Account2": Object {
|
30
30
|
"generate_report_status": "failure",
|
31
|
-
"
|
31
|
+
"id": 2,
|
32
32
|
"upload_report_status": "unknown",
|
33
33
|
},
|
34
34
|
"Account3": Object {
|
35
35
|
"generate_report_status": "running",
|
36
|
-
"
|
36
|
+
"id": 3,
|
37
37
|
"upload_report_status": "success",
|
38
38
|
},
|
39
39
|
},
|
@@ -4,17 +4,17 @@ exports[`AccountList selectors should return AccountList accounts 1`] = `
|
|
4
4
|
Object {
|
5
5
|
"Account1": Object {
|
6
6
|
"generate_report_status": "running",
|
7
|
-
"
|
7
|
+
"id": 1,
|
8
8
|
"upload_report_status": "running",
|
9
9
|
},
|
10
10
|
"Account2": Object {
|
11
11
|
"generate_report_status": "failure",
|
12
|
-
"
|
12
|
+
"id": 2,
|
13
13
|
"upload_report_status": "unknown",
|
14
14
|
},
|
15
15
|
"Account3": Object {
|
16
16
|
"generate_report_status": "running",
|
17
|
-
"
|
17
|
+
"id": 3,
|
18
18
|
"upload_report_status": "success",
|
19
19
|
},
|
20
20
|
}
|
@@ -35,17 +35,17 @@ Object {
|
|
35
35
|
"accounts": Object {
|
36
36
|
"Account1": Object {
|
37
37
|
"generate_report_status": "running",
|
38
|
-
"
|
38
|
+
"id": 1,
|
39
39
|
"upload_report_status": "running",
|
40
40
|
},
|
41
41
|
"Account2": Object {
|
42
42
|
"generate_report_status": "failure",
|
43
|
-
"
|
43
|
+
"id": 2,
|
44
44
|
"upload_report_status": "unknown",
|
45
45
|
},
|
46
46
|
"Account3": Object {
|
47
47
|
"generate_report_status": "running",
|
48
|
-
"
|
48
|
+
"id": 3,
|
49
49
|
"upload_report_status": "success",
|
50
50
|
},
|
51
51
|
},
|
@@ -67,7 +67,7 @@ export const setActiveTab = (accountID, tabName) => ({
|
|
67
67
|
});
|
68
68
|
|
69
69
|
export const downloadReports = accountID => {
|
70
|
-
window.
|
70
|
+
window.open(inventoryUrl(`${accountID}/uploads/file`), '_blank');
|
71
71
|
return {
|
72
72
|
type: INVENTORY_REPORTS_DOWNLOAD,
|
73
73
|
payload: {
|
@@ -36,15 +36,15 @@ const fixtures = {
|
|
36
36
|
};
|
37
37
|
|
38
38
|
describe('Dashboard actions', () => {
|
39
|
-
const {
|
39
|
+
const { open } = window;
|
40
40
|
|
41
41
|
beforeAll(() => {
|
42
|
-
delete window.
|
43
|
-
window.
|
42
|
+
delete window.open;
|
43
|
+
window.open = jest.fn();
|
44
44
|
});
|
45
45
|
|
46
46
|
afterAll(() => {
|
47
|
-
window.
|
47
|
+
window.open = open;
|
48
48
|
});
|
49
49
|
|
50
50
|
return testActionSnapshotWithFixtures(fixtures);
|
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: 2.0.
|
4
|
+
version: 2.0.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Foreman Red Hat Cloud team
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: katello
|
@@ -528,7 +528,7 @@ homepage: https://github.com/theforeman/foreman_rh_cloud
|
|
528
528
|
licenses:
|
529
529
|
- GPL-3.0
|
530
530
|
metadata: {}
|
531
|
-
post_install_message:
|
531
|
+
post_install_message:
|
532
532
|
rdoc_options: []
|
533
533
|
require_paths:
|
534
534
|
- lib
|
@@ -543,25 +543,25 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
543
543
|
- !ruby/object:Gem::Version
|
544
544
|
version: '0'
|
545
545
|
requirements: []
|
546
|
-
rubygems_version: 3.
|
547
|
-
signing_key:
|
546
|
+
rubygems_version: 3.2.3
|
547
|
+
signing_key:
|
548
548
|
specification_version: 4
|
549
549
|
summary: Summary of ForemanRhCloud.
|
550
550
|
test_files:
|
551
|
-
- test/controllers/uploads_controller_test.rb
|
552
|
-
- test/controllers/insights_sync/settings_controller_test.rb
|
553
551
|
- test/controllers/accounts_controller_test.rb
|
552
|
+
- test/controllers/insights_sync/settings_controller_test.rb
|
554
553
|
- test/controllers/reports_controller_test.rb
|
555
|
-
- test/
|
556
|
-
- test/
|
554
|
+
- test/controllers/uploads_controller_test.rb
|
555
|
+
- test/factories/insights_factories.rb
|
556
|
+
- test/factories/inventory_upload_factories.rb
|
557
557
|
- test/jobs/insights_full_sync_test.rb
|
558
558
|
- test/jobs/inventory_full_sync_test.rb
|
559
|
-
- test/
|
560
|
-
- test/
|
561
|
-
- test/unit/
|
562
|
-
- test/unit/
|
559
|
+
- test/jobs/upload_report_job_test.rb
|
560
|
+
- test/test_plugin_helper.rb
|
561
|
+
- test/unit/archived_report_generator_test.rb
|
562
|
+
- test/unit/fact_helpers_test.rb
|
563
563
|
- test/unit/insights_facet_test.rb
|
564
|
+
- test/unit/metadata_generator_test.rb
|
564
565
|
- test/unit/rh_cloud_http_proxy_test.rb
|
565
|
-
- test/unit/
|
566
|
-
- test/unit/archived_report_generator_test.rb
|
566
|
+
- test/unit/shell_process_job_test.rb
|
567
567
|
- test/unit/slice_generator_test.rb
|