foreman_rh_cloud 0.9.5 → 2.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/foreman_inventory_upload/accounts_controller.rb +0 -1
- data/app/controllers/foreman_inventory_upload/uploads_controller.rb +7 -14
- data/config/routes.rb +0 -1
- data/lib/foreman_inventory_upload.rb +0 -12
- data/lib/foreman_inventory_upload/async/generate_all_reports_job.rb +0 -8
- data/lib/foreman_inventory_upload/async/queue_for_upload_job.rb +10 -5
- data/lib/foreman_inventory_upload/async/upload_report_job.rb +1 -5
- data/lib/foreman_inventory_upload/generators/archived_report.rb +3 -6
- data/lib/foreman_inventory_upload/generators/queries.rb +0 -1
- data/lib/foreman_inventory_upload/generators/slice.rb +4 -20
- data/lib/foreman_inventory_upload/scripts/uploader.sh.erb +1 -0
- data/lib/foreman_rh_cloud/engine.rb +1 -5
- data/lib/foreman_rh_cloud/version.rb +1 -1
- data/package.json +20 -100
- data/test/controllers/accounts_controller_test.rb +3 -8
- data/test/controllers/uploads_controller_test.rb +0 -13
- data/test/unit/slice_generator_test.rb +2 -45
- data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.fixtures.js +0 -2
- data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.stories.js +5 -14
- data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListActions.js +1 -2
- data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js +0 -8
- data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListSelectors.js +0 -2
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/__tests__/EmptyState.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ErrorState/__tests__/ErrorState.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/__tests__/ListItem.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/__tests__/ListItemStatus.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountList.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListActions.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListIntegration.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListReducer.test.js +1 -12
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListSelectors.test.js +2 -10
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListReducer.test.js.snap +0 -10
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListSelectors.test.js.snap +2 -5
- data/webpack/ForemanInventoryUpload/Components/Dashboard/Dashboard.fixtures.js +13 -9
- data/webpack/ForemanInventoryUpload/Components/Dashboard/Dashboard.stories.js +5 -15
- data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/Dashboard.test.js +1 -2
- data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js +15 -2
- data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardIntegration.test.js +2 -3
- data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardReducer.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardSelectors.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/FileDownload/__tests__/FileDownload.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/FullScreenModal/__tests__/FullScreenModal.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.fixtures.js +5 -2
- data/webpack/ForemanInventoryUpload/Components/NavContainer/__tests__/NavContainer.test.js +1 -2
- data/webpack/ForemanInventoryUpload/Components/NavContainer/__tests__/__snapshots__/NavContainer.test.js.snap +1 -1
- data/webpack/ForemanInventoryUpload/Components/ReportGenerate/__tests__/ReportGenerate.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/ReportUpload/__tests__/ReportUpload.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/ScheduledRun/ScheduledRun.fixtures.js +0 -1
- data/webpack/ForemanInventoryUpload/Components/ScheduledRun/ScheduledRun.js +2 -4
- data/webpack/ForemanInventoryUpload/Components/ScheduledRun/__tests__/ScheduledRun.test.js +2 -1
- data/webpack/ForemanInventoryUpload/Components/ScheduledRun/__tests__/__snapshots__/ScheduledRun.test.js.snap +2 -0
- data/webpack/ForemanInventoryUpload/Components/ScheduledRun/index.js +1 -12
- data/webpack/ForemanInventoryUpload/Components/StatusChart/__tests__/StatusChart.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/TabBody/__tests__/TabBody.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/TabBody/__tests__/__snapshots__/TabBody.test.js.snap +1 -1
- data/webpack/ForemanInventoryUpload/Components/TabContainer/__tests__/TabContainer.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/TabFooter/__tests__/TabFooter.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/TabHeader/__tests__/TabHeader.test.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/Terminal/Terminal.js +1 -1
- data/webpack/ForemanInventoryUpload/Components/Terminal/__tests__/Terminal.test.js +1 -2
- data/webpack/ForemanInventoryUpload/ForemanInventoryUpload.js +4 -5
- data/webpack/ForemanInventoryUpload/ForemanInventoryUpload.test.js +1 -1
- data/webpack/ForemanInventoryUpload/__snapshots__/ForemanInventoryUpload.test.js.snap +5 -6
- metadata +34 -28
- data/app/models/setting/rh_cloud.rb +0 -18
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/AutoUploadSwitcher.fixtures.js +0 -1
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/AutoUploadSwitcher.js +0 -32
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/AutoUploadSwitcherActions.js +0 -27
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/AutoUploadSwitcherConstants.js +0 -2
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/__tests__/AutoUploadSwitcher.test.js +0 -14
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/__tests__/AutoUploadSwitcherActions.test.js +0 -14
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/__tests__/__snapshots__/AutoUploadSwitcher.test.js.snap +0 -38
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/__tests__/__snapshots__/AutoUploadSwitcherActions.test.js.snap +0 -14
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/autoUploadSwitcher.scss +0 -3
- data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/index.js +0 -17
- data/webpack/ForemanInventoryUpload/Components/PageHeader/PageHeader.js +0 -21
- data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/PageHeader.test.js +0 -13
- data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/__snapshots__/PageHeader.test.js.snap +0 -33
- data/webpack/ForemanInventoryUpload/Components/PageHeader/index.js +0 -1
- data/webpack/stories/ForemanInventoryUploadReducers.js +0 -3
- data/webpack/stories/configureStore.js +0 -15
- data/webpack/stories/decorators/index.js +0 -1
- data/webpack/stories/decorators/withCardsDecorator.js +0 -14
- data/webpack/stories/index.js +0 -10
- data/webpack/stories/index.scss +0 -7
- data/webpack/test_setup.js +0 -6
@@ -17,8 +17,6 @@ class ReportGeneratorTest < ActiveSupport::TestCase
|
|
17
17
|
)
|
18
18
|
|
19
19
|
@host.subscription_facet.pools << FactoryBot.create(:katello_pool, account_number: '1234', cp_id: 1)
|
20
|
-
|
21
|
-
ForemanInventoryUpload::Generators::Queries.instance_variable_set(:@fact_names, nil)
|
22
20
|
end
|
23
21
|
|
24
22
|
def interesting_facts
|
@@ -32,11 +30,9 @@ class ReportGeneratorTest < ActiveSupport::TestCase
|
|
32
30
|
'dmi::bios::vendor',
|
33
31
|
'dmi::bios::version',
|
34
32
|
'dmi::bios::relase_date',
|
33
|
+
'distribution::name',
|
35
34
|
'uname::release',
|
36
35
|
'lscpu::flags',
|
37
|
-
'distribution::name',
|
38
|
-
'distribution::version',
|
39
|
-
'distribution::id',
|
40
36
|
]
|
41
37
|
end
|
42
38
|
|
@@ -60,7 +56,6 @@ class ReportGeneratorTest < ActiveSupport::TestCase
|
|
60
56
|
assert_equal @host.name, actual_host['display_name']
|
61
57
|
assert_equal @host.fqdn, actual_host['fqdn']
|
62
58
|
assert_equal '1234', actual_host['account']
|
63
|
-
assert_equal 1, generator.hosts_count
|
64
59
|
end
|
65
60
|
|
66
61
|
test 'generates a report with satellite facts' do
|
@@ -83,7 +78,7 @@ class ReportGeneratorTest < ActiveSupport::TestCase
|
|
83
78
|
|
84
79
|
org_id_tag = actual['hosts'].first['tags'].find { |tag| tag['namespace'] == 'satellite' && tag['key'] == 'organization_id'}
|
85
80
|
assert_not_nil org_id_tag
|
86
|
-
assert_equal @host.organization_id
|
81
|
+
assert_equal @host.organization_id, org_id_tag['value']
|
87
82
|
|
88
83
|
version = satellite_facts['satellite_version']
|
89
84
|
if defined?(ForemanThemeSatellite)
|
@@ -163,7 +158,6 @@ class ReportGeneratorTest < ActiveSupport::TestCase
|
|
163
158
|
assert_equal @host.name, actual_host['display_name']
|
164
159
|
assert_equal @host.fqdn, actual_host['fqdn']
|
165
160
|
assert_equal '1234', actual_host['account']
|
166
|
-
assert_equal 1, generator.hosts_count
|
167
161
|
end
|
168
162
|
|
169
163
|
test 'shows system_memory_bytes in bytes' do
|
@@ -180,41 +174,4 @@ class ReportGeneratorTest < ActiveSupport::TestCase
|
|
180
174
|
assert_not_nil(actual_profile = actual_host['system_profile'])
|
181
175
|
assert_equal 1024, actual_profile['system_memory_bytes']
|
182
176
|
end
|
183
|
-
|
184
|
-
test 'reports an account for hosts with multiple pools' do
|
185
|
-
first_pool = @host.subscription_facet.pools.first
|
186
|
-
second_pool = FactoryBot.create(:katello_pool, account_number: nil, cp_id: 2)
|
187
|
-
@host.subscription_facet.pools = []
|
188
|
-
@host.subscription_facet.save!
|
189
|
-
@host.subscription_facet.pools << first_pool
|
190
|
-
@host.subscription_facet.pools << second_pool
|
191
|
-
|
192
|
-
batch = Host.where(id: @host.id).in_batches.first
|
193
|
-
generator = ForemanInventoryUpload::Generators::Slice.new(batch, [], 'slice_123')
|
194
|
-
|
195
|
-
json_str = generator.render
|
196
|
-
actual = JSON.parse(json_str.join("\n"))
|
197
|
-
|
198
|
-
assert_equal 'slice_123', actual['report_slice_id']
|
199
|
-
assert_not_nil(actual_host = actual['hosts'].first)
|
200
|
-
assert_not_nil(actual_host['account'])
|
201
|
-
assert_not_empty(actual_host['account'])
|
202
|
-
end
|
203
|
-
|
204
|
-
test 'Generates os_release with version and id' do
|
205
|
-
FactoryBot.create(:fact_value, fact_name: fact_names['distribution::name'], value: 'Red Hat Test Linux', host: @host)
|
206
|
-
FactoryBot.create(:fact_value, fact_name: fact_names['distribution::version'], value: '7.1', host: @host)
|
207
|
-
FactoryBot.create(:fact_value, fact_name: fact_names['distribution::id'], value: 'TestId', host: @host)
|
208
|
-
|
209
|
-
batch = Host.where(id: @host.id).in_batches.first
|
210
|
-
generator = ForemanInventoryUpload::Generators::Slice.new(batch, [], 'slice_123')
|
211
|
-
|
212
|
-
json_str = generator.render
|
213
|
-
actual = JSON.parse(json_str.join("\n"))
|
214
|
-
|
215
|
-
assert_equal 'slice_123', actual['report_slice_id']
|
216
|
-
assert_not_nil(actual_host = actual['hosts'].first)
|
217
|
-
assert_not_nil(actual_profile = actual_host['system_profile'])
|
218
|
-
assert_equal 'Red Hat Test Linux 7.1 (TestId)', actual_profile['os_release']
|
219
|
-
end
|
220
177
|
end
|
@@ -1,18 +1,9 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import { storiesOf } from '@storybook/react';
|
3
|
-
import { withKnobs } from '@storybook/addon-knobs';
|
4
|
-
import { Provider } from 'react-redux';
|
5
|
-
import configureStore from '../../../stories/configureStore';
|
6
2
|
import AccountList from './AccountList';
|
7
3
|
|
8
|
-
|
4
|
+
export default {
|
5
|
+
title: 'AccountList',
|
6
|
+
component: AccountList,
|
7
|
+
};
|
9
8
|
|
10
|
-
|
11
|
-
.addDecorator(withKnobs)
|
12
|
-
.add('Account list', () => (
|
13
|
-
<div style={{ margin: '20px' }}>
|
14
|
-
<Provider store={store}>
|
15
|
-
<AccountList />
|
16
|
-
</Provider>
|
17
|
-
</div>
|
18
|
-
));
|
9
|
+
export const Basic = () => <AccountList />;
|
@@ -10,13 +10,12 @@ import {
|
|
10
10
|
export const fetchAccountsStatus = () => async dispatch => {
|
11
11
|
try {
|
12
12
|
const {
|
13
|
-
data: { accounts
|
13
|
+
data: { accounts },
|
14
14
|
} = await API.get('accounts');
|
15
15
|
dispatch({
|
16
16
|
type: INVENTORY_ACCOUNT_STATUS_POLLING,
|
17
17
|
payload: {
|
18
18
|
accounts,
|
19
|
-
autoUploadEnabled,
|
20
19
|
},
|
21
20
|
});
|
22
21
|
} catch (error) {
|
@@ -5,7 +5,6 @@ import {
|
|
5
5
|
INVENTORY_ACCOUNT_STATUS_POLLING_START,
|
6
6
|
INVENTORY_PROCESS_RESTART,
|
7
7
|
} from './AccountListConstants';
|
8
|
-
import { AUTO_UPLOAD_TOGGLE } from '../AutoUploadSwitcher/AutoUploadSwitcherConstants';
|
9
8
|
|
10
9
|
const initialState = Immutable({
|
11
10
|
accounts: {},
|
@@ -21,7 +20,6 @@ export default (state = initialState, action) => {
|
|
21
20
|
accounts,
|
22
21
|
accountID,
|
23
22
|
processStatusName,
|
24
|
-
autoUploadEnabled,
|
25
23
|
} = {},
|
26
24
|
} = action;
|
27
25
|
|
@@ -30,7 +28,6 @@ export default (state = initialState, action) => {
|
|
30
28
|
return state.merge({
|
31
29
|
...state,
|
32
30
|
accounts,
|
33
|
-
autoUploadEnabled,
|
34
31
|
error: null,
|
35
32
|
});
|
36
33
|
case INVENTORY_ACCOUNT_STATUS_POLLING_ERROR:
|
@@ -52,11 +49,6 @@ export default (state = initialState, action) => {
|
|
52
49
|
[processStatusName]: 'Restarting...',
|
53
50
|
},
|
54
51
|
});
|
55
|
-
case AUTO_UPLOAD_TOGGLE:
|
56
|
-
return state.merge({
|
57
|
-
...state,
|
58
|
-
autoUploadEnabled,
|
59
|
-
});
|
60
52
|
default:
|
61
53
|
return state;
|
62
54
|
}
|
@@ -6,5 +6,3 @@ export const selectAccounts = state => selectAccountsList(state).accounts;
|
|
6
6
|
export const selectPollingProcessID = state =>
|
7
7
|
selectAccountsList(state).pollingProcessID;
|
8
8
|
export const selectError = state => selectAccountsList(state).error;
|
9
|
-
export const selectAutoUploadEnabled = state =>
|
10
|
-
selectAccountsList(state).autoUploadEnabled;
|
data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListReducer.test.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { testReducerSnapshotWithFixtures } from '
|
1
|
+
import { testReducerSnapshotWithFixtures } from '@theforeman/test';
|
2
2
|
|
3
3
|
import {
|
4
4
|
INVENTORY_ACCOUNT_STATUS_POLLING,
|
@@ -14,9 +14,7 @@ import {
|
|
14
14
|
pollingProcessID,
|
15
15
|
accountID,
|
16
16
|
processStatusName,
|
17
|
-
autoUploadEnabled,
|
18
17
|
} from '../AccountList.fixtures';
|
19
|
-
import { AUTO_UPLOAD_TOGGLE } from '../../AutoUploadSwitcher/AutoUploadSwitcherConstants';
|
20
18
|
|
21
19
|
const fixtures = {
|
22
20
|
'should return the initial state': {},
|
@@ -25,7 +23,6 @@ const fixtures = {
|
|
25
23
|
type: INVENTORY_ACCOUNT_STATUS_POLLING,
|
26
24
|
payload: {
|
27
25
|
accounts,
|
28
|
-
autoUploadEnabled,
|
29
26
|
},
|
30
27
|
},
|
31
28
|
},
|
@@ -57,14 +54,6 @@ const fixtures = {
|
|
57
54
|
},
|
58
55
|
},
|
59
56
|
},
|
60
|
-
'should handle AUTO_UPLOAD_TOGGLE': {
|
61
|
-
action: {
|
62
|
-
type: AUTO_UPLOAD_TOGGLE,
|
63
|
-
payload: {
|
64
|
-
autoUploadEnabled,
|
65
|
-
},
|
66
|
-
},
|
67
|
-
},
|
68
57
|
};
|
69
58
|
|
70
59
|
describe('AccountList reducer', () =>
|
data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListSelectors.test.js
CHANGED
@@ -1,22 +1,16 @@
|
|
1
|
-
import { testSelectorsSnapshotWithFixtures } from '
|
1
|
+
import { testSelectorsSnapshotWithFixtures } from '@theforeman/test';
|
2
2
|
import {
|
3
3
|
selectAccountsList,
|
4
4
|
selectAccounts,
|
5
5
|
selectPollingProcessID,
|
6
|
-
selectAutoUploadEnabled,
|
7
6
|
} from '../AccountListSelectors';
|
8
|
-
import {
|
9
|
-
pollingProcessID,
|
10
|
-
accounts,
|
11
|
-
autoUploadEnabled,
|
12
|
-
} from '../AccountList.fixtures';
|
7
|
+
import { pollingProcessID, accounts } from '../AccountList.fixtures';
|
13
8
|
|
14
9
|
const state = {
|
15
10
|
ForemanInventoryUpload: {
|
16
11
|
accountsList: {
|
17
12
|
accounts,
|
18
13
|
pollingProcessID,
|
19
|
-
autoUploadEnabled,
|
20
14
|
},
|
21
15
|
},
|
22
16
|
};
|
@@ -26,8 +20,6 @@ const fixtures = {
|
|
26
20
|
'should return AccountList accounts': () => selectAccounts(state),
|
27
21
|
'should return AccountList pollingProcessID': () =>
|
28
22
|
selectPollingProcessID(state),
|
29
|
-
'should return AccountList autoUploadEnabled': () =>
|
30
|
-
selectAutoUploadEnabled(state),
|
31
23
|
};
|
32
24
|
|
33
25
|
describe('AccountList selectors', () =>
|
@@ -1,14 +1,5 @@
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
2
|
|
3
|
-
exports[`AccountList reducer should handle AUTO_UPLOAD_TOGGLE 1`] = `
|
4
|
-
Object {
|
5
|
-
"accounts": Object {},
|
6
|
-
"autoUploadEnabled": true,
|
7
|
-
"error": null,
|
8
|
-
"pollingProcessID": 0,
|
9
|
-
}
|
10
|
-
`;
|
11
|
-
|
12
3
|
exports[`AccountList reducer should handle INVENTORY_ACCOUNT_STATUS_POLLING 1`] = `
|
13
4
|
Object {
|
14
5
|
"accounts": Object {
|
@@ -28,7 +19,6 @@ Object {
|
|
28
19
|
"upload_report_status": "success",
|
29
20
|
},
|
30
21
|
},
|
31
|
-
"autoUploadEnabled": true,
|
32
22
|
"error": null,
|
33
23
|
"pollingProcessID": 0,
|
34
24
|
}
|
@@ -1,5 +1,7 @@
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
2
|
|
3
|
+
exports[`AccountList selectors should return AccountList pollingProcessID 1`] = `0`;
|
4
|
+
|
3
5
|
exports[`AccountList selectors should return AccountList accounts 1`] = `
|
4
6
|
Object {
|
5
7
|
"Account1": Object {
|
@@ -20,10 +22,6 @@ Object {
|
|
20
22
|
}
|
21
23
|
`;
|
22
24
|
|
23
|
-
exports[`AccountList selectors should return AccountList autoUploadEnabled 1`] = `true`;
|
24
|
-
|
25
|
-
exports[`AccountList selectors should return AccountList pollingProcessID 1`] = `0`;
|
26
|
-
|
27
25
|
exports[`AccountList selectors should return AccountsList 1`] = `
|
28
26
|
Object {
|
29
27
|
"accounts": Object {
|
@@ -43,7 +41,6 @@ Object {
|
|
43
41
|
"upload_report_status": "success",
|
44
42
|
},
|
45
43
|
},
|
46
|
-
"autoUploadEnabled": true,
|
47
44
|
"pollingProcessID": 0,
|
48
45
|
}
|
49
46
|
`;
|
@@ -8,16 +8,20 @@ export const completed = 25;
|
|
8
8
|
|
9
9
|
export const error = 'some-error';
|
10
10
|
|
11
|
+
export const generating = {
|
12
|
+
logs,
|
13
|
+
completed,
|
14
|
+
};
|
15
|
+
|
16
|
+
export const uploading = {
|
17
|
+
logs,
|
18
|
+
completed,
|
19
|
+
files,
|
20
|
+
};
|
21
|
+
|
11
22
|
export const inventory = {
|
12
|
-
generating
|
13
|
-
|
14
|
-
completed,
|
15
|
-
},
|
16
|
-
uploading: {
|
17
|
-
logs,
|
18
|
-
completed,
|
19
|
-
files,
|
20
|
-
},
|
23
|
+
generating,
|
24
|
+
uploading,
|
21
25
|
};
|
22
26
|
|
23
27
|
export const accountID = 'some-account-ID';
|
@@ -1,19 +1,9 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import { storiesOf } from '@storybook/react';
|
3
|
-
import { withKnobs } from '@storybook/addon-knobs';
|
4
|
-
import { Provider } from 'react-redux';
|
5
|
-
import configureStore from '../../../stories/configureStore';
|
6
2
|
import Dashboard from './index';
|
7
|
-
import { generating, uploading } from './Dashboard.fixtures';
|
8
3
|
|
9
|
-
|
4
|
+
export default {
|
5
|
+
title: 'Dashboard',
|
6
|
+
component: Dashboard,
|
7
|
+
};
|
10
8
|
|
11
|
-
|
12
|
-
.addDecorator(withKnobs)
|
13
|
-
.add('Dashboard', () => (
|
14
|
-
<div style={{ margin: '20px' }}>
|
15
|
-
<Provider store={store}>
|
16
|
-
<Dashboard generating={generating} uploading={uploading} />
|
17
|
-
</Provider>
|
18
|
-
</div>
|
19
|
-
));
|
9
|
+
export const Basic = () => <Dashboard />;
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import { shallow } from '
|
3
|
-
import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
|
2
|
+
import { shallow, testComponentSnapshotsWithFixtures } from '@theforeman/test';
|
4
3
|
import Dashboard from '../Dashboard';
|
5
4
|
import { props } from '../Dashboard.fixtures';
|
6
5
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { testActionSnapshotWithFixtures } from '
|
1
|
+
import { testActionSnapshotWithFixtures } from '@theforeman/test';
|
2
2
|
import API from 'foremanReact/API';
|
3
3
|
import {
|
4
4
|
startPolling,
|
@@ -36,4 +36,17 @@ const fixtures = {
|
|
36
36
|
runWithGetState({ activeTab: 'reports' }, toggleFullScreen, accountID),
|
37
37
|
};
|
38
38
|
|
39
|
-
describe('Dashboard actions', () =>
|
39
|
+
describe('Dashboard actions', () => {
|
40
|
+
const { location } = window;
|
41
|
+
|
42
|
+
beforeAll(() => {
|
43
|
+
delete window.location;
|
44
|
+
window.location = { href: jest.fn() };
|
45
|
+
});
|
46
|
+
|
47
|
+
afterAll(() => {
|
48
|
+
window.location = location;
|
49
|
+
});
|
50
|
+
|
51
|
+
return testActionSnapshotWithFixtures(fixtures);
|
52
|
+
});
|
data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardIntegration.test.js
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import { IntegrationTestHelper } from '
|
2
|
+
import { IntegrationTestHelper } from '@theforeman/test';
|
3
3
|
|
4
|
-
import Dashboard from '../
|
5
|
-
import reducers from '../../../ForemanInventoryUploadReducers';
|
4
|
+
import Dashboard, { reducers } from '../index';
|
6
5
|
import { accountID } from '../Dashboard.fixtures';
|
7
6
|
|
8
7
|
describe('Dashboard integration test', () => {
|