foreman_statistics 1.1.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/foreman_statistics/api/v2/statistics_controller.rb +8 -6
  3. data/app/helpers/foreman_statistics/trends_helper.rb +30 -20
  4. data/app/models/concerns/foreman_statistics/has_many_trends.rb +9 -0
  5. data/app/models/foreman_statistics/trend.rb +3 -1
  6. data/app/services/foreman_statistics/statistics/count_hosts.rb +26 -1
  7. data/app/services/foreman_statistics/statistics/count_puppet_classes.rb +1 -1
  8. data/app/services/foreman_statistics/statistics.rb +4 -2
  9. data/app/views/foreman_statistics/trends/_hosts.html.erb +1 -1
  10. data/app/views/foreman_statistics/trends/index.html.erb +0 -1
  11. data/app/views/foreman_statistics/trends/show.html.erb +6 -6
  12. data/config/jest.config.js +21 -0
  13. data/db/migrate/20210523143005_migrate_environments.rb +13 -0
  14. data/lib/foreman_statistics/engine.rb +17 -13
  15. data/lib/foreman_statistics/version.rb +1 -1
  16. data/locale/ca/LC_MESSAGES/foreman_statistics.mo +0 -0
  17. data/locale/ca/foreman_statistics.edit.po +263 -0
  18. data/locale/ca/foreman_statistics.po +202 -0
  19. data/locale/ca/foreman_statistics.po.time_stamp +0 -0
  20. data/locale/cs_CZ/LC_MESSAGES/foreman_statistics.mo +0 -0
  21. data/locale/cs_CZ/foreman_statistics.edit.po +267 -0
  22. data/locale/cs_CZ/foreman_statistics.po +206 -0
  23. data/locale/cs_CZ/foreman_statistics.po.time_stamp +0 -0
  24. data/locale/de/LC_MESSAGES/foreman_statistics.mo +0 -0
  25. data/locale/de/foreman_statistics.edit.po +271 -0
  26. data/locale/de/foreman_statistics.po +210 -0
  27. data/locale/de/foreman_statistics.po.time_stamp +0 -0
  28. data/locale/en/LC_MESSAGES/foreman_statistics.mo +0 -0
  29. data/locale/en/foreman_statistics.edit.po +1 -1
  30. data/locale/en/foreman_statistics.po +1 -1
  31. data/locale/en_GB/LC_MESSAGES/foreman_statistics.mo +0 -0
  32. data/locale/en_GB/foreman_statistics.edit.po +265 -0
  33. data/locale/en_GB/foreman_statistics.po +204 -0
  34. data/locale/en_GB/foreman_statistics.po.time_stamp +0 -0
  35. data/locale/es/LC_MESSAGES/foreman_statistics.mo +0 -0
  36. data/locale/es/foreman_statistics.edit.po +269 -0
  37. data/locale/es/foreman_statistics.po +208 -0
  38. data/locale/es/foreman_statistics.po.time_stamp +0 -0
  39. data/locale/foreman_statistics.pot +2 -2
  40. data/locale/fr/LC_MESSAGES/foreman_statistics.mo +0 -0
  41. data/locale/fr/foreman_statistics.edit.po +269 -0
  42. data/locale/fr/foreman_statistics.po +208 -0
  43. data/locale/fr/foreman_statistics.po.time_stamp +0 -0
  44. data/locale/gl/LC_MESSAGES/foreman_statistics.mo +0 -0
  45. data/locale/gl/foreman_statistics.edit.po +263 -0
  46. data/locale/gl/foreman_statistics.po +202 -0
  47. data/locale/gl/foreman_statistics.po.time_stamp +0 -0
  48. data/locale/it/LC_MESSAGES/foreman_statistics.mo +0 -0
  49. data/locale/it/foreman_statistics.edit.po +265 -0
  50. data/locale/it/foreman_statistics.po +204 -0
  51. data/locale/it/foreman_statistics.po.time_stamp +0 -0
  52. data/locale/ja/LC_MESSAGES/foreman_statistics.mo +0 -0
  53. data/locale/ja/foreman_statistics.edit.po +266 -0
  54. data/locale/ja/foreman_statistics.po +205 -0
  55. data/locale/ja/foreman_statistics.po.time_stamp +0 -0
  56. data/locale/ko/LC_MESSAGES/foreman_statistics.mo +0 -0
  57. data/locale/ko/foreman_statistics.edit.po +264 -0
  58. data/locale/ko/foreman_statistics.po +203 -0
  59. data/locale/ko/foreman_statistics.po.time_stamp +0 -0
  60. data/locale/nl_NL/LC_MESSAGES/foreman_statistics.mo +0 -0
  61. data/locale/nl_NL/foreman_statistics.edit.po +267 -0
  62. data/locale/nl_NL/foreman_statistics.po +206 -0
  63. data/locale/nl_NL/foreman_statistics.po.time_stamp +0 -0
  64. data/locale/pl/LC_MESSAGES/foreman_statistics.mo +0 -0
  65. data/locale/pl/foreman_statistics.edit.po +266 -0
  66. data/locale/pl/foreman_statistics.po +205 -0
  67. data/locale/pl/foreman_statistics.po.time_stamp +0 -0
  68. data/locale/pt_BR/LC_MESSAGES/foreman_statistics.mo +0 -0
  69. data/locale/pt_BR/foreman_statistics.edit.po +269 -0
  70. data/locale/pt_BR/foreman_statistics.po +208 -0
  71. data/locale/pt_BR/foreman_statistics.po.time_stamp +0 -0
  72. data/locale/ru/LC_MESSAGES/foreman_statistics.mo +0 -0
  73. data/locale/ru/foreman_statistics.edit.po +270 -0
  74. data/locale/ru/foreman_statistics.po +209 -0
  75. data/locale/ru/foreman_statistics.po.time_stamp +0 -0
  76. data/locale/sv_SE/LC_MESSAGES/foreman_statistics.mo +0 -0
  77. data/locale/sv_SE/foreman_statistics.edit.po +265 -0
  78. data/locale/sv_SE/foreman_statistics.po +204 -0
  79. data/locale/sv_SE/foreman_statistics.po.time_stamp +0 -0
  80. data/locale/zh_CN/LC_MESSAGES/foreman_statistics.mo +0 -0
  81. data/locale/zh_CN/foreman_statistics.edit.po +267 -0
  82. data/locale/zh_CN/foreman_statistics.po +206 -0
  83. data/locale/zh_CN/foreman_statistics.po.time_stamp +0 -0
  84. data/locale/zh_TW/LC_MESSAGES/foreman_statistics.mo +0 -0
  85. data/locale/zh_TW/foreman_statistics.edit.po +266 -0
  86. data/locale/zh_TW/foreman_statistics.po +205 -0
  87. data/locale/zh_TW/foreman_statistics.po.time_stamp +0 -0
  88. data/package.json +25 -24
  89. data/test/functional/foreman_statistics/api/v2/trends_controller_test.rb +1 -1
  90. data/test/functional/foreman_statistics/trends_controller_test.rb +0 -7
  91. data/test/unit/foreman_statistics/statistics_test.rb +24 -10
  92. data/webpack/src/Components/StatisticsChartsList/__snapshots__/StatisticsChartsList.test.js.snap +6 -0
  93. data/webpack/src/Router/StatisticsPage/__tests__/__snapshots__/StatisticsPage.test.js.snap +10 -0
  94. metadata +77 -92
  95. data/app/models/concerns/foreman_statistics/compute_resource_decorations.rb +0 -9
  96. data/app/models/concerns/foreman_statistics/environment_decorations.rb +0 -9
  97. data/app/models/concerns/foreman_statistics/general_setting_decorations.rb +0 -17
  98. data/app/models/concerns/foreman_statistics/hostgroup_decorations.rb +0 -9
  99. data/app/models/concerns/foreman_statistics/model_decorations.rb +0 -9
  100. data/app/models/concerns/foreman_statistics/operatingsystem_decorations.rb +0 -9
  101. data/app/models/concerns/foreman_statistics/setting_decorations.rb +0 -9
  102. data/webpack/__mocks__/foremanReact/API.js +0 -7
  103. data/webpack/__mocks__/foremanReact/common/HOC.js +0 -24
  104. data/webpack/__mocks__/foremanReact/common/I18n.js +0 -3
  105. data/webpack/__mocks__/foremanReact/common/helpers.js +0 -1
  106. data/webpack/__mocks__/foremanReact/common/urlHelpers.js +0 -1
  107. data/webpack/__mocks__/foremanReact/components/ChartBox/index.js +0 -2
  108. data/webpack/__mocks__/foremanReact/components/ForemanModal/ForemanModalActions.js +0 -2
  109. data/webpack/__mocks__/foremanReact/components/ForemanModal/ForemanModalHooks.js +0 -10
  110. data/webpack/__mocks__/foremanReact/components/ForemanModal/index.js +0 -4
  111. data/webpack/__mocks__/foremanReact/components/Layout/LayoutActions.js +0 -2
  112. data/webpack/__mocks__/foremanReact/components/Pagination/PaginationWrapper.js +0 -2
  113. data/webpack/__mocks__/foremanReact/components/common/EmptyState.js +0 -5
  114. data/webpack/__mocks__/foremanReact/components/common/MessageBox.js +0 -4
  115. data/webpack/__mocks__/foremanReact/components/common/dates/LongDateTime.js +0 -5
  116. data/webpack/__mocks__/foremanReact/components/common/dates/RelativeDateTime.js +0 -3
  117. data/webpack/__mocks__/foremanReact/components/common/table/actionsHelpers/actionTypeCreator.js +0 -7
  118. data/webpack/__mocks__/foremanReact/components/common/table.js +0 -5
  119. data/webpack/__mocks__/foremanReact/constants.js +0 -24
  120. data/webpack/__mocks__/foremanReact/readme.md +0 -11
  121. data/webpack/__mocks__/foremanReact/redux/actions/toasts.js +0 -8
  122. data/webpack/__mocks__/foremanReact/routes/common/PageLayout/PageLayout.js +0 -10
  123. data/webpack/__mocks__/foremanReact/routes/common/PageLayout/components/ExportButton/ExportButton.js +0 -5
  124. data/webpack/__mocks__/foremanReact/routes/common/reducerHOC/withDataReducer.js +0 -35
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_statistics
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ondrej Ezr
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-03 00:00:00.000000000 Z
11
+ date: 2022-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rdoc
@@ -24,62 +24,6 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: rubocop
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: 0.87.0
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: 0.87.0
41
- - !ruby/object:Gem::Dependency
42
- name: rubocop-minitest
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: 0.9.0
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: 0.9.0
55
- - !ruby/object:Gem::Dependency
56
- name: rubocop-performance
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: 1.5.2
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: 1.5.2
69
- - !ruby/object:Gem::Dependency
70
- name: rubocop-rails
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: 2.5.2
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: 2.5.2
83
27
  description: Statistics and Trends for Foreman gives users overview of their infrastructure.
84
28
  email:
85
29
  - oezr@redhat.com
@@ -98,13 +42,7 @@ files:
98
42
  - app/controllers/foreman_statistics/trends_controller.rb
99
43
  - app/helpers/foreman_statistics/trends_helper.rb
100
44
  - app/jobs/foreman_statistics/trend_counter_job.rb
101
- - app/models/concerns/foreman_statistics/compute_resource_decorations.rb
102
- - app/models/concerns/foreman_statistics/environment_decorations.rb
103
- - app/models/concerns/foreman_statistics/general_setting_decorations.rb
104
- - app/models/concerns/foreman_statistics/hostgroup_decorations.rb
105
- - app/models/concerns/foreman_statistics/model_decorations.rb
106
- - app/models/concerns/foreman_statistics/operatingsystem_decorations.rb
107
- - app/models/concerns/foreman_statistics/setting_decorations.rb
45
+ - app/models/concerns/foreman_statistics/has_many_trends.rb
108
46
  - app/models/foreman_statistics/fact_trend.rb
109
47
  - app/models/foreman_statistics/foreman_trend.rb
110
48
  - app/models/foreman_statistics/trend.rb
@@ -132,8 +70,10 @@ files:
132
70
  - app/views/foreman_statistics/trends/new.html.erb
133
71
  - app/views/foreman_statistics/trends/show.html.erb
134
72
  - app/views/foreman_statistics/trends/welcome.html.erb
73
+ - config/jest.config.js
135
74
  - config/routes.rb
136
75
  - db/migrate/20200605153005_migrate_core_types.rb
76
+ - db/migrate/20210523143005_migrate_environments.rb
137
77
  - db/migrate_foreman/20121012170851_create_trends.rb
138
78
  - db/migrate_foreman/20121012170936_create_trend_counters.rb
139
79
  - db/migrate_foreman/20150202094307_add_range_to_trend_counters.rb
@@ -144,12 +84,80 @@ files:
144
84
  - lib/tasks/foreman_statistics_tasks.rake
145
85
  - locale/Makefile
146
86
  - locale/action_names.rb
87
+ - locale/ca/LC_MESSAGES/foreman_statistics.mo
88
+ - locale/ca/foreman_statistics.edit.po
89
+ - locale/ca/foreman_statistics.po
90
+ - locale/ca/foreman_statistics.po.time_stamp
91
+ - locale/cs_CZ/LC_MESSAGES/foreman_statistics.mo
92
+ - locale/cs_CZ/foreman_statistics.edit.po
93
+ - locale/cs_CZ/foreman_statistics.po
94
+ - locale/cs_CZ/foreman_statistics.po.time_stamp
95
+ - locale/de/LC_MESSAGES/foreman_statistics.mo
96
+ - locale/de/foreman_statistics.edit.po
97
+ - locale/de/foreman_statistics.po
98
+ - locale/de/foreman_statistics.po.time_stamp
147
99
  - locale/en/LC_MESSAGES/foreman_statistics.mo
148
100
  - locale/en/foreman_statistics.edit.po
149
101
  - locale/en/foreman_statistics.po
150
102
  - locale/en/foreman_statistics.po.time_stamp
103
+ - locale/en_GB/LC_MESSAGES/foreman_statistics.mo
104
+ - locale/en_GB/foreman_statistics.edit.po
105
+ - locale/en_GB/foreman_statistics.po
106
+ - locale/en_GB/foreman_statistics.po.time_stamp
107
+ - locale/es/LC_MESSAGES/foreman_statistics.mo
108
+ - locale/es/foreman_statistics.edit.po
109
+ - locale/es/foreman_statistics.po
110
+ - locale/es/foreman_statistics.po.time_stamp
151
111
  - locale/foreman_statistics.pot
112
+ - locale/fr/LC_MESSAGES/foreman_statistics.mo
113
+ - locale/fr/foreman_statistics.edit.po
114
+ - locale/fr/foreman_statistics.po
115
+ - locale/fr/foreman_statistics.po.time_stamp
152
116
  - locale/gemspec.rb
117
+ - locale/gl/LC_MESSAGES/foreman_statistics.mo
118
+ - locale/gl/foreman_statistics.edit.po
119
+ - locale/gl/foreman_statistics.po
120
+ - locale/gl/foreman_statistics.po.time_stamp
121
+ - locale/it/LC_MESSAGES/foreman_statistics.mo
122
+ - locale/it/foreman_statistics.edit.po
123
+ - locale/it/foreman_statistics.po
124
+ - locale/it/foreman_statistics.po.time_stamp
125
+ - locale/ja/LC_MESSAGES/foreman_statistics.mo
126
+ - locale/ja/foreman_statistics.edit.po
127
+ - locale/ja/foreman_statistics.po
128
+ - locale/ja/foreman_statistics.po.time_stamp
129
+ - locale/ko/LC_MESSAGES/foreman_statistics.mo
130
+ - locale/ko/foreman_statistics.edit.po
131
+ - locale/ko/foreman_statistics.po
132
+ - locale/ko/foreman_statistics.po.time_stamp
133
+ - locale/nl_NL/LC_MESSAGES/foreman_statistics.mo
134
+ - locale/nl_NL/foreman_statistics.edit.po
135
+ - locale/nl_NL/foreman_statistics.po
136
+ - locale/nl_NL/foreman_statistics.po.time_stamp
137
+ - locale/pl/LC_MESSAGES/foreman_statistics.mo
138
+ - locale/pl/foreman_statistics.edit.po
139
+ - locale/pl/foreman_statistics.po
140
+ - locale/pl/foreman_statistics.po.time_stamp
141
+ - locale/pt_BR/LC_MESSAGES/foreman_statistics.mo
142
+ - locale/pt_BR/foreman_statistics.edit.po
143
+ - locale/pt_BR/foreman_statistics.po
144
+ - locale/pt_BR/foreman_statistics.po.time_stamp
145
+ - locale/ru/LC_MESSAGES/foreman_statistics.mo
146
+ - locale/ru/foreman_statistics.edit.po
147
+ - locale/ru/foreman_statistics.po
148
+ - locale/ru/foreman_statistics.po.time_stamp
149
+ - locale/sv_SE/LC_MESSAGES/foreman_statistics.mo
150
+ - locale/sv_SE/foreman_statistics.edit.po
151
+ - locale/sv_SE/foreman_statistics.po
152
+ - locale/sv_SE/foreman_statistics.po.time_stamp
153
+ - locale/zh_CN/LC_MESSAGES/foreman_statistics.mo
154
+ - locale/zh_CN/foreman_statistics.edit.po
155
+ - locale/zh_CN/foreman_statistics.po
156
+ - locale/zh_CN/foreman_statistics.po.time_stamp
157
+ - locale/zh_TW/LC_MESSAGES/foreman_statistics.mo
158
+ - locale/zh_TW/foreman_statistics.edit.po
159
+ - locale/zh_TW/foreman_statistics.po
160
+ - locale/zh_TW/foreman_statistics.po.time_stamp
153
161
  - package.json
154
162
  - test/factories/foreman_statistics_factories.rb
155
163
  - test/fixtures/permissions.yml
@@ -165,29 +173,6 @@ files:
165
173
  - test/unit/foreman_statistics/statistics_test.rb
166
174
  - test/unit/foreman_statistics_test.rb
167
175
  - test/unit/tasks/foreman_statistics_tasks_test.rb
168
- - webpack/__mocks__/foremanReact/API.js
169
- - webpack/__mocks__/foremanReact/common/HOC.js
170
- - webpack/__mocks__/foremanReact/common/I18n.js
171
- - webpack/__mocks__/foremanReact/common/helpers.js
172
- - webpack/__mocks__/foremanReact/common/urlHelpers.js
173
- - webpack/__mocks__/foremanReact/components/ChartBox/index.js
174
- - webpack/__mocks__/foremanReact/components/ForemanModal/ForemanModalActions.js
175
- - webpack/__mocks__/foremanReact/components/ForemanModal/ForemanModalHooks.js
176
- - webpack/__mocks__/foremanReact/components/ForemanModal/index.js
177
- - webpack/__mocks__/foremanReact/components/Layout/LayoutActions.js
178
- - webpack/__mocks__/foremanReact/components/Pagination/PaginationWrapper.js
179
- - webpack/__mocks__/foremanReact/components/common/EmptyState.js
180
- - webpack/__mocks__/foremanReact/components/common/MessageBox.js
181
- - webpack/__mocks__/foremanReact/components/common/dates/LongDateTime.js
182
- - webpack/__mocks__/foremanReact/components/common/dates/RelativeDateTime.js
183
- - webpack/__mocks__/foremanReact/components/common/table.js
184
- - webpack/__mocks__/foremanReact/components/common/table/actionsHelpers/actionTypeCreator.js
185
- - webpack/__mocks__/foremanReact/constants.js
186
- - webpack/__mocks__/foremanReact/readme.md
187
- - webpack/__mocks__/foremanReact/redux/actions/toasts.js
188
- - webpack/__mocks__/foremanReact/routes/common/PageLayout/PageLayout.js
189
- - webpack/__mocks__/foremanReact/routes/common/PageLayout/components/ExportButton/ExportButton.js
190
- - webpack/__mocks__/foremanReact/routes/common/reducerHOC/withDataReducer.js
191
176
  - webpack/fills_index.js
192
177
  - webpack/index.js
193
178
  - webpack/src/Components/StatisticsChartsList/StatisticsChartsList.fixtures.js
@@ -221,7 +206,7 @@ homepage: https://theforeman.org
221
206
  licenses:
222
207
  - GPL-3.0
223
208
  metadata: {}
224
- post_install_message:
209
+ post_install_message:
225
210
  rdoc_options: []
226
211
  require_paths:
227
212
  - lib
@@ -236,8 +221,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
236
221
  - !ruby/object:Gem::Version
237
222
  version: '0'
238
223
  requirements: []
239
- rubygems_version: 3.1.4
240
- signing_key:
224
+ rubygems_version: 3.3.4
225
+ signing_key:
241
226
  specification_version: 4
242
227
  summary: Add Statistics and Trends.
243
228
  test_files:
@@ -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,17 +0,0 @@
1
- module ForemanStatistics
2
- module GeneralSettingDecorations
3
- def self.prepended(base)
4
- class << base
5
- prepend ClassMethodsPrepend
6
- end
7
- end
8
-
9
- module ClassMethodsPrepend
10
- def default_settings
11
- super.concat([
12
- set('max_trend', N_('Max days for Trends graphs'), 30, N_('Max trends'))
13
- ])
14
- end
15
- end
16
- end
17
- 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,9 +0,0 @@
1
- module ForemanStatistics
2
- module SettingDecorations
3
- extend ActiveSupport::Concern
4
-
5
- included do
6
- Setting::NONZERO_ATTRS.push('max_trend')
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,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,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,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;