foreman_rh_cloud 13.0.9 → 13.0.11
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/concerns/inventory_upload/report_actions.rb +8 -1
- data/app/controllers/foreman_inventory_upload/accounts_controller.rb +82 -7
- data/app/controllers/foreman_inventory_upload/api/tasks_controller.rb +110 -0
- data/app/controllers/foreman_inventory_upload/reports_controller.rb +41 -17
- data/app/controllers/foreman_inventory_upload/uploads_controller.rb +0 -9
- data/config/routes.rb +4 -2
- data/db/migrate/20251209163012_drop_task_output_tables.foreman_rh_cloud.rb +24 -0
- data/lib/foreman_inventory_upload/async/generate_all_reports_job.rb +1 -1
- data/lib/foreman_inventory_upload/async/host_inventory_report_job.rb +39 -0
- data/lib/foreman_inventory_upload/async/upload_report_direct_job.rb +28 -57
- data/lib/foreman_rh_cloud/plugin.rb +2 -1
- data/lib/foreman_rh_cloud/version.rb +1 -1
- data/lib/tasks/rh_cloud_inventory.rake +4 -2
- data/package.json +1 -1
- data/test/controllers/accounts_controller_test.rb +10 -11
- data/test/controllers/insights_cloud/api/cloud_request_controller_test.rb +1 -2
- data/test/jobs/host_inventory_report_job_test.rb +161 -97
- data/test/jobs/single_host_report_job_test.rb +36 -54
- data/test/jobs/upload_report_direct_job_test.rb +132 -132
- data/test/unit/rh_cloud_permissions_test.rb +2 -0
- data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.fixtures.js +6 -6
- data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.js +49 -34
- data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListActions.js +2 -2
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/ListItem.fixtures.js +2 -2
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/ListItem.js +15 -9
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/__tests__/__snapshots__/ListItem.test.js.snap +6 -5
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatus.fixtures.js +2 -2
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatus.js +10 -14
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js +9 -4
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/__tests__/__snapshots__/ListItemStatus.test.js.snap +4 -4
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountList.test.js.snap +15 -9
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListActions.test.js.snap +7 -7
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListReducer.test.js.snap +6 -6
- data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListSelectors.test.js.snap +12 -12
- data/webpack/ForemanInventoryUpload/Components/Dashboard/Dashboard.js +36 -132
- data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/Dashboard.test.js +60 -17
- data/webpack/ForemanInventoryUpload/Components/Dashboard/index.js +1 -34
- data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/__snapshots__/integration.test.js.snap +0 -1
- data/webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.js +1 -26
- data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/__snapshots__/PageTitle.test.js.snap +2 -2
- data/webpack/ForemanInventoryUpload/Components/TabHeader/TabHeader.js +22 -9
- data/webpack/ForemanInventoryUpload/Components/TabHeader/__tests__/TabHeader.test.js +67 -4
- data/webpack/ForemanInventoryUpload/Components/TaskHistory/TaskHistory.js +140 -0
- data/webpack/ForemanInventoryUpload/Components/TaskHistory/index.js +1 -0
- data/webpack/ForemanInventoryUpload/Components/TaskHistory/taskHistory.scss +40 -0
- data/webpack/ForemanInventoryUpload/Components/TaskProgress/TaskProgress.js +340 -0
- data/webpack/ForemanInventoryUpload/Components/TaskProgress/index.js +1 -0
- data/webpack/ForemanInventoryUpload/Components/TaskProgress/taskProgress.scss +8 -0
- data/webpack/ForemanInventoryUpload/ForemanInventoryHelpers.js +2 -2
- data/webpack/ForemanInventoryUpload/ForemanInventoryUploadReducers.js +0 -2
- data/webpack/ForemanInventoryUpload/__tests__/__snapshots__/ForemanInventoryHelpers.test.js.snap +1 -1
- data/webpack/ForemanRhCloudPages.js +0 -1
- data/webpack/InsightsCloudSync/Components/RemediationModal/RemediationHelpers.js +1 -2
- data/webpack/InsightsCloudSync/Components/RemediationModal/RemediationModal.js +2 -4
- data/webpack/__mocks__/foremanReact/components/common/dates/RelativeDateTime.js +14 -0
- data/webpack/__tests__/ForemanRhCloudHelpers.test.js +5 -1
- metadata +11 -62
- data/app/models/task_output_line.rb +0 -2
- data/app/models/task_output_status.rb +0 -2
- data/lib/foreman_inventory_upload/async/generate_report_job.rb +0 -61
- data/lib/foreman_inventory_upload/async/progress_output.rb +0 -38
- data/lib/foreman_inventory_upload/async/shell_process.rb +0 -77
- data/test/controllers/reports_controller_test.rb +0 -21
- data/test/controllers/uploads_controller_test.rb +0 -21
- data/test/jobs/generate_report_job_test.rb +0 -146
- data/test/unit/shell_process_job_test.rb +0 -29
- data/webpack/ForemanInventoryUpload/Components/Dashboard/DashboardActions.js +0 -88
- data/webpack/ForemanInventoryUpload/Components/Dashboard/DashboardConstants.js +0 -9
- data/webpack/ForemanInventoryUpload/Components/Dashboard/DashboardReducer.js +0 -68
- data/webpack/ForemanInventoryUpload/Components/Dashboard/DashboardSelectors.js +0 -17
- data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js +0 -51
- data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardIntegration.test.js +0 -17
- data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardReducer.test.js +0 -64
- data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardSelectors.test.js +0 -46
- data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/__snapshots__/Dashboard.test.js.snap +0 -36
- data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/__snapshots__/DashboardActions.test.js.snap +0 -76
- data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/__snapshots__/DashboardReducer.test.js.snap +0 -44
- data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/__snapshots__/DashboardSelectors.test.js.snap +0 -42
- data/webpack/ForemanInventoryUpload/Components/FullScreenModal/FullScreenModal.fixtures.js +0 -0
- data/webpack/ForemanInventoryUpload/Components/FullScreenModal/FullScreenModal.js +0 -55
- data/webpack/ForemanInventoryUpload/Components/FullScreenModal/FullScreenModalHelper.js +0 -0
- data/webpack/ForemanInventoryUpload/Components/FullScreenModal/__tests__/FullScreenModal.test.js +0 -13
- data/webpack/ForemanInventoryUpload/Components/FullScreenModal/__tests__/__snapshots__/FullScreenModal.test.js.snap +0 -65
- data/webpack/ForemanInventoryUpload/Components/FullScreenModal/fullScreenModal.scss +0 -20
- data/webpack/ForemanInventoryUpload/Components/FullScreenModal/index.js +0 -1
- data/webpack/ForemanInventoryUpload/Components/ReportGenerate/ReportGenerate.fixtures.js +0 -18
- data/webpack/ForemanInventoryUpload/Components/ReportGenerate/ReportGenerate.js +0 -65
- data/webpack/ForemanInventoryUpload/Components/ReportGenerate/ReportGenerateHelper.js +0 -0
- data/webpack/ForemanInventoryUpload/Components/ReportGenerate/__tests__/ReportGenerate.test.js +0 -14
- data/webpack/ForemanInventoryUpload/Components/ReportGenerate/__tests__/__snapshots__/ReportGenerate.test.js.snap +0 -47
- data/webpack/ForemanInventoryUpload/Components/ReportGenerate/index.js +0 -1
- data/webpack/ForemanInventoryUpload/Components/ReportGenerate/reportGenerate.scss +0 -0
- data/webpack/ForemanInventoryUpload/Components/ReportUpload/ReportUpload.fixtures.js +0 -18
- data/webpack/ForemanInventoryUpload/Components/ReportUpload/ReportUpload.js +0 -46
- data/webpack/ForemanInventoryUpload/Components/ReportUpload/ReportUploadHelper.js +0 -0
- data/webpack/ForemanInventoryUpload/Components/ReportUpload/__tests__/ReportUpload.test.js +0 -14
- data/webpack/ForemanInventoryUpload/Components/ReportUpload/__tests__/__snapshots__/ReportUpload.test.js.snap +0 -47
- data/webpack/ForemanInventoryUpload/Components/ReportUpload/index.js +0 -1
- data/webpack/ForemanInventoryUpload/Components/ReportUpload/reportUpload.scss +0 -0
- data/webpack/ForemanInventoryUpload/Components/TabBody/TabBody.fixtures.js +0 -0
- data/webpack/ForemanInventoryUpload/Components/TabBody/TabBody.js +0 -31
- data/webpack/ForemanInventoryUpload/Components/TabBody/TabBodyHelper.js +0 -0
- data/webpack/ForemanInventoryUpload/Components/TabBody/__tests__/TabBody.test.js +0 -13
- data/webpack/ForemanInventoryUpload/Components/TabBody/__tests__/__snapshots__/TabBody.test.js.snap +0 -19
- data/webpack/ForemanInventoryUpload/Components/TabBody/index.js +0 -1
- data/webpack/ForemanInventoryUpload/Components/TabBody/tabBody.scss +0 -5
- data/webpack/ForemanInventoryUpload/Components/Terminal/Terminal.fixtures.js +0 -10
- data/webpack/ForemanInventoryUpload/Components/Terminal/Terminal.js +0 -110
- data/webpack/ForemanInventoryUpload/Components/Terminal/TerminalHelper.js +0 -6
- data/webpack/ForemanInventoryUpload/Components/Terminal/__tests__/Terminal.test.js +0 -34
- data/webpack/ForemanInventoryUpload/Components/Terminal/__tests__/__snapshots__/Terminal.test.js.snap +0 -98
- data/webpack/ForemanInventoryUpload/Components/Terminal/index.js +0 -1
- data/webpack/ForemanInventoryUpload/Components/Terminal/terminal.scss +0 -32
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { API } from 'foremanReact/redux/API';
|
|
2
|
-
import { selectActiveTab } from './DashboardSelectors';
|
|
3
|
-
import { inventoryUrl } from '../../ForemanInventoryHelpers';
|
|
4
|
-
import {
|
|
5
|
-
INVENTORY_POLLING_START,
|
|
6
|
-
INVENTORY_POLLING_STOP,
|
|
7
|
-
INVENTORY_POLLING,
|
|
8
|
-
INVENTORY_TAB_CHANGED,
|
|
9
|
-
INVENTORY_POLLING_ERROR,
|
|
10
|
-
INVENTORY_REPORTS_DOWNLOAD,
|
|
11
|
-
INVENTORY_TOGGLE_TERMINAL_FULL_SCREEN,
|
|
12
|
-
} from './DashboardConstants';
|
|
13
|
-
|
|
14
|
-
export const startPolling = (accountID, pollingProcessID) => ({
|
|
15
|
-
type: INVENTORY_POLLING_START,
|
|
16
|
-
payload: {
|
|
17
|
-
accountID,
|
|
18
|
-
pollingProcessID,
|
|
19
|
-
},
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
export const stopPolling = (accountID, pollingProcessID) => dispatch => {
|
|
23
|
-
clearInterval(pollingProcessID);
|
|
24
|
-
dispatch({
|
|
25
|
-
type: INVENTORY_POLLING_STOP,
|
|
26
|
-
payload: {
|
|
27
|
-
accountID,
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export const fetchLogs = accountID => async (dispatch, getState) => {
|
|
33
|
-
const activeTab = selectActiveTab(getState(), accountID);
|
|
34
|
-
try {
|
|
35
|
-
const processController = activeTab === 'uploading' ? 'uploads' : 'reports';
|
|
36
|
-
const {
|
|
37
|
-
data: { output, scheduled },
|
|
38
|
-
} = await API.get(inventoryUrl(`${accountID}/${processController}/last`));
|
|
39
|
-
const outputArray = output.split('\n');
|
|
40
|
-
dispatch({
|
|
41
|
-
type: INVENTORY_POLLING,
|
|
42
|
-
payload: {
|
|
43
|
-
accountID,
|
|
44
|
-
activeTab,
|
|
45
|
-
logs: outputArray,
|
|
46
|
-
scheduled,
|
|
47
|
-
},
|
|
48
|
-
});
|
|
49
|
-
} catch (error) {
|
|
50
|
-
dispatch({
|
|
51
|
-
type: INVENTORY_POLLING_ERROR,
|
|
52
|
-
payload: {
|
|
53
|
-
accountID,
|
|
54
|
-
activeTab,
|
|
55
|
-
error: error.message,
|
|
56
|
-
},
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export const setActiveTab = (accountID, tabName) => ({
|
|
62
|
-
type: INVENTORY_TAB_CHANGED,
|
|
63
|
-
payload: {
|
|
64
|
-
accountID,
|
|
65
|
-
activeTab: tabName,
|
|
66
|
-
},
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
export const downloadReports = accountID => {
|
|
70
|
-
window.open(inventoryUrl(`${accountID}/uploads/file`), '_blank');
|
|
71
|
-
return {
|
|
72
|
-
type: INVENTORY_REPORTS_DOWNLOAD,
|
|
73
|
-
payload: {
|
|
74
|
-
accountID,
|
|
75
|
-
},
|
|
76
|
-
};
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
export const toggleFullScreen = accountID => (dispatch, getState) => {
|
|
80
|
-
const activeTab = selectActiveTab(getState(), accountID);
|
|
81
|
-
dispatch({
|
|
82
|
-
type: INVENTORY_TOGGLE_TERMINAL_FULL_SCREEN,
|
|
83
|
-
payload: {
|
|
84
|
-
activeTab,
|
|
85
|
-
accountID,
|
|
86
|
-
},
|
|
87
|
-
});
|
|
88
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export const INVENTORY_POLLING = 'INVENTORY_POLLING';
|
|
2
|
-
export const INVENTORY_POLLING_START = 'INVENTORY_POLLING_START';
|
|
3
|
-
export const INVENTORY_POLLING_STOP = 'INVENTORY_POLLING_STOP';
|
|
4
|
-
export const INVENTORY_POLLING_ERROR = 'INVENTORY_POLLING_ERROR';
|
|
5
|
-
export const INVENTORY_TAB_CHANGED = 'INVENTORY_TAB_CHANGED';
|
|
6
|
-
export const INVENTORY_REPORTS_DOWNLOAD = 'INVENTORY_REPORTS_DOWNLOAD';
|
|
7
|
-
export const INVENTORY_PROCESS_RESTART = 'INVENTORY_PROCESS_RESTART';
|
|
8
|
-
export const INVENTORY_TOGGLE_TERMINAL_FULL_SCREEN =
|
|
9
|
-
'INVENTORY_TOGGLE_TERMINAL_FULL_SCREEN';
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import Immutable from 'seamless-immutable';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
INVENTORY_POLLING_START,
|
|
5
|
-
INVENTORY_POLLING,
|
|
6
|
-
INVENTORY_TAB_CHANGED,
|
|
7
|
-
INVENTORY_POLLING_ERROR,
|
|
8
|
-
INVENTORY_TOGGLE_TERMINAL_FULL_SCREEN,
|
|
9
|
-
} from './DashboardConstants';
|
|
10
|
-
|
|
11
|
-
const initialState = Immutable({});
|
|
12
|
-
|
|
13
|
-
export default (state = initialState, action) => {
|
|
14
|
-
const {
|
|
15
|
-
payload: {
|
|
16
|
-
accountID,
|
|
17
|
-
pollingProcessID,
|
|
18
|
-
logs,
|
|
19
|
-
error,
|
|
20
|
-
activeTab,
|
|
21
|
-
scheduled,
|
|
22
|
-
} = {},
|
|
23
|
-
} = action;
|
|
24
|
-
|
|
25
|
-
const getTabState = () =>
|
|
26
|
-
state[accountID] ? state[accountID][activeTab] : {};
|
|
27
|
-
switch (action.type) {
|
|
28
|
-
case INVENTORY_POLLING_START:
|
|
29
|
-
return state.setIn([accountID], {
|
|
30
|
-
...state[accountID],
|
|
31
|
-
pollingProcessID,
|
|
32
|
-
activeTab: 'generating',
|
|
33
|
-
});
|
|
34
|
-
case INVENTORY_POLLING:
|
|
35
|
-
return state.setIn([accountID], {
|
|
36
|
-
...state[accountID],
|
|
37
|
-
[activeTab]: {
|
|
38
|
-
...getTabState(),
|
|
39
|
-
logs,
|
|
40
|
-
scheduled,
|
|
41
|
-
error: null,
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
case INVENTORY_TAB_CHANGED:
|
|
45
|
-
return state.setIn([accountID], {
|
|
46
|
-
...state[accountID],
|
|
47
|
-
activeTab,
|
|
48
|
-
});
|
|
49
|
-
case INVENTORY_POLLING_ERROR:
|
|
50
|
-
return state.setIn([accountID], {
|
|
51
|
-
...state[accountID],
|
|
52
|
-
[activeTab]: {
|
|
53
|
-
...getTabState(),
|
|
54
|
-
error,
|
|
55
|
-
},
|
|
56
|
-
});
|
|
57
|
-
case INVENTORY_TOGGLE_TERMINAL_FULL_SCREEN:
|
|
58
|
-
return state.setIn([accountID], {
|
|
59
|
-
...state[accountID],
|
|
60
|
-
[activeTab]: {
|
|
61
|
-
...getTabState(),
|
|
62
|
-
showFullScreen: !state[accountID][activeTab].showFullScreen,
|
|
63
|
-
},
|
|
64
|
-
});
|
|
65
|
-
default:
|
|
66
|
-
return state;
|
|
67
|
-
}
|
|
68
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { selectForemanInventoryUpload } from '../../../ForemanRhCloudSelectors';
|
|
2
|
-
|
|
3
|
-
export const selectDashboard = (state, accountID) =>
|
|
4
|
-
selectForemanInventoryUpload(state).dashboard[accountID] || {};
|
|
5
|
-
export const selectUploading = (state, accountID) =>
|
|
6
|
-
selectDashboard(state, accountID).uploading;
|
|
7
|
-
export const selectGenerating = (state, accountID) =>
|
|
8
|
-
selectDashboard(state, accountID).generating;
|
|
9
|
-
export const selectPollingProcessID = (state, accountID) =>
|
|
10
|
-
selectDashboard(state, accountID).pollingProcessID;
|
|
11
|
-
export const selectActiveTab = (state, accountID) =>
|
|
12
|
-
selectDashboard(state, accountID).activeTab || 'generating';
|
|
13
|
-
export const selectShowFullScreen = (state, accountID) => {
|
|
14
|
-
const activeTab = selectActiveTab(state, accountID);
|
|
15
|
-
const tabProperties = selectDashboard(state, accountID)[activeTab];
|
|
16
|
-
return tabProperties ? tabProperties.showFullScreen || false : false;
|
|
17
|
-
};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { testActionSnapshotWithFixtures } from '@theforeman/test';
|
|
2
|
-
import { API } from 'foremanReact/redux/API';
|
|
3
|
-
import {
|
|
4
|
-
startPolling,
|
|
5
|
-
stopPolling,
|
|
6
|
-
fetchLogs,
|
|
7
|
-
setActiveTab,
|
|
8
|
-
downloadReports,
|
|
9
|
-
toggleFullScreen,
|
|
10
|
-
} from '../DashboardActions';
|
|
11
|
-
import {
|
|
12
|
-
pollingProcessID,
|
|
13
|
-
serverMock,
|
|
14
|
-
activeTab,
|
|
15
|
-
accountID,
|
|
16
|
-
} from '../Dashboard.fixtures';
|
|
17
|
-
import { rhCloudStateWrapper } from '../../../../ForemanRhCloudTestHelpers';
|
|
18
|
-
|
|
19
|
-
jest.mock('foremanReact/redux/API');
|
|
20
|
-
API.get.mockImplementation(() => serverMock);
|
|
21
|
-
|
|
22
|
-
const runWithGetState = (state, action, params) => dispatch => {
|
|
23
|
-
const getState = () => rhCloudStateWrapper({ dashboard: state });
|
|
24
|
-
action(params)(dispatch, getState);
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const fixtures = {
|
|
28
|
-
'should startPolling': () => startPolling(accountID, pollingProcessID),
|
|
29
|
-
'should fetchLogs': () =>
|
|
30
|
-
runWithGetState({ activeTab: 'uploads' }, fetchLogs, accountID),
|
|
31
|
-
'should stopPolling': () => stopPolling(accountID, pollingProcessID),
|
|
32
|
-
'should setActiveTab': () => setActiveTab(accountID, activeTab),
|
|
33
|
-
'should downloadReports': () => downloadReports(accountID),
|
|
34
|
-
'should toggleFullScreen': () =>
|
|
35
|
-
runWithGetState({ activeTab: 'reports' }, toggleFullScreen, accountID),
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
describe('Dashboard actions', () => {
|
|
39
|
-
const { open } = window;
|
|
40
|
-
|
|
41
|
-
beforeAll(() => {
|
|
42
|
-
delete window.open;
|
|
43
|
-
window.open = jest.fn();
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
afterAll(() => {
|
|
47
|
-
window.open = open;
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
return testActionSnapshotWithFixtures(fixtures);
|
|
51
|
-
});
|
data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardIntegration.test.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { IntegrationTestHelper } from '@theforeman/test';
|
|
3
|
-
|
|
4
|
-
import Dashboard from '../Dashboard';
|
|
5
|
-
import reducers from '../../../../ForemanRhCloudReducers';
|
|
6
|
-
import { accountID } from '../Dashboard.fixtures';
|
|
7
|
-
|
|
8
|
-
describe('Dashboard integration test', () => {
|
|
9
|
-
it('should flow', async () => {
|
|
10
|
-
const integrationTestHelper = new IntegrationTestHelper(reducers);
|
|
11
|
-
const component = integrationTestHelper.mount(
|
|
12
|
-
<Dashboard accountID={accountID} />
|
|
13
|
-
);
|
|
14
|
-
component.update();
|
|
15
|
-
/** Create a Flow test */
|
|
16
|
-
});
|
|
17
|
-
});
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { testReducerSnapshotWithFixtures } from '@theforeman/test';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
INVENTORY_POLLING_START,
|
|
5
|
-
INVENTORY_POLLING,
|
|
6
|
-
INVENTORY_TAB_CHANGED,
|
|
7
|
-
INVENTORY_POLLING_ERROR,
|
|
8
|
-
} from '../DashboardConstants';
|
|
9
|
-
import reducer from '../DashboardReducer';
|
|
10
|
-
import {
|
|
11
|
-
pollingProcessID,
|
|
12
|
-
logs,
|
|
13
|
-
initialState,
|
|
14
|
-
activeTab,
|
|
15
|
-
error,
|
|
16
|
-
accountID,
|
|
17
|
-
scheduled,
|
|
18
|
-
} from '../Dashboard.fixtures';
|
|
19
|
-
|
|
20
|
-
const fixtures = {
|
|
21
|
-
'should return the initial state': initialState,
|
|
22
|
-
'should handle INVENTORY_POLLING_START': {
|
|
23
|
-
action: {
|
|
24
|
-
type: INVENTORY_POLLING_START,
|
|
25
|
-
payload: {
|
|
26
|
-
pollingProcessID,
|
|
27
|
-
accountID,
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
'should handle INVENTORY_POLLING': {
|
|
32
|
-
action: {
|
|
33
|
-
type: INVENTORY_POLLING,
|
|
34
|
-
payload: {
|
|
35
|
-
logs,
|
|
36
|
-
accountID,
|
|
37
|
-
activeTab,
|
|
38
|
-
scheduled,
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
'should handle INVENTORY_TAB_CHANGED': {
|
|
43
|
-
action: {
|
|
44
|
-
type: INVENTORY_TAB_CHANGED,
|
|
45
|
-
payload: {
|
|
46
|
-
activeTab,
|
|
47
|
-
accountID,
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
'should handle INVENTORY_POLLING_ERROR': {
|
|
52
|
-
action: {
|
|
53
|
-
type: INVENTORY_POLLING_ERROR,
|
|
54
|
-
payload: {
|
|
55
|
-
error,
|
|
56
|
-
accountID,
|
|
57
|
-
activeTab,
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
describe('Dashboard reducer', () =>
|
|
64
|
-
testReducerSnapshotWithFixtures(reducer, fixtures));
|
data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardSelectors.test.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { testSelectorsSnapshotWithFixtures } from '@theforeman/test';
|
|
2
|
-
import {
|
|
3
|
-
selectDashboard,
|
|
4
|
-
selectPollingProcessID,
|
|
5
|
-
selectActiveTab,
|
|
6
|
-
selectUploading,
|
|
7
|
-
selectGenerating,
|
|
8
|
-
} from '../DashboardSelectors';
|
|
9
|
-
import {
|
|
10
|
-
logs,
|
|
11
|
-
completed,
|
|
12
|
-
pollingProcessID,
|
|
13
|
-
activeTab,
|
|
14
|
-
accountID,
|
|
15
|
-
} from '../Dashboard.fixtures';
|
|
16
|
-
import { rhCloudStateWrapper } from '../../../../ForemanRhCloudTestHelpers';
|
|
17
|
-
|
|
18
|
-
const state = rhCloudStateWrapper({
|
|
19
|
-
dashboard: {
|
|
20
|
-
[accountID]: {
|
|
21
|
-
generating: {
|
|
22
|
-
logs,
|
|
23
|
-
completed,
|
|
24
|
-
},
|
|
25
|
-
uploading: {
|
|
26
|
-
logs,
|
|
27
|
-
completed,
|
|
28
|
-
},
|
|
29
|
-
activeTab,
|
|
30
|
-
pollingProcessID,
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
const fixtures = {
|
|
36
|
-
'should return Dashboard': () => selectDashboard(state, accountID),
|
|
37
|
-
'should return Dashboard uploading': () => selectUploading(state, accountID),
|
|
38
|
-
'should return Dashboard generating': () =>
|
|
39
|
-
selectGenerating(state, accountID),
|
|
40
|
-
'should return Dashboard pollingProcessID': () =>
|
|
41
|
-
selectPollingProcessID(state, accountID),
|
|
42
|
-
'should return Dashboard activeTab': () => selectActiveTab(state, accountID),
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
describe('Dashboard selectors', () =>
|
|
46
|
-
testSelectorsSnapshotWithFixtures(fixtures));
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`Dashboard rendering with props 1`] = `
|
|
4
|
-
<NavContainer
|
|
5
|
-
items={
|
|
6
|
-
Array [
|
|
7
|
-
Object {
|
|
8
|
-
"component": [Function],
|
|
9
|
-
"icon": "database",
|
|
10
|
-
"name": "Generating",
|
|
11
|
-
"onClick": [Function],
|
|
12
|
-
"props": Object {
|
|
13
|
-
"downloadButtonDisabled": [Function],
|
|
14
|
-
"downloadReports": [Function],
|
|
15
|
-
"exitCode": "unknown",
|
|
16
|
-
"restartProcess": [Function],
|
|
17
|
-
"toggleFullScreen": [Function],
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
Object {
|
|
21
|
-
"component": [Function],
|
|
22
|
-
"icon": "cloud-upload",
|
|
23
|
-
"name": "Uploading",
|
|
24
|
-
"onClick": [Function],
|
|
25
|
-
"props": Object {
|
|
26
|
-
"exitCode": "unknown",
|
|
27
|
-
"toggleFullScreen": [Function],
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
]
|
|
31
|
-
}
|
|
32
|
-
showFullScreen={false}
|
|
33
|
-
terminalProps={Object {}}
|
|
34
|
-
toggleFullScreen={[Function]}
|
|
35
|
-
/>
|
|
36
|
-
`;
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`Dashboard actions should downloadReports 1`] = `
|
|
4
|
-
Object {
|
|
5
|
-
"payload": Object {
|
|
6
|
-
"accountID": "some-account-ID",
|
|
7
|
-
},
|
|
8
|
-
"type": "INVENTORY_REPORTS_DOWNLOAD",
|
|
9
|
-
}
|
|
10
|
-
`;
|
|
11
|
-
|
|
12
|
-
exports[`Dashboard actions should fetchLogs 1`] = `
|
|
13
|
-
Array [
|
|
14
|
-
Array [
|
|
15
|
-
Object {
|
|
16
|
-
"payload": Object {
|
|
17
|
-
"accountID": "some-account-ID",
|
|
18
|
-
"activeTab": "generating",
|
|
19
|
-
"logs": Array [
|
|
20
|
-
"some-logs",
|
|
21
|
-
"some-logs",
|
|
22
|
-
],
|
|
23
|
-
"scheduled": "2019-08-21T16:14:16.520+03:00",
|
|
24
|
-
},
|
|
25
|
-
"type": "INVENTORY_POLLING",
|
|
26
|
-
},
|
|
27
|
-
],
|
|
28
|
-
]
|
|
29
|
-
`;
|
|
30
|
-
|
|
31
|
-
exports[`Dashboard actions should setActiveTab 1`] = `
|
|
32
|
-
Object {
|
|
33
|
-
"payload": Object {
|
|
34
|
-
"accountID": "some-account-ID",
|
|
35
|
-
"activeTab": "uploads",
|
|
36
|
-
},
|
|
37
|
-
"type": "INVENTORY_TAB_CHANGED",
|
|
38
|
-
}
|
|
39
|
-
`;
|
|
40
|
-
|
|
41
|
-
exports[`Dashboard actions should startPolling 1`] = `
|
|
42
|
-
Object {
|
|
43
|
-
"payload": Object {
|
|
44
|
-
"accountID": "some-account-ID",
|
|
45
|
-
"pollingProcessID": 1,
|
|
46
|
-
},
|
|
47
|
-
"type": "INVENTORY_POLLING_START",
|
|
48
|
-
}
|
|
49
|
-
`;
|
|
50
|
-
|
|
51
|
-
exports[`Dashboard actions should stopPolling 1`] = `
|
|
52
|
-
Array [
|
|
53
|
-
Array [
|
|
54
|
-
Object {
|
|
55
|
-
"payload": Object {
|
|
56
|
-
"accountID": "some-account-ID",
|
|
57
|
-
},
|
|
58
|
-
"type": "INVENTORY_POLLING_STOP",
|
|
59
|
-
},
|
|
60
|
-
],
|
|
61
|
-
]
|
|
62
|
-
`;
|
|
63
|
-
|
|
64
|
-
exports[`Dashboard actions should toggleFullScreen 1`] = `
|
|
65
|
-
Array [
|
|
66
|
-
Array [
|
|
67
|
-
Object {
|
|
68
|
-
"payload": Object {
|
|
69
|
-
"accountID": "some-account-ID",
|
|
70
|
-
"activeTab": "generating",
|
|
71
|
-
},
|
|
72
|
-
"type": "INVENTORY_TOGGLE_TERMINAL_FULL_SCREEN",
|
|
73
|
-
},
|
|
74
|
-
],
|
|
75
|
-
]
|
|
76
|
-
`;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`Dashboard reducer should handle INVENTORY_POLLING 1`] = `
|
|
4
|
-
Object {
|
|
5
|
-
"some-account-ID": Object {
|
|
6
|
-
"uploads": Object {
|
|
7
|
-
"error": null,
|
|
8
|
-
"logs": Array [
|
|
9
|
-
"some-logs...",
|
|
10
|
-
],
|
|
11
|
-
"scheduled": "2019-08-21T16:14:16.520+03:00",
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
}
|
|
15
|
-
`;
|
|
16
|
-
|
|
17
|
-
exports[`Dashboard reducer should handle INVENTORY_POLLING_ERROR 1`] = `
|
|
18
|
-
Object {
|
|
19
|
-
"some-account-ID": Object {
|
|
20
|
-
"uploads": Object {
|
|
21
|
-
"error": "some-error",
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
}
|
|
25
|
-
`;
|
|
26
|
-
|
|
27
|
-
exports[`Dashboard reducer should handle INVENTORY_POLLING_START 1`] = `
|
|
28
|
-
Object {
|
|
29
|
-
"some-account-ID": Object {
|
|
30
|
-
"activeTab": "generating",
|
|
31
|
-
"pollingProcessID": 1,
|
|
32
|
-
},
|
|
33
|
-
}
|
|
34
|
-
`;
|
|
35
|
-
|
|
36
|
-
exports[`Dashboard reducer should handle INVENTORY_TAB_CHANGED 1`] = `
|
|
37
|
-
Object {
|
|
38
|
-
"some-account-ID": Object {
|
|
39
|
-
"activeTab": "uploads",
|
|
40
|
-
},
|
|
41
|
-
}
|
|
42
|
-
`;
|
|
43
|
-
|
|
44
|
-
exports[`Dashboard reducer should return the initial state 1`] = `Object {}`;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`Dashboard selectors should return Dashboard 1`] = `
|
|
4
|
-
Object {
|
|
5
|
-
"activeTab": "uploads",
|
|
6
|
-
"generating": Object {
|
|
7
|
-
"completed": 25,
|
|
8
|
-
"logs": Array [
|
|
9
|
-
"some-logs...",
|
|
10
|
-
],
|
|
11
|
-
},
|
|
12
|
-
"pollingProcessID": 1,
|
|
13
|
-
"uploading": Object {
|
|
14
|
-
"completed": 25,
|
|
15
|
-
"logs": Array [
|
|
16
|
-
"some-logs...",
|
|
17
|
-
],
|
|
18
|
-
},
|
|
19
|
-
}
|
|
20
|
-
`;
|
|
21
|
-
|
|
22
|
-
exports[`Dashboard selectors should return Dashboard activeTab 1`] = `"uploads"`;
|
|
23
|
-
|
|
24
|
-
exports[`Dashboard selectors should return Dashboard generating 1`] = `
|
|
25
|
-
Object {
|
|
26
|
-
"completed": 25,
|
|
27
|
-
"logs": Array [
|
|
28
|
-
"some-logs...",
|
|
29
|
-
],
|
|
30
|
-
}
|
|
31
|
-
`;
|
|
32
|
-
|
|
33
|
-
exports[`Dashboard selectors should return Dashboard pollingProcessID 1`] = `1`;
|
|
34
|
-
|
|
35
|
-
exports[`Dashboard selectors should return Dashboard uploading 1`] = `
|
|
36
|
-
Object {
|
|
37
|
-
"completed": 25,
|
|
38
|
-
"logs": Array [
|
|
39
|
-
"some-logs...",
|
|
40
|
-
],
|
|
41
|
-
}
|
|
42
|
-
`;
|
|
File without changes
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { Modal, Icon } from 'patternfly-react';
|
|
4
|
-
import { noop } from 'foremanReact/common/helpers';
|
|
5
|
-
import { translate as __ } from 'foremanReact/common/I18n';
|
|
6
|
-
import Terminal from '../Terminal';
|
|
7
|
-
import './fullScreenModal.scss';
|
|
8
|
-
|
|
9
|
-
const FullScreenModal = ({
|
|
10
|
-
showFullScreen,
|
|
11
|
-
toggleFullScreen,
|
|
12
|
-
terminalProps,
|
|
13
|
-
}) => (
|
|
14
|
-
<Modal
|
|
15
|
-
id="rh-cloud-inventory-full-screen-terminal"
|
|
16
|
-
show={showFullScreen}
|
|
17
|
-
onHide={toggleFullScreen}
|
|
18
|
-
>
|
|
19
|
-
<Modal.Header>
|
|
20
|
-
<button
|
|
21
|
-
className="close"
|
|
22
|
-
onClick={toggleFullScreen}
|
|
23
|
-
aria-hidden="true"
|
|
24
|
-
aria-label="Close"
|
|
25
|
-
>
|
|
26
|
-
<Icon type="pf" name="close" />
|
|
27
|
-
</button>
|
|
28
|
-
<Modal.Title>{__('Full Screen')}</Modal.Title>
|
|
29
|
-
</Modal.Header>
|
|
30
|
-
<Modal.Body>
|
|
31
|
-
<Terminal autoScroll={false} {...terminalProps} />
|
|
32
|
-
</Modal.Body>
|
|
33
|
-
</Modal>
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
FullScreenModal.propTypes = {
|
|
37
|
-
showFullScreen: PropTypes.bool,
|
|
38
|
-
toggleFullScreen: PropTypes.func,
|
|
39
|
-
terminalProps: PropTypes.shape({
|
|
40
|
-
exitCode: PropTypes.string,
|
|
41
|
-
logs: PropTypes.oneOfType([
|
|
42
|
-
PropTypes.arrayOf(PropTypes.string),
|
|
43
|
-
PropTypes.string,
|
|
44
|
-
]),
|
|
45
|
-
error: PropTypes.string,
|
|
46
|
-
}),
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
FullScreenModal.defaultProps = {
|
|
50
|
-
showFullScreen: false,
|
|
51
|
-
toggleFullScreen: noop,
|
|
52
|
-
terminalProps: {},
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export default FullScreenModal;
|
|
File without changes
|
data/webpack/ForemanInventoryUpload/Components/FullScreenModal/__tests__/FullScreenModal.test.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
|
|
2
|
-
|
|
3
|
-
import FullScreenModal from '../FullScreenModal';
|
|
4
|
-
|
|
5
|
-
const fixtures = {
|
|
6
|
-
'render without Props': {},
|
|
7
|
-
/** fixtures, props for the component */
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
describe('FullScreenModal', () => {
|
|
11
|
-
describe('rendering', () =>
|
|
12
|
-
testComponentSnapshotsWithFixtures(FullScreenModal, fixtures));
|
|
13
|
-
});
|