foreman_rh_cloud 13.0.8 → 13.0.10
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/queue_for_upload_job.rb +1 -23
- data/lib/foreman_inventory_upload/async/upload_report_direct_job.rb +171 -0
- data/lib/foreman_inventory_upload.rb +0 -4
- data/lib/foreman_rh_cloud/plugin.rb +1 -0
- data/lib/foreman_rh_cloud/version.rb +1 -1
- data/lib/inventory_sync/async/inventory_hosts_sync.rb +0 -2
- 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/queue_for_upload_job_test.rb +1 -12
- data/test/jobs/single_host_report_job_test.rb +36 -54
- data/test/jobs/upload_report_direct_job_test.rb +399 -0
- 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 +4 -5
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/ListItem.js +15 -7
- data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/__tests__/__snapshots__/ListItem.test.js.snap +11 -11
- 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 +37 -130
- 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/PageHeader.js +24 -17
- data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/PageHeader.test.js +178 -8
- data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/__snapshots__/PageTitle.test.js.snap +2 -2
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/ToolbarButtons/ToolbarButtons.js +3 -1
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/ToolbarButtons/__tests__/ToolbarButtons.test.js +69 -51
- 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/InsightsTable/__tests__/InsightsTable.test.js +11 -19
- data/webpack/InsightsCloudSync/Components/RemediationModal/RemediationHelpers.js +1 -2
- data/webpack/InsightsCloudSync/Components/RemediationModal/RemediationModal.js +2 -4
- data/webpack/InsightsVulnerabilityHostIndexExtensions/__tests__/CVECountCell.test.js +77 -22
- data/webpack/__mocks__/foremanReact/components/common/dates/RelativeDateTime.js +14 -0
- data/webpack/__tests__/ForemanRhCloudHelpers.test.js +5 -1
- metadata +13 -68
- 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/lib/foreman_inventory_upload/async/upload_report_job.rb +0 -97
- data/lib/foreman_inventory_upload/scripts/uploader.sh.erb +0 -55
- 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/jobs/upload_report_job_test.rb +0 -38
- 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/PageHeader/__tests__/__snapshots__/PageHeader.test.js.snap +0 -36
- 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
- data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/__snapshots__/InsightsTable.test.js.snap +0 -112
- data/webpack/__mocks__/foremanReact/common/hooks/API/APIHooks.js +0 -3
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { noop } from 'foremanReact/common/helpers';
|
|
4
|
-
import TabContainer from '../TabContainer';
|
|
5
|
-
import TabHeader from '../TabHeader';
|
|
6
|
-
import TabBody from '../TabBody';
|
|
7
|
-
import './reportUpload.scss';
|
|
8
|
-
|
|
9
|
-
const ReportUpload = ({
|
|
10
|
-
exitCode,
|
|
11
|
-
logs,
|
|
12
|
-
completed,
|
|
13
|
-
error,
|
|
14
|
-
toggleFullScreen,
|
|
15
|
-
}) => (
|
|
16
|
-
<TabContainer className="report-upload">
|
|
17
|
-
<TabHeader exitCode={exitCode} toggleFullScreen={toggleFullScreen} />
|
|
18
|
-
<TabBody
|
|
19
|
-
exitCode={exitCode}
|
|
20
|
-
logs={logs}
|
|
21
|
-
completed={completed}
|
|
22
|
-
error={error}
|
|
23
|
-
/>
|
|
24
|
-
</TabContainer>
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
ReportUpload.propTypes = {
|
|
28
|
-
exitCode: PropTypes.string,
|
|
29
|
-
logs: PropTypes.oneOfType([
|
|
30
|
-
PropTypes.arrayOf(PropTypes.string),
|
|
31
|
-
PropTypes.string,
|
|
32
|
-
]),
|
|
33
|
-
completed: PropTypes.number,
|
|
34
|
-
error: PropTypes.string,
|
|
35
|
-
toggleFullScreen: PropTypes.func,
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
ReportUpload.defaultProps = {
|
|
39
|
-
exitCode: '',
|
|
40
|
-
logs: null,
|
|
41
|
-
completed: 0,
|
|
42
|
-
error: null,
|
|
43
|
-
toggleFullScreen: noop,
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export default ReportUpload;
|
|
File without changes
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
|
|
2
|
-
|
|
3
|
-
import ReportUpload from '../ReportUpload';
|
|
4
|
-
import { props } from '../ReportUpload.fixtures';
|
|
5
|
-
|
|
6
|
-
const fixtures = {
|
|
7
|
-
'render without Props': {},
|
|
8
|
-
'render with Props': props,
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
describe('ReportUpload', () => {
|
|
12
|
-
describe('rendering', () =>
|
|
13
|
-
testComponentSnapshotsWithFixtures(ReportUpload, fixtures));
|
|
14
|
-
});
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`ReportUpload rendering render with Props 1`] = `
|
|
4
|
-
<TabContainer
|
|
5
|
-
className="report-upload"
|
|
6
|
-
>
|
|
7
|
-
<TabHeader
|
|
8
|
-
downloadButtonDisabled={[Function]}
|
|
9
|
-
exitCode="exit 0"
|
|
10
|
-
onDownload={null}
|
|
11
|
-
onRestart={null}
|
|
12
|
-
toggleFullScreen={[Function]}
|
|
13
|
-
/>
|
|
14
|
-
<TabBody
|
|
15
|
-
completed={0}
|
|
16
|
-
error={null}
|
|
17
|
-
exitCode="exit 0"
|
|
18
|
-
logs={
|
|
19
|
-
Array [
|
|
20
|
-
"No running process",
|
|
21
|
-
]
|
|
22
|
-
}
|
|
23
|
-
scheduled={null}
|
|
24
|
-
/>
|
|
25
|
-
</TabContainer>
|
|
26
|
-
`;
|
|
27
|
-
|
|
28
|
-
exports[`ReportUpload rendering render without Props 1`] = `
|
|
29
|
-
<TabContainer
|
|
30
|
-
className="report-upload"
|
|
31
|
-
>
|
|
32
|
-
<TabHeader
|
|
33
|
-
downloadButtonDisabled={[Function]}
|
|
34
|
-
exitCode=""
|
|
35
|
-
onDownload={null}
|
|
36
|
-
onRestart={null}
|
|
37
|
-
toggleFullScreen={[Function]}
|
|
38
|
-
/>
|
|
39
|
-
<TabBody
|
|
40
|
-
completed={0}
|
|
41
|
-
error={null}
|
|
42
|
-
exitCode=""
|
|
43
|
-
logs={null}
|
|
44
|
-
scheduled={null}
|
|
45
|
-
/>
|
|
46
|
-
</TabContainer>
|
|
47
|
-
`;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './ReportUpload';
|
|
File without changes
|
|
File without changes
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { Grid } from 'patternfly-react';
|
|
4
|
-
import Terminal from '../Terminal';
|
|
5
|
-
import ScheduledRun from '../ScheduledRun';
|
|
6
|
-
import './tabBody.scss';
|
|
7
|
-
|
|
8
|
-
const TabBody = ({ exitCode, logs, error, scheduled }) => (
|
|
9
|
-
<Grid.Row className="tab_body">
|
|
10
|
-
<Terminal logs={logs} exitCode={exitCode} error={error} />
|
|
11
|
-
<ScheduledRun date={scheduled} />
|
|
12
|
-
</Grid.Row>
|
|
13
|
-
);
|
|
14
|
-
|
|
15
|
-
TabBody.propTypes = {
|
|
16
|
-
exitCode: PropTypes.string,
|
|
17
|
-
logs: PropTypes.oneOfType([
|
|
18
|
-
PropTypes.arrayOf(PropTypes.string),
|
|
19
|
-
PropTypes.string,
|
|
20
|
-
]),
|
|
21
|
-
error: PropTypes.string,
|
|
22
|
-
scheduled: PropTypes.string,
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
TabBody.defaultProps = {
|
|
26
|
-
exitCode: '',
|
|
27
|
-
logs: null,
|
|
28
|
-
error: null,
|
|
29
|
-
scheduled: null,
|
|
30
|
-
};
|
|
31
|
-
export default TabBody;
|
|
File without changes
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
|
|
2
|
-
|
|
3
|
-
import TabBody from '../TabBody';
|
|
4
|
-
|
|
5
|
-
const fixtures = {
|
|
6
|
-
'render without Props': {},
|
|
7
|
-
/** fixtures, props for the component */
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
describe('TabBody', () => {
|
|
11
|
-
describe('rendering', () =>
|
|
12
|
-
testComponentSnapshotsWithFixtures(TabBody, fixtures));
|
|
13
|
-
});
|
data/webpack/ForemanInventoryUpload/Components/TabBody/__tests__/__snapshots__/TabBody.test.js.snap
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`TabBody rendering render without Props 1`] = `
|
|
4
|
-
<Row
|
|
5
|
-
bsClass="row"
|
|
6
|
-
className="tab_body"
|
|
7
|
-
componentClass="div"
|
|
8
|
-
>
|
|
9
|
-
<Terminal
|
|
10
|
-
autoScroll={true}
|
|
11
|
-
error={null}
|
|
12
|
-
exitCode=""
|
|
13
|
-
logs={null}
|
|
14
|
-
/>
|
|
15
|
-
<Connect(ScheduledRun)
|
|
16
|
-
date={null}
|
|
17
|
-
/>
|
|
18
|
-
</Row>
|
|
19
|
-
`;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './TabBody';
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { Grid, Spinner } from 'patternfly-react';
|
|
4
|
-
import { isEqual } from 'lodash';
|
|
5
|
-
import './terminal.scss';
|
|
6
|
-
import { isTerminalScrolledDown } from './TerminalHelper';
|
|
7
|
-
import { isExitCodeLoading } from '../../ForemanInventoryHelpers';
|
|
8
|
-
|
|
9
|
-
class Terminal extends React.Component {
|
|
10
|
-
constructor(props) {
|
|
11
|
-
super(props);
|
|
12
|
-
this.terminal = React.createRef();
|
|
13
|
-
this.state = {
|
|
14
|
-
didUserScroll: false,
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
componentDidMount() {
|
|
19
|
-
this.scrollBottom();
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
componentDidUpdate({ logs: prevLogs }) {
|
|
23
|
-
const { logs: currentLogs, autoScroll } = this.props;
|
|
24
|
-
const { didUserScroll } = this.state;
|
|
25
|
-
if (autoScroll && !didUserScroll && !isEqual(prevLogs, currentLogs)) {
|
|
26
|
-
this.scrollBottom();
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
handleScroll = e => {
|
|
31
|
-
const { scrollTop, scrollHeight, offsetHeight } = e.target;
|
|
32
|
-
const didUserScroll = isTerminalScrolledDown(
|
|
33
|
-
scrollHeight,
|
|
34
|
-
scrollTop,
|
|
35
|
-
offsetHeight,
|
|
36
|
-
100
|
|
37
|
-
);
|
|
38
|
-
this.setState({
|
|
39
|
-
didUserScroll,
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
scrollBottom = () => {
|
|
44
|
-
const element = this.terminal.current;
|
|
45
|
-
if (!element) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
const setHeightToBottom = () => {
|
|
49
|
-
element.scrollTop = element.scrollHeight;
|
|
50
|
-
};
|
|
51
|
-
/** happens on tab switching when the terminal wasn't visible yet
|
|
52
|
-
* and there was nothing to scroll, 250ms is enough to wait for the terminal to appear.
|
|
53
|
-
*/
|
|
54
|
-
if (element.scrollHeight === 0) {
|
|
55
|
-
setTimeout(setHeightToBottom, 250);
|
|
56
|
-
} else {
|
|
57
|
-
setHeightToBottom();
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
render() {
|
|
62
|
-
const { logs, error, exitCode } = this.props;
|
|
63
|
-
let modifiedLogs = null;
|
|
64
|
-
if (error !== null) {
|
|
65
|
-
modifiedLogs = <p className="terminal_error">{error}</p>;
|
|
66
|
-
} else if (Array.isArray(logs)) {
|
|
67
|
-
modifiedLogs = logs.map((log, index) => <p key={index}>{log}</p>);
|
|
68
|
-
} else {
|
|
69
|
-
modifiedLogs = <p>{logs}</p>;
|
|
70
|
-
}
|
|
71
|
-
const loading = isExitCodeLoading(exitCode);
|
|
72
|
-
return (
|
|
73
|
-
<Grid.Col sm={12}>
|
|
74
|
-
<div
|
|
75
|
-
className="rh-cloud-inventory-terminal"
|
|
76
|
-
ref={this.terminal}
|
|
77
|
-
onScroll={this.handleScroll}
|
|
78
|
-
>
|
|
79
|
-
<Grid fluid>
|
|
80
|
-
<Grid.Row>
|
|
81
|
-
<Grid.Col sm={12}>
|
|
82
|
-
{modifiedLogs}
|
|
83
|
-
<Spinner loading={loading} inverse inline size="xs" />
|
|
84
|
-
</Grid.Col>
|
|
85
|
-
</Grid.Row>
|
|
86
|
-
</Grid>
|
|
87
|
-
</div>
|
|
88
|
-
</Grid.Col>
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
Terminal.propTypes = {
|
|
94
|
-
logs: PropTypes.oneOfType([
|
|
95
|
-
PropTypes.arrayOf(PropTypes.string),
|
|
96
|
-
PropTypes.string,
|
|
97
|
-
]),
|
|
98
|
-
error: PropTypes.string,
|
|
99
|
-
exitCode: PropTypes.string,
|
|
100
|
-
autoScroll: PropTypes.bool,
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
Terminal.defaultProps = {
|
|
104
|
-
logs: null,
|
|
105
|
-
error: null,
|
|
106
|
-
exitCode: '',
|
|
107
|
-
autoScroll: true,
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
export default Terminal;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { mount, testComponentSnapshotsWithFixtures } from '@theforeman/test';
|
|
3
|
-
import Terminal from '../Terminal';
|
|
4
|
-
import { props, logs } from '../Terminal.fixtures';
|
|
5
|
-
|
|
6
|
-
const fixtures = {
|
|
7
|
-
'render without Props': {},
|
|
8
|
-
'render with props': props,
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
describe('Terminal', () => {
|
|
12
|
-
describe('rendering', () =>
|
|
13
|
-
testComponentSnapshotsWithFixtures(Terminal, fixtures));
|
|
14
|
-
|
|
15
|
-
it('handles terminal scroll on componentDidUpdate', () => {
|
|
16
|
-
const wrapper = mount(<Terminal {...props} />);
|
|
17
|
-
jest.spyOn(wrapper.instance(), 'scrollBottom');
|
|
18
|
-
wrapper.setProps({ logs: [...logs, 'new-log'] });
|
|
19
|
-
expect(wrapper.instance().scrollBottom).toBeCalled();
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('error should be displayed in terminal', () => {
|
|
23
|
-
const modifiedProps = { ...props, error: 'some-error' };
|
|
24
|
-
const wrapper = mount(<Terminal {...modifiedProps} />);
|
|
25
|
-
expect(wrapper.find('p.terminal_error').exists()).toBeTruthy();
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('logs as a string instead of an array should be displayed', () => {
|
|
29
|
-
const text = 'some-string-log';
|
|
30
|
-
const modifiedProps = { ...props, logs: text };
|
|
31
|
-
const wrapper = mount(<Terminal {...modifiedProps} />);
|
|
32
|
-
expect(wrapper.find('.rh-cloud-inventory-terminal p').text()).toEqual(text);
|
|
33
|
-
});
|
|
34
|
-
});
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`Terminal rendering render with props 1`] = `
|
|
4
|
-
<Col
|
|
5
|
-
bsClass="col"
|
|
6
|
-
componentClass="div"
|
|
7
|
-
sm={12}
|
|
8
|
-
>
|
|
9
|
-
<div
|
|
10
|
-
className="rh-cloud-inventory-terminal"
|
|
11
|
-
onScroll={[Function]}
|
|
12
|
-
>
|
|
13
|
-
<Grid
|
|
14
|
-
bsClass="container"
|
|
15
|
-
componentClass="div"
|
|
16
|
-
fluid={true}
|
|
17
|
-
>
|
|
18
|
-
<Row
|
|
19
|
-
bsClass="row"
|
|
20
|
-
componentClass="div"
|
|
21
|
-
>
|
|
22
|
-
<Col
|
|
23
|
-
bsClass="col"
|
|
24
|
-
componentClass="div"
|
|
25
|
-
sm={12}
|
|
26
|
-
>
|
|
27
|
-
<p
|
|
28
|
-
key="0"
|
|
29
|
-
>
|
|
30
|
-
Generating...
|
|
31
|
-
</p>
|
|
32
|
-
<p
|
|
33
|
-
key="1"
|
|
34
|
-
>
|
|
35
|
-
Hosts: 1000
|
|
36
|
-
</p>
|
|
37
|
-
<p
|
|
38
|
-
key="2"
|
|
39
|
-
>
|
|
40
|
-
writing host 1/1000
|
|
41
|
-
</p>
|
|
42
|
-
<p
|
|
43
|
-
key="3"
|
|
44
|
-
>
|
|
45
|
-
writing host 2/1000
|
|
46
|
-
</p>
|
|
47
|
-
<Spinner
|
|
48
|
-
className=""
|
|
49
|
-
inline={true}
|
|
50
|
-
inverse={true}
|
|
51
|
-
loading={true}
|
|
52
|
-
size="xs"
|
|
53
|
-
/>
|
|
54
|
-
</Col>
|
|
55
|
-
</Row>
|
|
56
|
-
</Grid>
|
|
57
|
-
</div>
|
|
58
|
-
</Col>
|
|
59
|
-
`;
|
|
60
|
-
|
|
61
|
-
exports[`Terminal rendering render without Props 1`] = `
|
|
62
|
-
<Col
|
|
63
|
-
bsClass="col"
|
|
64
|
-
componentClass="div"
|
|
65
|
-
sm={12}
|
|
66
|
-
>
|
|
67
|
-
<div
|
|
68
|
-
className="rh-cloud-inventory-terminal"
|
|
69
|
-
onScroll={[Function]}
|
|
70
|
-
>
|
|
71
|
-
<Grid
|
|
72
|
-
bsClass="container"
|
|
73
|
-
componentClass="div"
|
|
74
|
-
fluid={true}
|
|
75
|
-
>
|
|
76
|
-
<Row
|
|
77
|
-
bsClass="row"
|
|
78
|
-
componentClass="div"
|
|
79
|
-
>
|
|
80
|
-
<Col
|
|
81
|
-
bsClass="col"
|
|
82
|
-
componentClass="div"
|
|
83
|
-
sm={12}
|
|
84
|
-
>
|
|
85
|
-
<p />
|
|
86
|
-
<Spinner
|
|
87
|
-
className=""
|
|
88
|
-
inline={true}
|
|
89
|
-
inverse={true}
|
|
90
|
-
loading={false}
|
|
91
|
-
size="xs"
|
|
92
|
-
/>
|
|
93
|
-
</Col>
|
|
94
|
-
</Row>
|
|
95
|
-
</Grid>
|
|
96
|
-
</div>
|
|
97
|
-
</Col>
|
|
98
|
-
`;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './Terminal';
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
.rh-cloud-inventory-terminal {
|
|
2
|
-
height: 200px;
|
|
3
|
-
background-color: #222;
|
|
4
|
-
padding: 10px 0;
|
|
5
|
-
margin-bottom: 20px;
|
|
6
|
-
overflow-y: scroll;
|
|
7
|
-
overflow-x: hidden;
|
|
8
|
-
|
|
9
|
-
p {
|
|
10
|
-
font-family: monospace;
|
|
11
|
-
font-size: 16px;
|
|
12
|
-
color: #22da26;
|
|
13
|
-
overflow-wrap: anywhere;
|
|
14
|
-
|
|
15
|
-
&.terminal_error {
|
|
16
|
-
color: #f00;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
&::-webkit-scrollbar {
|
|
21
|
-
width: 12px;
|
|
22
|
-
height: 12px;
|
|
23
|
-
background: #aaa;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
&::-webkit-scrollbar-thumb {
|
|
27
|
-
background: #222;
|
|
28
|
-
border-radius: 6px;
|
|
29
|
-
border: 3px solid transparent;
|
|
30
|
-
background-clip: content-box;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`InsightsTable rendering render with Props 1`] = `
|
|
4
|
-
<Fragment>
|
|
5
|
-
<SelectAllAlert
|
|
6
|
-
clearAllSelection={[Function]}
|
|
7
|
-
isAllSelected={false}
|
|
8
|
-
selectAll={[Function]}
|
|
9
|
-
selectedIds={Object {}}
|
|
10
|
-
showSelectAllAlert={false}
|
|
11
|
-
/>
|
|
12
|
-
<Table
|
|
13
|
-
actionsMenuAppendTo="inline"
|
|
14
|
-
aria-label="Recommendations Table"
|
|
15
|
-
borders={true}
|
|
16
|
-
canCollapseAll={false}
|
|
17
|
-
canSelectAll={false}
|
|
18
|
-
canSortFavorites={true}
|
|
19
|
-
cells={
|
|
20
|
-
Array [
|
|
21
|
-
Object {
|
|
22
|
-
"id": "hostname",
|
|
23
|
-
"sortKey": "hostname",
|
|
24
|
-
"title": "Hostname",
|
|
25
|
-
"transforms": Array [
|
|
26
|
-
[Function],
|
|
27
|
-
[Function],
|
|
28
|
-
],
|
|
29
|
-
},
|
|
30
|
-
Object {
|
|
31
|
-
"id": "recommendation",
|
|
32
|
-
"sortKey": "title",
|
|
33
|
-
"title": "Recommendation",
|
|
34
|
-
"transforms": Array [
|
|
35
|
-
[Function],
|
|
36
|
-
[Function],
|
|
37
|
-
],
|
|
38
|
-
},
|
|
39
|
-
Object {
|
|
40
|
-
"cellTransforms": Array [
|
|
41
|
-
[Function],
|
|
42
|
-
],
|
|
43
|
-
"id": "total risk",
|
|
44
|
-
"sortKey": "total_risk",
|
|
45
|
-
"title": "Total risk",
|
|
46
|
-
"transforms": Array [
|
|
47
|
-
[Function],
|
|
48
|
-
[Function],
|
|
49
|
-
],
|
|
50
|
-
},
|
|
51
|
-
Object {
|
|
52
|
-
"cellTransforms": Array [
|
|
53
|
-
[Function],
|
|
54
|
-
],
|
|
55
|
-
"id": "remediate",
|
|
56
|
-
"title": "Remediate",
|
|
57
|
-
"transforms": Array [
|
|
58
|
-
[Function],
|
|
59
|
-
],
|
|
60
|
-
},
|
|
61
|
-
Object {
|
|
62
|
-
"cellTransforms": Array [
|
|
63
|
-
[Function],
|
|
64
|
-
],
|
|
65
|
-
"id": "actions",
|
|
66
|
-
"title": "",
|
|
67
|
-
"transforms": Array [
|
|
68
|
-
[Function],
|
|
69
|
-
],
|
|
70
|
-
},
|
|
71
|
-
]
|
|
72
|
-
}
|
|
73
|
-
className="rh-cloud-recommendations-table"
|
|
74
|
-
collapseAllAriaLabel=""
|
|
75
|
-
contentId="expanded-content"
|
|
76
|
-
dropdownDirection="down"
|
|
77
|
-
dropdownPosition="right"
|
|
78
|
-
expandId="expandable-toggle"
|
|
79
|
-
gridBreakPoint="grid-md"
|
|
80
|
-
isHeaderSelectDisabled={false}
|
|
81
|
-
isNested={false}
|
|
82
|
-
isStickyHeader={false}
|
|
83
|
-
isTreeTable={false}
|
|
84
|
-
onSelect={[Function]}
|
|
85
|
-
onSort={[Function]}
|
|
86
|
-
ouiaId="rh-cloud-recommendations-table"
|
|
87
|
-
ouiaSafe={true}
|
|
88
|
-
role="grid"
|
|
89
|
-
rowLabeledBy="simple-node"
|
|
90
|
-
rows={Array []}
|
|
91
|
-
selectVariant="checkbox"
|
|
92
|
-
sortBy={
|
|
93
|
-
Object {
|
|
94
|
-
"direction": "desc",
|
|
95
|
-
"index": 3,
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
variant="compact"
|
|
99
|
-
>
|
|
100
|
-
<TableHeader />
|
|
101
|
-
<TableBody />
|
|
102
|
-
</Table>
|
|
103
|
-
<TableEmptyState
|
|
104
|
-
error={null}
|
|
105
|
-
rowsLength={0}
|
|
106
|
-
status="RESOLVED"
|
|
107
|
-
/>
|
|
108
|
-
<Pagination
|
|
109
|
-
variant="bottom"
|
|
110
|
-
/>
|
|
111
|
-
</Fragment>
|
|
112
|
-
`;
|