foreman_statistics 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. checksums.yaml +4 -4
  2. data/app/helpers/foreman_statistics/trends_helper.rb +30 -20
  3. data/app/models/concerns/foreman_statistics/has_many_trends.rb +9 -0
  4. data/app/models/foreman_statistics/trend.rb +3 -1
  5. data/app/views/foreman_statistics/trends/_hosts.html.erb +1 -1
  6. data/app/views/foreman_statistics/trends/index.html.erb +0 -1
  7. data/app/views/foreman_statistics/trends/show.html.erb +6 -6
  8. data/config/jest.config.js +21 -0
  9. data/db/migrate/20210523143005_migrate_environments.rb +13 -0
  10. data/lib/foreman_statistics/engine.rb +6 -5
  11. data/lib/foreman_statistics/version.rb +1 -1
  12. data/locale/ca/LC_MESSAGES/foreman_statistics.mo +0 -0
  13. data/locale/ca/foreman_statistics.edit.po +263 -0
  14. data/locale/ca/foreman_statistics.po +202 -0
  15. data/locale/ca/foreman_statistics.po.time_stamp +0 -0
  16. data/locale/cs_CZ/LC_MESSAGES/foreman_statistics.mo +0 -0
  17. data/locale/cs_CZ/foreman_statistics.edit.po +267 -0
  18. data/locale/cs_CZ/foreman_statistics.po +206 -0
  19. data/locale/cs_CZ/foreman_statistics.po.time_stamp +0 -0
  20. data/locale/de/LC_MESSAGES/foreman_statistics.mo +0 -0
  21. data/locale/de/foreman_statistics.edit.po +271 -0
  22. data/locale/de/foreman_statistics.po +210 -0
  23. data/locale/de/foreman_statistics.po.time_stamp +0 -0
  24. data/locale/en/LC_MESSAGES/foreman_statistics.mo +0 -0
  25. data/locale/en/foreman_statistics.edit.po +1 -1
  26. data/locale/en/foreman_statistics.po +1 -1
  27. data/locale/en_GB/LC_MESSAGES/foreman_statistics.mo +0 -0
  28. data/locale/en_GB/foreman_statistics.edit.po +265 -0
  29. data/locale/en_GB/foreman_statistics.po +204 -0
  30. data/locale/en_GB/foreman_statistics.po.time_stamp +0 -0
  31. data/locale/es/LC_MESSAGES/foreman_statistics.mo +0 -0
  32. data/locale/es/foreman_statistics.edit.po +269 -0
  33. data/locale/es/foreman_statistics.po +208 -0
  34. data/locale/es/foreman_statistics.po.time_stamp +0 -0
  35. data/locale/foreman_statistics.pot +2 -2
  36. data/locale/fr/LC_MESSAGES/foreman_statistics.mo +0 -0
  37. data/locale/fr/foreman_statistics.edit.po +269 -0
  38. data/locale/fr/foreman_statistics.po +208 -0
  39. data/locale/fr/foreman_statistics.po.time_stamp +0 -0
  40. data/locale/gl/LC_MESSAGES/foreman_statistics.mo +0 -0
  41. data/locale/gl/foreman_statistics.edit.po +263 -0
  42. data/locale/gl/foreman_statistics.po +202 -0
  43. data/locale/gl/foreman_statistics.po.time_stamp +0 -0
  44. data/locale/it/LC_MESSAGES/foreman_statistics.mo +0 -0
  45. data/locale/it/foreman_statistics.edit.po +265 -0
  46. data/locale/it/foreman_statistics.po +204 -0
  47. data/locale/it/foreman_statistics.po.time_stamp +0 -0
  48. data/locale/ja/LC_MESSAGES/foreman_statistics.mo +0 -0
  49. data/locale/ja/foreman_statistics.edit.po +266 -0
  50. data/locale/ja/foreman_statistics.po +205 -0
  51. data/locale/ja/foreman_statistics.po.time_stamp +0 -0
  52. data/locale/ko/LC_MESSAGES/foreman_statistics.mo +0 -0
  53. data/locale/ko/foreman_statistics.edit.po +264 -0
  54. data/locale/ko/foreman_statistics.po +203 -0
  55. data/locale/ko/foreman_statistics.po.time_stamp +0 -0
  56. data/locale/nl_NL/LC_MESSAGES/foreman_statistics.mo +0 -0
  57. data/locale/nl_NL/foreman_statistics.edit.po +267 -0
  58. data/locale/nl_NL/foreman_statistics.po +206 -0
  59. data/locale/nl_NL/foreman_statistics.po.time_stamp +0 -0
  60. data/locale/pl/LC_MESSAGES/foreman_statistics.mo +0 -0
  61. data/locale/pl/foreman_statistics.edit.po +266 -0
  62. data/locale/pl/foreman_statistics.po +205 -0
  63. data/locale/pl/foreman_statistics.po.time_stamp +0 -0
  64. data/locale/pt_BR/LC_MESSAGES/foreman_statistics.mo +0 -0
  65. data/locale/pt_BR/foreman_statistics.edit.po +269 -0
  66. data/locale/pt_BR/foreman_statistics.po +208 -0
  67. data/locale/pt_BR/foreman_statistics.po.time_stamp +0 -0
  68. data/locale/ru/LC_MESSAGES/foreman_statistics.mo +0 -0
  69. data/locale/ru/foreman_statistics.edit.po +270 -0
  70. data/locale/ru/foreman_statistics.po +209 -0
  71. data/locale/ru/foreman_statistics.po.time_stamp +0 -0
  72. data/locale/sv_SE/LC_MESSAGES/foreman_statistics.mo +0 -0
  73. data/locale/sv_SE/foreman_statistics.edit.po +265 -0
  74. data/locale/sv_SE/foreman_statistics.po +204 -0
  75. data/locale/sv_SE/foreman_statistics.po.time_stamp +0 -0
  76. data/locale/zh_CN/LC_MESSAGES/foreman_statistics.mo +0 -0
  77. data/locale/zh_CN/foreman_statistics.edit.po +267 -0
  78. data/locale/zh_CN/foreman_statistics.po +206 -0
  79. data/locale/zh_CN/foreman_statistics.po.time_stamp +0 -0
  80. data/locale/zh_TW/LC_MESSAGES/foreman_statistics.mo +0 -0
  81. data/locale/zh_TW/foreman_statistics.edit.po +266 -0
  82. data/locale/zh_TW/foreman_statistics.po +205 -0
  83. data/locale/zh_TW/foreman_statistics.po.time_stamp +0 -0
  84. data/package.json +20 -20
  85. data/test/functional/foreman_statistics/api/v2/trends_controller_test.rb +1 -1
  86. data/test/functional/foreman_statistics/trends_controller_test.rb +0 -6
  87. data/webpack/src/Components/StatisticsChartsList/__snapshots__/StatisticsChartsList.test.js.snap +6 -0
  88. data/webpack/src/Router/StatisticsPage/__tests__/__snapshots__/StatisticsPage.test.js.snap +10 -0
  89. metadata +74 -87
  90. data/app/models/concerns/foreman_statistics/compute_resource_decorations.rb +0 -9
  91. data/app/models/concerns/foreman_statistics/environment_decorations.rb +0 -9
  92. data/app/models/concerns/foreman_statistics/hostgroup_decorations.rb +0 -9
  93. data/app/models/concerns/foreman_statistics/model_decorations.rb +0 -9
  94. data/app/models/concerns/foreman_statistics/operatingsystem_decorations.rb +0 -9
  95. data/webpack/__mocks__/foremanReact/API.js +0 -7
  96. data/webpack/__mocks__/foremanReact/common/HOC.js +0 -24
  97. data/webpack/__mocks__/foremanReact/common/I18n.js +0 -3
  98. data/webpack/__mocks__/foremanReact/common/helpers.js +0 -1
  99. data/webpack/__mocks__/foremanReact/common/urlHelpers.js +0 -1
  100. data/webpack/__mocks__/foremanReact/components/ChartBox/index.js +0 -2
  101. data/webpack/__mocks__/foremanReact/components/ForemanModal/ForemanModalActions.js +0 -2
  102. data/webpack/__mocks__/foremanReact/components/ForemanModal/ForemanModalHooks.js +0 -10
  103. data/webpack/__mocks__/foremanReact/components/ForemanModal/index.js +0 -4
  104. data/webpack/__mocks__/foremanReact/components/Layout/LayoutActions.js +0 -2
  105. data/webpack/__mocks__/foremanReact/components/Pagination/PaginationWrapper.js +0 -2
  106. data/webpack/__mocks__/foremanReact/components/common/EmptyState.js +0 -5
  107. data/webpack/__mocks__/foremanReact/components/common/MessageBox.js +0 -4
  108. data/webpack/__mocks__/foremanReact/components/common/dates/LongDateTime.js +0 -5
  109. data/webpack/__mocks__/foremanReact/components/common/dates/RelativeDateTime.js +0 -3
  110. data/webpack/__mocks__/foremanReact/components/common/table.js +0 -5
  111. data/webpack/__mocks__/foremanReact/components/common/table/actionsHelpers/actionTypeCreator.js +0 -7
  112. data/webpack/__mocks__/foremanReact/constants.js +0 -24
  113. data/webpack/__mocks__/foremanReact/readme.md +0 -11
  114. data/webpack/__mocks__/foremanReact/redux/actions/toasts.js +0 -8
  115. data/webpack/__mocks__/foremanReact/routes/common/PageLayout/PageLayout.js +0 -10
  116. data/webpack/__mocks__/foremanReact/routes/common/PageLayout/components/ExportButton/ExportButton.js +0 -5
  117. data/webpack/__mocks__/foremanReact/routes/common/reducerHOC/withDataReducer.js +0 -35
@@ -1,9 +0,0 @@
1
- module ForemanStatistics
2
- module ComputeResourceDecorations
3
- extend ActiveSupport::Concern
4
-
5
- included do
6
- has_many :trends, :as => :trendable, :class_name => 'ForemanStatistics::ForemanTrend'
7
- end
8
- end
9
- end
@@ -1,9 +0,0 @@
1
- module ForemanStatistics
2
- module EnvironmentDecorations
3
- extend ActiveSupport::Concern
4
-
5
- included do
6
- has_many :trends, :as => :trendable, :class_name => 'ForemanStatistics::ForemanTrend'
7
- end
8
- end
9
- end
@@ -1,9 +0,0 @@
1
- module ForemanStatistics
2
- module HostgroupDecorations
3
- extend ActiveSupport::Concern
4
-
5
- included do
6
- has_many :trends, :as => :trendable, :class_name => 'ForemanStatistics::ForemanTrend'
7
- end
8
- end
9
- end
@@ -1,9 +0,0 @@
1
- module ForemanStatistics
2
- module ModelDecorations
3
- extend ActiveSupport::Concern
4
-
5
- included do
6
- has_many :trends, :as => :trendable, :class_name => 'ForemanStatistics::ForemanTrend'
7
- end
8
- end
9
- end
@@ -1,9 +0,0 @@
1
- module ForemanStatistics
2
- module OperatingsystemDecorations
3
- extend ActiveSupport::Concern
4
-
5
- included do
6
- has_many :trends, :as => :trendable, :class_name => 'ForemanStatistics::ForemanTrend'
7
- end
8
- end
9
- end
@@ -1,7 +0,0 @@
1
- export default {
2
- get: jest.fn(),
3
- put: jest.fn(),
4
- post: jest.fn(),
5
- delete: jest.fn(),
6
- patch: jest.fn(),
7
- };
@@ -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,3 +0,0 @@
1
- export const translate = s => s;
2
-
3
- export const documentLocale = () => 'en';
@@ -1 +0,0 @@
1
- export const noop = Function.prototype;
@@ -1 +0,0 @@
1
- export const getURIsearch = () => 'a=b';
@@ -1,2 +0,0 @@
1
- const ConnectedChartBox = () => jest.fn();
2
- export default ConnectedChartBox;
@@ -1,2 +0,0 @@
1
- const ForemanModalActions = () => jest.fn();
2
- export default ForemanModalActions;
@@ -1,10 +0,0 @@
1
- const modalOpen = true;
2
- const setModalOpen = jest.fn();
3
- const setModalClosed = jest.fn();
4
-
5
- export const useForemanModal = () => ({
6
- modalOpen,
7
- setModalOpen,
8
- setModalClosed,
9
- });
10
- export default useForemanModal;
@@ -1,4 +0,0 @@
1
- const ForemanModal = () => jest.fn();
2
- ForemanModal.Header = () => jest.fn();
3
- ForemanModal.Footer = () => jest.fn();
4
- export default ForemanModal;
@@ -1,2 +0,0 @@
1
- export const showLoading = () => null;
2
- export const hideLoading = () => null;
@@ -1,2 +0,0 @@
1
- const PaginationWrapper = () => jest.fn();
2
- export default PaginationWrapper;
@@ -1,5 +0,0 @@
1
- const EmptyState = () => jest.fn();
2
-
3
- export const EmptyStatePattern = () => jest.fn();
4
-
5
- export default EmptyState;
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
-
3
- export const MessageBox = () => <div className="message-box-root" />;
4
- export default MessageBox;
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
-
3
- export const LongDateTime = value => <p>{value}</p>;
4
-
5
- export default LongDateTime;
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
-
3
- export default date => <p>{`${date} time ago`}</p>;
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
-
3
- export const Table = () => <div className="table" />;
4
- export const createTableReducer = jest.fn(controller => controller);
5
- export const cellFormatter = cell => cell;
@@ -1,7 +0,0 @@
1
- const createTableActionTypes = tableID => ({
2
- REQUEST: `${tableID.toUpperCase()}_REQUEST`,
3
- SUCCESS: `${tableID.toUpperCase()}_SUCCESS`,
4
- FAILURE: `${tableID.toUpperCase()}_FAILURE`,
5
- });
6
-
7
- export default createTableActionTypes;
@@ -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,8 +0,0 @@
1
- export const addToast = toast => ({
2
- type: 'TOASTS_ADD',
3
- payload: {
4
- message: toast,
5
- },
6
- });
7
-
8
- export default addToast;
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
-
4
- const PageLayout = ({ children }) => <div>{children}</div>;
5
-
6
- PageLayout.propTypes = {
7
- children: PropTypes.node.isRequired,
8
- };
9
-
10
- export default PageLayout;
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
-
3
- const ExportButton = () => <button>export</button>;
4
-
5
- export default ExportButton;
@@ -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;