foreman_statistics 0.1.3 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/helpers/foreman_statistics/trends_helper.rb +30 -20
- data/app/jobs/foreman_statistics/trend_counter_job.rb +23 -0
- data/app/models/concerns/foreman_statistics/has_many_trends.rb +9 -0
- data/app/models/foreman_statistics/trend.rb +3 -1
- data/app/views/foreman_statistics/layouts/application_react.html.erb +1 -2
- data/app/views/foreman_statistics/trends/_empty_data.html.erb +0 -1
- data/app/views/foreman_statistics/trends/_hosts.html.erb +1 -1
- data/app/views/foreman_statistics/trends/index.html.erb +3 -13
- data/app/views/foreman_statistics/trends/show.html.erb +6 -6
- data/app/views/foreman_statistics/trends/welcome.html.erb +1 -1
- data/config/jest.config.js +21 -0
- data/db/migrate/20210523143005_migrate_environments.rb +13 -0
- data/lib/foreman_statistics/engine.rb +12 -5
- data/lib/foreman_statistics/version.rb +1 -1
- data/lib/tasks/foreman_statistics_tasks.rake +3 -2
- data/locale/action_names.rb +5 -0
- data/locale/ca/LC_MESSAGES/foreman_statistics.mo +0 -0
- data/locale/ca/foreman_statistics.edit.po +263 -0
- data/locale/ca/foreman_statistics.po +202 -0
- data/locale/ca/foreman_statistics.po.time_stamp +0 -0
- data/locale/cs_CZ/LC_MESSAGES/foreman_statistics.mo +0 -0
- data/locale/cs_CZ/foreman_statistics.edit.po +267 -0
- data/locale/cs_CZ/foreman_statistics.po +206 -0
- data/locale/cs_CZ/foreman_statistics.po.time_stamp +0 -0
- data/locale/de/LC_MESSAGES/foreman_statistics.mo +0 -0
- data/locale/de/foreman_statistics.edit.po +271 -0
- data/locale/de/foreman_statistics.po +210 -0
- data/locale/de/foreman_statistics.po.time_stamp +0 -0
- data/locale/en/LC_MESSAGES/foreman_statistics.mo +0 -0
- data/locale/en/foreman_statistics.edit.po +258 -0
- data/locale/en/foreman_statistics.po +182 -3
- data/locale/en/foreman_statistics.po.time_stamp +0 -0
- data/locale/en_GB/LC_MESSAGES/foreman_statistics.mo +0 -0
- data/locale/en_GB/foreman_statistics.edit.po +265 -0
- data/locale/en_GB/foreman_statistics.po +204 -0
- data/locale/en_GB/foreman_statistics.po.time_stamp +0 -0
- data/locale/es/LC_MESSAGES/foreman_statistics.mo +0 -0
- data/locale/es/foreman_statistics.edit.po +269 -0
- data/locale/es/foreman_statistics.po +208 -0
- data/locale/es/foreman_statistics.po.time_stamp +0 -0
- data/locale/foreman_statistics.pot +265 -8
- data/locale/fr/LC_MESSAGES/foreman_statistics.mo +0 -0
- data/locale/fr/foreman_statistics.edit.po +269 -0
- data/locale/fr/foreman_statistics.po +208 -0
- data/locale/fr/foreman_statistics.po.time_stamp +0 -0
- data/locale/gemspec.rb +1 -1
- data/locale/gl/LC_MESSAGES/foreman_statistics.mo +0 -0
- data/locale/gl/foreman_statistics.edit.po +263 -0
- data/locale/gl/foreman_statistics.po +202 -0
- data/locale/gl/foreman_statistics.po.time_stamp +0 -0
- data/locale/it/LC_MESSAGES/foreman_statistics.mo +0 -0
- data/locale/it/foreman_statistics.edit.po +265 -0
- data/locale/it/foreman_statistics.po +204 -0
- data/locale/it/foreman_statistics.po.time_stamp +0 -0
- data/locale/ja/LC_MESSAGES/foreman_statistics.mo +0 -0
- data/locale/ja/foreman_statistics.edit.po +266 -0
- data/locale/ja/foreman_statistics.po +205 -0
- data/locale/ja/foreman_statistics.po.time_stamp +0 -0
- data/locale/ko/LC_MESSAGES/foreman_statistics.mo +0 -0
- data/locale/ko/foreman_statistics.edit.po +264 -0
- data/locale/ko/foreman_statistics.po +203 -0
- data/locale/ko/foreman_statistics.po.time_stamp +0 -0
- data/locale/nl_NL/LC_MESSAGES/foreman_statistics.mo +0 -0
- data/locale/nl_NL/foreman_statistics.edit.po +267 -0
- data/locale/nl_NL/foreman_statistics.po +206 -0
- data/locale/nl_NL/foreman_statistics.po.time_stamp +0 -0
- data/locale/pl/LC_MESSAGES/foreman_statistics.mo +0 -0
- data/locale/pl/foreman_statistics.edit.po +266 -0
- data/locale/pl/foreman_statistics.po +205 -0
- data/locale/pl/foreman_statistics.po.time_stamp +0 -0
- data/locale/pt_BR/LC_MESSAGES/foreman_statistics.mo +0 -0
- data/locale/pt_BR/foreman_statistics.edit.po +269 -0
- data/locale/pt_BR/foreman_statistics.po +208 -0
- data/locale/pt_BR/foreman_statistics.po.time_stamp +0 -0
- data/locale/ru/LC_MESSAGES/foreman_statistics.mo +0 -0
- data/locale/ru/foreman_statistics.edit.po +270 -0
- data/locale/ru/foreman_statistics.po +209 -0
- data/locale/ru/foreman_statistics.po.time_stamp +0 -0
- data/locale/sv_SE/LC_MESSAGES/foreman_statistics.mo +0 -0
- data/locale/sv_SE/foreman_statistics.edit.po +265 -0
- data/locale/sv_SE/foreman_statistics.po +204 -0
- data/locale/sv_SE/foreman_statistics.po.time_stamp +0 -0
- data/locale/zh_CN/LC_MESSAGES/foreman_statistics.mo +0 -0
- data/locale/zh_CN/foreman_statistics.edit.po +267 -0
- data/locale/zh_CN/foreman_statistics.po +206 -0
- data/locale/zh_CN/foreman_statistics.po.time_stamp +0 -0
- data/locale/zh_TW/LC_MESSAGES/foreman_statistics.mo +0 -0
- data/locale/zh_TW/foreman_statistics.edit.po +266 -0
- data/locale/zh_TW/foreman_statistics.po +205 -0
- data/locale/zh_TW/foreman_statistics.po.time_stamp +0 -0
- data/package.json +25 -24
- data/test/functional/foreman_statistics/api/v2/statistics_controller_test.rb +1 -1
- data/test/functional/foreman_statistics/api/v2/trends_controller_test.rb +2 -2
- data/test/functional/foreman_statistics/statistics_controller_test.rb +5 -7
- data/test/functional/foreman_statistics/trends_controller_test.rb +2 -8
- data/test/models/foreman_statistics/trend_counter_test.rb +1 -1
- data/test/models/foreman_statistics/trend_test.rb +1 -1
- data/test/{test_plugin_helper.rb → test_statistics_helper.rb} +0 -0
- data/test/unit/foreman_statistics/access_permissions_test.rb +1 -1
- data/test/unit/foreman_statistics/statistics_test.rb +1 -1
- data/test/unit/foreman_statistics_test.rb +1 -1
- data/test/unit/tasks/foreman_statistics_tasks_test.rb +1 -1
- data/webpack/src/Components/StatisticsChartsList/__snapshots__/StatisticsChartsList.test.js.snap +6 -0
- data/webpack/src/Router/StatisticsPage/StatisticsPageSelectors.js +2 -1
- data/webpack/src/Router/StatisticsPage/__tests__/StatisticsPageSelectors.test.js +4 -2
- data/webpack/src/Router/StatisticsPage/__tests__/__snapshots__/StatisticsPage.test.js.snap +10 -0
- data/webpack/src/reducers.js +4 -2
- metadata +81 -89
- data/app/models/concerns/foreman_statistics/compute_resource_decorations.rb +0 -9
- data/app/models/concerns/foreman_statistics/environment_decorations.rb +0 -9
- data/app/models/concerns/foreman_statistics/hostgroup_decorations.rb +0 -9
- data/app/models/concerns/foreman_statistics/model_decorations.rb +0 -9
- data/app/models/concerns/foreman_statistics/operatingsystem_decorations.rb +0 -9
- data/webpack/__mocks__/foremanReact/API.js +0 -7
- data/webpack/__mocks__/foremanReact/common/HOC.js +0 -24
- data/webpack/__mocks__/foremanReact/common/I18n.js +0 -3
- data/webpack/__mocks__/foremanReact/common/helpers.js +0 -1
- data/webpack/__mocks__/foremanReact/common/urlHelpers.js +0 -1
- data/webpack/__mocks__/foremanReact/components/ChartBox/index.js +0 -2
- data/webpack/__mocks__/foremanReact/components/ForemanModal/ForemanModalActions.js +0 -2
- data/webpack/__mocks__/foremanReact/components/ForemanModal/ForemanModalHooks.js +0 -10
- data/webpack/__mocks__/foremanReact/components/ForemanModal/index.js +0 -4
- data/webpack/__mocks__/foremanReact/components/Layout/LayoutActions.js +0 -2
- data/webpack/__mocks__/foremanReact/components/Pagination/PaginationWrapper.js +0 -2
- data/webpack/__mocks__/foremanReact/components/common/EmptyState.js +0 -5
- data/webpack/__mocks__/foremanReact/components/common/MessageBox.js +0 -4
- data/webpack/__mocks__/foremanReact/components/common/dates/LongDateTime.js +0 -5
- data/webpack/__mocks__/foremanReact/components/common/dates/RelativeDateTime.js +0 -3
- data/webpack/__mocks__/foremanReact/components/common/table.js +0 -5
- data/webpack/__mocks__/foremanReact/components/common/table/actionsHelpers/actionTypeCreator.js +0 -7
- data/webpack/__mocks__/foremanReact/constants.js +0 -24
- data/webpack/__mocks__/foremanReact/readme.md +0 -11
- data/webpack/__mocks__/foremanReact/redux/actions/toasts.js +0 -8
- data/webpack/__mocks__/foremanReact/routes/common/PageLayout/PageLayout.js +0 -10
- data/webpack/__mocks__/foremanReact/routes/common/PageLayout/components/ExportButton/ExportButton.js +0 -5
- data/webpack/__mocks__/foremanReact/routes/common/reducerHOC/withDataReducer.js +0 -35
@@ -1,24 +0,0 @@
|
|
1
|
-
import React, { useEffect } from 'react';
|
2
|
-
|
3
|
-
export const callOnMount = callback => WrappedComponent => componentProps => {
|
4
|
-
// fires callback onMount, [] means don't listen to any props change
|
5
|
-
useEffect(() => {
|
6
|
-
callback(componentProps);
|
7
|
-
}, [componentProps]);
|
8
|
-
|
9
|
-
return <WrappedComponent {...componentProps} />;
|
10
|
-
};
|
11
|
-
|
12
|
-
export const withRenderHandler = ({
|
13
|
-
Component,
|
14
|
-
LoadingComponent = () => jest.fn(),
|
15
|
-
ErrorComponent = () => jest.fn(),
|
16
|
-
EmptyComponent = () => jest.fn(),
|
17
|
-
}) => componentProps => {
|
18
|
-
const { isLoading, hasData, hasError } = componentProps;
|
19
|
-
|
20
|
-
if (isLoading && !hasData) return <LoadingComponent {...componentProps} />;
|
21
|
-
if (hasError) return <ErrorComponent {...componentProps} />;
|
22
|
-
if (hasData) return <Component {...componentProps} />;
|
23
|
-
return <EmptyComponent {...componentProps} />;
|
24
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
export const noop = Function.prototype;
|
@@ -1 +0,0 @@
|
|
1
|
-
export const getURIsearch = () => 'a=b';
|
@@ -1,24 +0,0 @@
|
|
1
|
-
export const STATUS = {
|
2
|
-
PENDING: 'PENDING',
|
3
|
-
RESOLVED: 'RESOLVED',
|
4
|
-
ERROR: 'ERROR',
|
5
|
-
};
|
6
|
-
|
7
|
-
export const getControllerSearchProps = (
|
8
|
-
controller,
|
9
|
-
id = 'searchBar',
|
10
|
-
canCreateBookmarks = true
|
11
|
-
) => ({
|
12
|
-
controller,
|
13
|
-
autocomplete: {
|
14
|
-
id,
|
15
|
-
searchQuery: '',
|
16
|
-
url: `${controller}/auto_complete_search`,
|
17
|
-
useKeyShortcuts: true,
|
18
|
-
},
|
19
|
-
bookmarks: {
|
20
|
-
url: '/api/bookmarks',
|
21
|
-
canCreateBookmarks,
|
22
|
-
documentationUrl: `4.1.5Searching`,
|
23
|
-
},
|
24
|
-
});
|
@@ -1,11 +0,0 @@
|
|
1
|
-
For testing components which have imported foreman-core components,
|
2
|
-
a mock file is required in this folder.
|
3
|
-
|
4
|
-
### Example: Mocking ForemanModal component
|
5
|
-
```js
|
6
|
-
// __mocks__/foremanReact/components/ForemanModal/index.js
|
7
|
-
const ForemanModal = () => jest.fn();
|
8
|
-
ForemanModal.Header = () => jest.fn();
|
9
|
-
ForemanModal.Footer = () => jest.fn();
|
10
|
-
export default ForemanModal;
|
11
|
-
```
|
@@ -1,35 +0,0 @@
|
|
1
|
-
import Immutable from 'seamless-immutable';
|
2
|
-
|
3
|
-
const initialState = Immutable({
|
4
|
-
isLoading: true,
|
5
|
-
hasError: false,
|
6
|
-
hasData: false,
|
7
|
-
message: { type: 'empty', text: '' },
|
8
|
-
});
|
9
|
-
|
10
|
-
const withDataReducer = controller => (
|
11
|
-
state = initialState,
|
12
|
-
{ type, payload }
|
13
|
-
) => {
|
14
|
-
switch (type) {
|
15
|
-
case `${controller}_DATA_RESOLVED`:
|
16
|
-
return state.merge({ ...payload, isLoading: false });
|
17
|
-
|
18
|
-
case `${controller}_DATA_FAILED`:
|
19
|
-
return state.merge({ ...payload, isLoading: false, hasError: true });
|
20
|
-
|
21
|
-
case `${controller}_CLEAR_ERROR`:
|
22
|
-
return state.set('hasError', false);
|
23
|
-
|
24
|
-
case `${controller}_SHOW_LOADING`:
|
25
|
-
return state.set('isLoading', true);
|
26
|
-
|
27
|
-
case `${controller}_HIDE_LOADING`:
|
28
|
-
return state.set('isLoading', false);
|
29
|
-
|
30
|
-
default:
|
31
|
-
return state;
|
32
|
-
}
|
33
|
-
};
|
34
|
-
|
35
|
-
export default withDataReducer;
|