foreman_host_reports 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +619 -0
- data/README.md +545 -0
- data/app/controllers/api/v2/host_reports_controller.rb +98 -0
- data/app/controllers/concerns/foreman_host_reports/controller/parameters/host_report.rb +25 -0
- data/app/controllers/host_reports_controller.rb +46 -0
- data/app/models/concerns/foreman_host_reports/host_extensions.rb +9 -0
- data/app/models/concerns/foreman_host_reports/smart_proxy_extensions.rb +9 -0
- data/app/models/host_report.rb +85 -0
- data/app/models/report_keyword.rb +11 -0
- data/app/views/api/v2/host_reports/base.json.rabl +5 -0
- data/app/views/api/v2/host_reports/create.json.rabl +5 -0
- data/app/views/api/v2/host_reports/index.json.rabl +5 -0
- data/app/views/api/v2/host_reports/main.json.rabl +15 -0
- data/app/views/api/v2/host_reports/show.json.rabl +11 -0
- data/config/routes.rb +33 -0
- data/db/migrate/20210112183526_add_host_reports.rb +36 -0
- data/db/migrate/20210616133601_create_report_keywords.rb +12 -0
- data/lib/foreman_host_reports/engine.rb +68 -0
- data/lib/foreman_host_reports/version.rb +3 -0
- data/lib/foreman_host_reports.rb +4 -0
- data/lib/tasks/foreman_host_reports_tasks.rake +50 -0
- data/locale/Makefile +60 -0
- data/locale/en/foreman_host_reports.po +19 -0
- data/locale/foreman_host_reports.pot +19 -0
- data/locale/gemspec.rb +2 -0
- data/package.json +45 -0
- data/test/controllers/api/v2/host_reports_controller_test.rb +278 -0
- data/test/factories/foreman_host_reports_factories.rb +21 -0
- data/test/snapshots/foreman-web.json +918 -0
- data/test/test_plugin_helper.rb +11 -0
- data/test/unit/foreman_host_reports_test.rb +9 -0
- data/webpack/global_index.js +4 -0
- data/webpack/global_test_setup.js +11 -0
- data/webpack/index.js +0 -0
- data/webpack/src/Router/HostReports/Components/HostReportDeleteModal.js +50 -0
- data/webpack/src/Router/HostReports/IndexPage/Components/HostReportsTable/Components/FormatCell.js +53 -0
- data/webpack/src/Router/HostReports/IndexPage/Components/HostReportsTable/Components/FormatCell.scss +4 -0
- data/webpack/src/Router/HostReports/IndexPage/Components/HostReportsTable/Components/Formatters/formatCellFormatter.js +6 -0
- data/webpack/src/Router/HostReports/IndexPage/Components/HostReportsTable/Components/Formatters/hostReportsToShowFormatter.js +13 -0
- data/webpack/src/Router/HostReports/IndexPage/Components/HostReportsTable/Components/Formatters/index.js +4 -0
- data/webpack/src/Router/HostReports/IndexPage/Components/HostReportsTable/Components/Formatters/reportToShowFormatter.js +13 -0
- data/webpack/src/Router/HostReports/IndexPage/Components/HostReportsTable/Components/Formatters/statusFormatter.js +9 -0
- data/webpack/src/Router/HostReports/IndexPage/Components/HostReportsTable/Components/HostReportsToShowCell.js +32 -0
- data/webpack/src/Router/HostReports/IndexPage/Components/HostReportsTable/Components/ReportToShowCell.js +27 -0
- data/webpack/src/Router/HostReports/IndexPage/Components/HostReportsTable/Components/StatusCell.js +77 -0
- data/webpack/src/Router/HostReports/IndexPage/Components/HostReportsTable/Components/StatusCell.scss +9 -0
- data/webpack/src/Router/HostReports/IndexPage/Components/HostReportsTable/Components/formatImages.js +7 -0
- data/webpack/src/Router/HostReports/IndexPage/Components/HostReportsTable/Components/images/ansible.png +0 -0
- data/webpack/src/Router/HostReports/IndexPage/Components/HostReportsTable/Components/images/puppet.png +0 -0
- data/webpack/src/Router/HostReports/IndexPage/Components/HostReportsTable/HostReportsTable.js +85 -0
- data/webpack/src/Router/HostReports/IndexPage/Components/HostReportsTable/HostReportsTableSchema.js +65 -0
- data/webpack/src/Router/HostReports/IndexPage/Components/HostReportsTable/index.js +28 -0
- data/webpack/src/Router/HostReports/IndexPage/IndexPage.js +88 -0
- data/webpack/src/Router/HostReports/IndexPage/IndexPageActions.js +55 -0
- data/webpack/src/Router/HostReports/IndexPage/IndexPageHelpers.js +50 -0
- data/webpack/src/Router/HostReports/IndexPage/IndexPageSelectors.js +86 -0
- data/webpack/src/Router/HostReports/IndexPage/constants.js +14 -0
- data/webpack/src/Router/HostReports/IndexPage/index.js +98 -0
- data/webpack/src/Router/HostReports/ShowPage/Components/HostReportMetrics/HostReportMetrics.scss +3 -0
- data/webpack/src/Router/HostReports/ShowPage/Components/HostReportMetrics/index.js +100 -0
- data/webpack/src/Router/HostReports/ShowPage/Components/ReportLogs/Ansible.js +77 -0
- data/webpack/src/Router/HostReports/ShowPage/Components/ReportLogs/Puppet.js +79 -0
- data/webpack/src/Router/HostReports/ShowPage/Components/ReportLogs/helpers.js +17 -0
- data/webpack/src/Router/HostReports/ShowPage/Components/ReportLogs/index.js +29 -0
- data/webpack/src/Router/HostReports/ShowPage/Components/ReportLogsFilter/index.js +109 -0
- data/webpack/src/Router/HostReports/ShowPage/ShowPage.js +160 -0
- data/webpack/src/Router/HostReports/ShowPage/ShowPageSelectors.js +51 -0
- data/webpack/src/Router/HostReports/ShowPage/index.js +75 -0
- data/webpack/src/Router/HostReports/constants.js +15 -0
- data/webpack/src/Router/routes.js +23 -0
- data/webpack/test_setup.js +17 -0
- metadata +133 -0
@@ -0,0 +1,109 @@
|
|
1
|
+
import React, { useState, useEffect, useCallback } from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
|
4
|
+
import { sprintf, translate as __ } from 'foremanReact/common/I18n';
|
5
|
+
|
6
|
+
import { ContextSelector, ContextSelectorItem } from '@patternfly/react-core';
|
7
|
+
|
8
|
+
import ReportLogs from '../ReportLogs';
|
9
|
+
|
10
|
+
const ReportLogsFilter = ({ format, reportedAt, meta }) => {
|
11
|
+
const reportedAtLocal = new Date(reportedAt);
|
12
|
+
const { logs } = meta;
|
13
|
+
const filterItems = [
|
14
|
+
{ text: __('All messages'), accepts: [] },
|
15
|
+
{
|
16
|
+
text: __('Notices, warnings and errors'),
|
17
|
+
accepts: ['notice', 'warning', 'err'],
|
18
|
+
},
|
19
|
+
{ text: __('Warnings and errors'), accepts: ['warning', 'err'] },
|
20
|
+
{ text: __('Errors only'), accepts: ['err'] },
|
21
|
+
];
|
22
|
+
const [currentItem, setCurrentItem] = useState(filterItems[0]);
|
23
|
+
const [currentFilterItems, setCurrentFilterItems] = useState(filterItems);
|
24
|
+
const [searchValue, setSearchValue] = useState('');
|
25
|
+
const [isOpen, setIsOpen] = useState(false);
|
26
|
+
const [filteredLogs, setFilteredLogs] = useState(logs);
|
27
|
+
|
28
|
+
/* eslint-disable react-hooks/exhaustive-deps */
|
29
|
+
const onSearchButtonClick = useCallback(() => {
|
30
|
+
const filtered =
|
31
|
+
searchValue === ''
|
32
|
+
? filterItems
|
33
|
+
: filterItems.filter(item =>
|
34
|
+
item.text.toLowerCase().includes(searchValue.toLowerCase())
|
35
|
+
);
|
36
|
+
setCurrentFilterItems(filtered || []);
|
37
|
+
}, [searchValue]);
|
38
|
+
/* eslint-enable react-hooks/exhaustive-deps */
|
39
|
+
|
40
|
+
useEffect(() => {
|
41
|
+
onSearchButtonClick();
|
42
|
+
}, [searchValue, onSearchButtonClick]);
|
43
|
+
|
44
|
+
const onToggle = (event, newIsOpen) => {
|
45
|
+
setIsOpen(newIsOpen);
|
46
|
+
};
|
47
|
+
const onSelect = () => {
|
48
|
+
setIsOpen(!isOpen);
|
49
|
+
};
|
50
|
+
const onSearchInputChange = (value, event) => {
|
51
|
+
setSearchValue(event.target.value);
|
52
|
+
};
|
53
|
+
const filterLogs = (toFilter, accepts) => {
|
54
|
+
if (!accepts.length) return toFilter;
|
55
|
+
|
56
|
+
return toFilter.filter(log => accepts.includes(log[0] || log.level));
|
57
|
+
};
|
58
|
+
|
59
|
+
useEffect(() => {
|
60
|
+
setFilteredLogs(filterLogs(logs, currentItem.accepts));
|
61
|
+
}, [logs, currentItem]);
|
62
|
+
|
63
|
+
return (
|
64
|
+
<>
|
65
|
+
<span>{__('Show log messages:')}</span>
|
66
|
+
<br />
|
67
|
+
<ContextSelector
|
68
|
+
id="report-logs-filter"
|
69
|
+
toggleText={currentItem.text}
|
70
|
+
onSearchInputChange={onSearchInputChange}
|
71
|
+
isOpen={isOpen}
|
72
|
+
searchInputValue={searchValue}
|
73
|
+
onToggle={onToggle}
|
74
|
+
onSelect={onSelect}
|
75
|
+
onSearchButtonClick={onSearchButtonClick}
|
76
|
+
screenReaderLabel="Selected Messages:"
|
77
|
+
>
|
78
|
+
{currentFilterItems.map((item, i) => (
|
79
|
+
<ContextSelectorItem
|
80
|
+
key={i + 1}
|
81
|
+
id={`select_messages_${i}`}
|
82
|
+
onClick={() => {
|
83
|
+
setCurrentItem(item);
|
84
|
+
}}
|
85
|
+
isDisabled={item.text === currentItem.text}
|
86
|
+
>
|
87
|
+
{item.text}
|
88
|
+
</ContextSelectorItem>
|
89
|
+
))}
|
90
|
+
</ContextSelector>
|
91
|
+
<p className="ra">
|
92
|
+
{sprintf(__('Reported at %s'), reportedAtLocal.toLocaleString())}
|
93
|
+
</p>
|
94
|
+
<ReportLogs format={format} logs={filteredLogs} meta={meta} />
|
95
|
+
</>
|
96
|
+
);
|
97
|
+
};
|
98
|
+
|
99
|
+
ReportLogsFilter.propTypes = {
|
100
|
+
format: PropTypes.string.isRequired,
|
101
|
+
reportedAt: PropTypes.string.isRequired,
|
102
|
+
meta: PropTypes.object,
|
103
|
+
};
|
104
|
+
|
105
|
+
ReportLogsFilter.defaultProps = {
|
106
|
+
meta: {},
|
107
|
+
};
|
108
|
+
|
109
|
+
export default ReportLogsFilter;
|
@@ -0,0 +1,160 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import JSONTree from 'react-json-tree';
|
3
|
+
import PropTypes from 'prop-types';
|
4
|
+
import { Button, Grid, GridItem } from '@patternfly/react-core';
|
5
|
+
|
6
|
+
import PageLayout from 'foremanReact/routes/common/PageLayout/PageLayout';
|
7
|
+
import { translate as __ } from 'foremanReact/common/I18n';
|
8
|
+
import { foremanUrl } from 'foremanReact/common/helpers';
|
9
|
+
import { useForemanModal } from 'foremanReact/components/ForemanModal/ForemanModalHooks';
|
10
|
+
|
11
|
+
import HostReportDeleteModal from '../Components/HostReportDeleteModal';
|
12
|
+
import ReportLogsFilter from './Components/ReportLogsFilter';
|
13
|
+
import HostReportMetrics from './Components/HostReportMetrics';
|
14
|
+
|
15
|
+
import {
|
16
|
+
HOSTS_PATH,
|
17
|
+
HOST_REPORTS_PATH,
|
18
|
+
HOST_REPORT_DELETE_MODAL_ID,
|
19
|
+
} from '../constants';
|
20
|
+
|
21
|
+
const HostReportsShowPage = ({
|
22
|
+
id,
|
23
|
+
body,
|
24
|
+
format,
|
25
|
+
host,
|
26
|
+
reportedAt,
|
27
|
+
permissions,
|
28
|
+
isLoading,
|
29
|
+
fetchAndPush,
|
30
|
+
}) => {
|
31
|
+
const {
|
32
|
+
setModalOpen: setDeleteModalOpen,
|
33
|
+
setModalClosed: setDeleteModalClosed,
|
34
|
+
} = useForemanModal({
|
35
|
+
id: HOST_REPORT_DELETE_MODAL_ID,
|
36
|
+
});
|
37
|
+
|
38
|
+
const buttons = [];
|
39
|
+
|
40
|
+
if (permissions.canDelete) {
|
41
|
+
buttons.push(
|
42
|
+
<Button
|
43
|
+
key={`host-report-delete-button-${id}`}
|
44
|
+
variant="danger"
|
45
|
+
isSmall
|
46
|
+
onClick={() => setDeleteModalOpen()}
|
47
|
+
>
|
48
|
+
{__('Delete')}
|
49
|
+
</Button>
|
50
|
+
);
|
51
|
+
}
|
52
|
+
buttons.push(
|
53
|
+
<Button
|
54
|
+
key={`host-report-host-button-${id}`}
|
55
|
+
variant="link"
|
56
|
+
component="a"
|
57
|
+
target="_blank"
|
58
|
+
href={foremanUrl(`${HOSTS_PATH}/${host.id}`)}
|
59
|
+
isSmall
|
60
|
+
>
|
61
|
+
{__('Host details')}
|
62
|
+
</Button>
|
63
|
+
);
|
64
|
+
buttons.push(
|
65
|
+
<Button
|
66
|
+
key={`host-report-other-button-${id}`}
|
67
|
+
variant="link"
|
68
|
+
component="a"
|
69
|
+
target="_blank"
|
70
|
+
href={foremanUrl(`${HOSTS_PATH}/${host.id}${HOST_REPORTS_PATH}`)}
|
71
|
+
isSmall
|
72
|
+
>
|
73
|
+
{__('Other reports for this host')}
|
74
|
+
</Button>
|
75
|
+
);
|
76
|
+
|
77
|
+
const meta = {};
|
78
|
+
switch (format) {
|
79
|
+
case 'puppet':
|
80
|
+
meta.environment = body.environment;
|
81
|
+
meta.logs = body.logs;
|
82
|
+
break;
|
83
|
+
case 'ansible':
|
84
|
+
meta.checkMode = body.checkMode;
|
85
|
+
meta.logs = body.results;
|
86
|
+
break;
|
87
|
+
default:
|
88
|
+
break;
|
89
|
+
}
|
90
|
+
|
91
|
+
const theme = {
|
92
|
+
scheme: 'foreman',
|
93
|
+
backgroundColor: 'rgba(0, 0, 0, 255)',
|
94
|
+
base00: 'rgba(0, 0, 0, 0)',
|
95
|
+
};
|
96
|
+
|
97
|
+
return (
|
98
|
+
<React.Fragment>
|
99
|
+
<HostReportDeleteModal
|
100
|
+
toDelete={{ id, hostName: host.name }}
|
101
|
+
onSuccess={() => {
|
102
|
+
setDeleteModalClosed();
|
103
|
+
fetchAndPush({ page: 1 });
|
104
|
+
}}
|
105
|
+
/>
|
106
|
+
<PageLayout
|
107
|
+
header={host.name}
|
108
|
+
searchable={false}
|
109
|
+
isLoading={isLoading}
|
110
|
+
breadcrumbOptions={{
|
111
|
+
isSwitchable: false,
|
112
|
+
breadcrumbItems: [
|
113
|
+
{ caption: __('Host Reports'), url: foremanUrl(HOST_REPORTS_PATH) },
|
114
|
+
{
|
115
|
+
caption: host.name,
|
116
|
+
url: foremanUrl(`${HOST_REPORTS_PATH}/${id}`),
|
117
|
+
},
|
118
|
+
],
|
119
|
+
}}
|
120
|
+
toolbarButtons={buttons}
|
121
|
+
>
|
122
|
+
{format === 'plain' ? (
|
123
|
+
<JSONTree data={body} hideRoot theme={theme} />
|
124
|
+
) : (
|
125
|
+
<Grid hasGutter>
|
126
|
+
<GridItem>
|
127
|
+
<ReportLogsFilter
|
128
|
+
format={format}
|
129
|
+
reportedAt={reportedAt}
|
130
|
+
meta={meta}
|
131
|
+
/>
|
132
|
+
</GridItem>
|
133
|
+
{format === 'puppet' ? (
|
134
|
+
<GridItem>
|
135
|
+
<HostReportMetrics metrics={body.metrics} />
|
136
|
+
</GridItem>
|
137
|
+
) : null}
|
138
|
+
</Grid>
|
139
|
+
)}
|
140
|
+
</PageLayout>
|
141
|
+
</React.Fragment>
|
142
|
+
);
|
143
|
+
};
|
144
|
+
|
145
|
+
HostReportsShowPage.propTypes = {
|
146
|
+
id: PropTypes.number.isRequired,
|
147
|
+
body: PropTypes.object.isRequired,
|
148
|
+
format: PropTypes.string.isRequired,
|
149
|
+
host: PropTypes.object.isRequired,
|
150
|
+
reportedAt: PropTypes.string.isRequired,
|
151
|
+
permissions: PropTypes.object.isRequired,
|
152
|
+
fetchAndPush: PropTypes.func.isRequired,
|
153
|
+
isLoading: PropTypes.bool,
|
154
|
+
};
|
155
|
+
|
156
|
+
HostReportsShowPage.defaultProps = {
|
157
|
+
isLoading: true,
|
158
|
+
};
|
159
|
+
|
160
|
+
export default HostReportsShowPage;
|
@@ -0,0 +1,51 @@
|
|
1
|
+
import { STATUS } from 'foremanReact/constants';
|
2
|
+
import { deepPropsToCamelCase } from 'foremanReact/common/helpers';
|
3
|
+
import {
|
4
|
+
selectAPIStatus,
|
5
|
+
selectAPIResponse,
|
6
|
+
selectAPIErrorMessage,
|
7
|
+
} from 'foremanReact/redux/API/APISelectors';
|
8
|
+
|
9
|
+
import { HOST_REPORT_REQUEST_KEY } from '../constants';
|
10
|
+
|
11
|
+
const selectHostReportResponse = state => {
|
12
|
+
const response = deepPropsToCamelCase(
|
13
|
+
selectAPIResponse(state, HOST_REPORT_REQUEST_KEY)
|
14
|
+
);
|
15
|
+
return response;
|
16
|
+
};
|
17
|
+
|
18
|
+
export const selectIsLoading = state => {
|
19
|
+
const status = selectHostReportPageStatus(state);
|
20
|
+
return !status || status === STATUS.PENDING;
|
21
|
+
};
|
22
|
+
|
23
|
+
const selectHostReportPageStatus = state =>
|
24
|
+
selectAPIStatus(state, HOST_REPORT_REQUEST_KEY);
|
25
|
+
|
26
|
+
export const selectHasError = state =>
|
27
|
+
selectHostReportPageStatus(state) === STATUS.ERROR;
|
28
|
+
|
29
|
+
export const selectHostReport = state => {
|
30
|
+
if (selectHasError(state)) {
|
31
|
+
return [];
|
32
|
+
}
|
33
|
+
return selectHostReportResponse(state).hostReport;
|
34
|
+
};
|
35
|
+
|
36
|
+
export const selectSearch = state => selectHostReportResponse(state).search;
|
37
|
+
|
38
|
+
export const selectPermissions = state =>
|
39
|
+
selectHostReportResponse(state).permissions || {};
|
40
|
+
|
41
|
+
export const selectErrorMessage = state => {
|
42
|
+
if (!selectHasError(state)) return { message: '', details: '' };
|
43
|
+
const error = selectHostReportResponse(state).response?.data?.error;
|
44
|
+
|
45
|
+
if (error) return error;
|
46
|
+
|
47
|
+
return {
|
48
|
+
message: selectAPIErrorMessage(state, HOST_REPORT_REQUEST_KEY),
|
49
|
+
details: '',
|
50
|
+
};
|
51
|
+
};
|
@@ -0,0 +1,75 @@
|
|
1
|
+
import React, { useEffect } from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
import { useSelector, useDispatch } from 'react-redux';
|
4
|
+
|
5
|
+
import { get } from 'foremanReact/redux/API';
|
6
|
+
import { foremanUrl } from 'foremanReact/common/helpers';
|
7
|
+
|
8
|
+
import Loading from 'foremanReact/components/Loading';
|
9
|
+
import DefaultEmptyState from 'foremanReact/components/common/EmptyState';
|
10
|
+
|
11
|
+
import HostReportsShowPage from './ShowPage';
|
12
|
+
|
13
|
+
import { HOST_REPORT_REQUEST_KEY, HOST_REPORTS_PATH } from '../constants';
|
14
|
+
import {
|
15
|
+
selectHostReport,
|
16
|
+
selectIsLoading,
|
17
|
+
selectHasError,
|
18
|
+
selectErrorMessage,
|
19
|
+
selectPermissions,
|
20
|
+
} from './ShowPageSelectors';
|
21
|
+
|
22
|
+
import { fetchAndPush } from '../IndexPage/IndexPageActions';
|
23
|
+
|
24
|
+
const ConnectedHostReportsShowPage = ({ match }) => {
|
25
|
+
const dispatch = useDispatch();
|
26
|
+
|
27
|
+
const report = useSelector(selectHostReport);
|
28
|
+
const isLoading = useSelector(selectIsLoading);
|
29
|
+
const hasError = useSelector(selectHasError);
|
30
|
+
const error = useSelector(selectErrorMessage);
|
31
|
+
const permissions = useSelector(selectPermissions);
|
32
|
+
|
33
|
+
const { id } = match.params;
|
34
|
+
|
35
|
+
useEffect(() => {
|
36
|
+
dispatch(
|
37
|
+
get({
|
38
|
+
key: HOST_REPORT_REQUEST_KEY,
|
39
|
+
url: foremanUrl(`${HOST_REPORTS_PATH}/${id}`),
|
40
|
+
})
|
41
|
+
);
|
42
|
+
}, [dispatch, id]);
|
43
|
+
|
44
|
+
if (isLoading && !hasError) return <Loading />;
|
45
|
+
|
46
|
+
if (!isLoading && hasError) {
|
47
|
+
return (
|
48
|
+
<DefaultEmptyState
|
49
|
+
icon="error-circle-o"
|
50
|
+
header={error.message}
|
51
|
+
description={error.details || ''}
|
52
|
+
documentation={null}
|
53
|
+
/>
|
54
|
+
);
|
55
|
+
}
|
56
|
+
|
57
|
+
return (
|
58
|
+
<HostReportsShowPage
|
59
|
+
id={report.id}
|
60
|
+
body={report.body}
|
61
|
+
format={report.format}
|
62
|
+
host={report.host}
|
63
|
+
reportedAt={report.reportedAt}
|
64
|
+
permissions={permissions}
|
65
|
+
isLoading={isLoading}
|
66
|
+
fetchAndPush={params => dispatch(fetchAndPush(params))}
|
67
|
+
/>
|
68
|
+
);
|
69
|
+
};
|
70
|
+
|
71
|
+
ConnectedHostReportsShowPage.propTypes = {
|
72
|
+
match: PropTypes.object.isRequired,
|
73
|
+
};
|
74
|
+
|
75
|
+
export default ConnectedHostReportsShowPage;
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { getControllerSearchProps } from 'foremanReact/constants';
|
2
|
+
|
3
|
+
export const HOST_REPORTS_SEARCH_PROPS = getControllerSearchProps(
|
4
|
+
'host_reports'
|
5
|
+
);
|
6
|
+
export const HOSTS_PATH = '/hosts';
|
7
|
+
export const HOST_REPORTS_PATH = '/host_reports';
|
8
|
+
export const HOST_REPORTS_API_PATH =
|
9
|
+
'/api/v2/host_reports?include_permissions=true';
|
10
|
+
export const HOST_REPORTS_API_PLAIN_PATH = '/api/v2/host_reports';
|
11
|
+
|
12
|
+
export const HOST_REPORT_REQUEST_KEY = 'HOST_REPORT';
|
13
|
+
export const HOST_REPORTS_API_REQUEST_KEY = 'HOST_REPORTS_API';
|
14
|
+
|
15
|
+
export const HOST_REPORT_DELETE_MODAL_ID = 'hostReportDeleteModal';
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import ConnectedHostReportsIndexPage from './HostReports/IndexPage';
|
3
|
+
import ConnectedHostReportsShowPage from './HostReports/ShowPage';
|
4
|
+
|
5
|
+
const ForemanHostReportsRoutes = [
|
6
|
+
{
|
7
|
+
path: '/host_reports',
|
8
|
+
exact: true,
|
9
|
+
render: props => <ConnectedHostReportsIndexPage {...props} />,
|
10
|
+
},
|
11
|
+
{
|
12
|
+
path: '/host_reports/:id([0-9]+)',
|
13
|
+
exact: true,
|
14
|
+
render: props => <ConnectedHostReportsShowPage {...props} />,
|
15
|
+
},
|
16
|
+
{
|
17
|
+
path: '/hosts/:hostId([0-9]+)/host_reports',
|
18
|
+
exact: true,
|
19
|
+
render: props => <ConnectedHostReportsIndexPage {...props} />,
|
20
|
+
},
|
21
|
+
];
|
22
|
+
|
23
|
+
export default ForemanHostReportsRoutes;
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import 'core-js/shim';
|
2
|
+
import 'regenerator-runtime/runtime';
|
3
|
+
import MutationObserver from '@sheerun/mutationobserver-shim';
|
4
|
+
|
5
|
+
import { configure } from 'enzyme';
|
6
|
+
import Adapter from 'enzyme-adapter-react-16';
|
7
|
+
|
8
|
+
configure({ adapter: new Adapter() });
|
9
|
+
|
10
|
+
// Mocking translation function
|
11
|
+
global.__ = text => text; // eslint-disable-line
|
12
|
+
|
13
|
+
// Mocking locales to prevent unnecessary fallback messages
|
14
|
+
window.locales = { en: { domain: 'app', locale_data: { app: { '': {} } } } };
|
15
|
+
|
16
|
+
// see https://github.com/testing-library/dom-testing-library/releases/tag/v7.0.0
|
17
|
+
window.MutationObserver = MutationObserver;
|
metadata
ADDED
@@ -0,0 +1,133 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: foreman_host_reports
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Lukas Zapletal
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-10-18 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rdoc
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: Fast and efficient reporting capabilities
|
28
|
+
email:
|
29
|
+
- lukas-x@zapletalovi.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- LICENSE
|
35
|
+
- README.md
|
36
|
+
- app/controllers/api/v2/host_reports_controller.rb
|
37
|
+
- app/controllers/concerns/foreman_host_reports/controller/parameters/host_report.rb
|
38
|
+
- app/controllers/host_reports_controller.rb
|
39
|
+
- app/models/concerns/foreman_host_reports/host_extensions.rb
|
40
|
+
- app/models/concerns/foreman_host_reports/smart_proxy_extensions.rb
|
41
|
+
- app/models/host_report.rb
|
42
|
+
- app/models/report_keyword.rb
|
43
|
+
- app/views/api/v2/host_reports/base.json.rabl
|
44
|
+
- app/views/api/v2/host_reports/create.json.rabl
|
45
|
+
- app/views/api/v2/host_reports/index.json.rabl
|
46
|
+
- app/views/api/v2/host_reports/main.json.rabl
|
47
|
+
- app/views/api/v2/host_reports/show.json.rabl
|
48
|
+
- config/routes.rb
|
49
|
+
- db/migrate/20210112183526_add_host_reports.rb
|
50
|
+
- db/migrate/20210616133601_create_report_keywords.rb
|
51
|
+
- lib/foreman_host_reports.rb
|
52
|
+
- lib/foreman_host_reports/engine.rb
|
53
|
+
- lib/foreman_host_reports/version.rb
|
54
|
+
- lib/tasks/foreman_host_reports_tasks.rake
|
55
|
+
- locale/Makefile
|
56
|
+
- locale/en/foreman_host_reports.po
|
57
|
+
- locale/foreman_host_reports.pot
|
58
|
+
- locale/gemspec.rb
|
59
|
+
- package.json
|
60
|
+
- test/controllers/api/v2/host_reports_controller_test.rb
|
61
|
+
- test/factories/foreman_host_reports_factories.rb
|
62
|
+
- test/snapshots/foreman-web.json
|
63
|
+
- test/test_plugin_helper.rb
|
64
|
+
- test/unit/foreman_host_reports_test.rb
|
65
|
+
- webpack/global_index.js
|
66
|
+
- webpack/global_test_setup.js
|
67
|
+
- webpack/index.js
|
68
|
+
- webpack/src/Router/HostReports/Components/HostReportDeleteModal.js
|
69
|
+
- webpack/src/Router/HostReports/IndexPage/Components/HostReportsTable/Components/FormatCell.js
|
70
|
+
- webpack/src/Router/HostReports/IndexPage/Components/HostReportsTable/Components/FormatCell.scss
|
71
|
+
- webpack/src/Router/HostReports/IndexPage/Components/HostReportsTable/Components/Formatters/formatCellFormatter.js
|
72
|
+
- webpack/src/Router/HostReports/IndexPage/Components/HostReportsTable/Components/Formatters/hostReportsToShowFormatter.js
|
73
|
+
- webpack/src/Router/HostReports/IndexPage/Components/HostReportsTable/Components/Formatters/index.js
|
74
|
+
- webpack/src/Router/HostReports/IndexPage/Components/HostReportsTable/Components/Formatters/reportToShowFormatter.js
|
75
|
+
- webpack/src/Router/HostReports/IndexPage/Components/HostReportsTable/Components/Formatters/statusFormatter.js
|
76
|
+
- webpack/src/Router/HostReports/IndexPage/Components/HostReportsTable/Components/HostReportsToShowCell.js
|
77
|
+
- webpack/src/Router/HostReports/IndexPage/Components/HostReportsTable/Components/ReportToShowCell.js
|
78
|
+
- webpack/src/Router/HostReports/IndexPage/Components/HostReportsTable/Components/StatusCell.js
|
79
|
+
- webpack/src/Router/HostReports/IndexPage/Components/HostReportsTable/Components/StatusCell.scss
|
80
|
+
- webpack/src/Router/HostReports/IndexPage/Components/HostReportsTable/Components/formatImages.js
|
81
|
+
- webpack/src/Router/HostReports/IndexPage/Components/HostReportsTable/Components/images/ansible.png
|
82
|
+
- webpack/src/Router/HostReports/IndexPage/Components/HostReportsTable/Components/images/puppet.png
|
83
|
+
- webpack/src/Router/HostReports/IndexPage/Components/HostReportsTable/HostReportsTable.js
|
84
|
+
- webpack/src/Router/HostReports/IndexPage/Components/HostReportsTable/HostReportsTableSchema.js
|
85
|
+
- webpack/src/Router/HostReports/IndexPage/Components/HostReportsTable/index.js
|
86
|
+
- webpack/src/Router/HostReports/IndexPage/IndexPage.js
|
87
|
+
- webpack/src/Router/HostReports/IndexPage/IndexPageActions.js
|
88
|
+
- webpack/src/Router/HostReports/IndexPage/IndexPageHelpers.js
|
89
|
+
- webpack/src/Router/HostReports/IndexPage/IndexPageSelectors.js
|
90
|
+
- webpack/src/Router/HostReports/IndexPage/constants.js
|
91
|
+
- webpack/src/Router/HostReports/IndexPage/index.js
|
92
|
+
- webpack/src/Router/HostReports/ShowPage/Components/HostReportMetrics/HostReportMetrics.scss
|
93
|
+
- webpack/src/Router/HostReports/ShowPage/Components/HostReportMetrics/index.js
|
94
|
+
- webpack/src/Router/HostReports/ShowPage/Components/ReportLogs/Ansible.js
|
95
|
+
- webpack/src/Router/HostReports/ShowPage/Components/ReportLogs/Puppet.js
|
96
|
+
- webpack/src/Router/HostReports/ShowPage/Components/ReportLogs/helpers.js
|
97
|
+
- webpack/src/Router/HostReports/ShowPage/Components/ReportLogs/index.js
|
98
|
+
- webpack/src/Router/HostReports/ShowPage/Components/ReportLogsFilter/index.js
|
99
|
+
- webpack/src/Router/HostReports/ShowPage/ShowPage.js
|
100
|
+
- webpack/src/Router/HostReports/ShowPage/ShowPageSelectors.js
|
101
|
+
- webpack/src/Router/HostReports/ShowPage/index.js
|
102
|
+
- webpack/src/Router/HostReports/constants.js
|
103
|
+
- webpack/src/Router/routes.js
|
104
|
+
- webpack/test_setup.js
|
105
|
+
homepage: https://github.com/theforeman/foreman_host_reports
|
106
|
+
licenses:
|
107
|
+
- GPL-3.0
|
108
|
+
metadata: {}
|
109
|
+
post_install_message:
|
110
|
+
rdoc_options: []
|
111
|
+
require_paths:
|
112
|
+
- lib
|
113
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 2.5.0
|
118
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
|
+
requirements:
|
120
|
+
- - ">="
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: '0'
|
123
|
+
requirements: []
|
124
|
+
rubygems_version: 3.1.4
|
125
|
+
signing_key:
|
126
|
+
specification_version: 4
|
127
|
+
summary: Foreman reporting engine
|
128
|
+
test_files:
|
129
|
+
- test/factories/foreman_host_reports_factories.rb
|
130
|
+
- test/unit/foreman_host_reports_test.rb
|
131
|
+
- test/controllers/api/v2/host_reports_controller_test.rb
|
132
|
+
- test/snapshots/foreman-web.json
|
133
|
+
- test/test_plugin_helper.rb
|