foreman_omaha 5.0.0 → 5.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c0ee3bbe2a41f9d5ac5ffac14c72895f5f523ba58691cdbd59c21086638d74b7
4
- data.tar.gz: 6348671022cae92df4f7da03f665514234f325be028c523db136ab3c81244eea
3
+ metadata.gz: 4de0935e85838acb0fdd917072c2619b9fb24eb9496f8075ecf5addc0c517e4f
4
+ data.tar.gz: '0047259a6a55630216f155c2751c391256fddb5b11d8f47a2494d647283b4a62'
5
5
  SHA512:
6
- metadata.gz: b97bae1c564d7745876cae86a16558f986057a63553676e8c55e6199208c810cceeca7f8a588bb637399fc32c485bfac874b61b649dd0e9252752c3226be467c
7
- data.tar.gz: adae755d7a4e0859663bea2495c2ccce1041a7d05d478ae4eca3ca2d8910a8aff3bdcca925165e6a28101005612a5ffc980e7af2a1a0fe427a884b9f92f98ebd
6
+ metadata.gz: d1aa36e5c03a1104802f968f9417217ffcb67c628aefba80efc4ecadd6ba940275d0c08ce9c2a490ec8ddb66782f8bf366945732506ad3244ef3f0e849667447
7
+ data.tar.gz: 32bf0acccb2ebd329f66651874fa1b68822851c7c1c9ce8d85b0c45e29505455b1fd2be09e59c0564f5173f1ddca8940c81dda13f2848817c777ebaaaf6805dd
@@ -13,13 +13,13 @@ module ForemanOmaha
13
13
  version_list = omaha_group.operatingsystems.pluck(:major, :minor).map { |v| Gem::Version.new(v.join('.')) }.sort.reverse
14
14
  current = version_list.max
15
15
  content_tag :div, :class => 'progress version-breakdown' do
16
- safe_join(versions.map do |version|
16
+ safe_join(versions.compact.map do |version|
17
17
  semver = Gem::Version.new(version[:version])
18
18
  position = version_list.index(semver)
19
19
  css = {
20
20
  :width => "#{version[:percentage]}%"
21
21
  }
22
- label = if semver > current
22
+ label = if !current || semver > current
23
23
  :info
24
24
  elsif semver == current
25
25
  :success
@@ -15,10 +15,7 @@ module ForemanOmaha
15
15
 
16
16
  def to_chart_data
17
17
  query.map do |oem, count|
18
- {
19
- :label => oem,
20
- :data => count
21
- }
18
+ [oem, count]
22
19
  end
23
20
  end
24
21
  end
@@ -15,11 +15,7 @@ module ForemanOmaha
15
15
 
16
16
  def to_chart_data
17
17
  query.map do |status, count|
18
- {
19
- :label => status_label(status),
20
- :data => count,
21
- :color => status_color(status)
22
- }
18
+ [status_label(status), count]
23
19
  end
24
20
  end
25
21
 
@@ -15,10 +15,7 @@ module ForemanOmaha
15
15
 
16
16
  def to_chart_data
17
17
  query.map do |version, count|
18
- {
19
- :label => version,
20
- :data => count
21
- }
18
+ [version, count]
22
19
  end
23
20
  end
24
21
  end
@@ -71,37 +71,37 @@
71
71
  <div class="card-pf-body">
72
72
  <div class="row">
73
73
  <div class="col-xs-12 col-sm-4 col-md-4">
74
- <h3 class="card-pf-subtitle"><%= _('Version Distribution') %></h3>
75
74
  <%=
76
- flot_pie_chart(
77
- 'omaha_status_distribution_chart',
78
- _('Version Distribution'),
79
- @version_distribution.to_chart_data,
80
- :class => 'statistics-pie small',
81
- :search => "omaha_group = #{@omaha_group} and omaha_version = ~VAL~"
75
+ react_component('ChartBox', type: 'donut',
76
+ status: 'RESOLVED',
77
+ title: _('Version Distribution'),
78
+ chart: {
79
+ data: @version_distribution.to_chart_data,
80
+ search: hosts_path(search: "omaha_group = #{@omaha_group} and omaha_version = ~VAL~")
81
+ }
82
82
  )
83
83
  %>
84
84
  </div>
85
85
  <div class="col-xs-12 col-sm-4 col-md-4">
86
- <h3 class="card-pf-subtitle"><%= _('Host Upgrade Progress') %></h3>
87
86
  <%=
88
- flot_pie_chart(
89
- 'omaha_status_distribution_chart',
90
- _('Version Distribution'),
91
- @status_distribution.to_chart_data,
92
- :class => 'statistics-pie small'
87
+ react_component('ChartBox', type: 'donut',
88
+ status: 'RESOLVED',
89
+ title: _('Host Upgrade Progress'),
90
+ chart: {
91
+ data: @status_distribution.to_chart_data
92
+ }
93
93
  )
94
94
  %>
95
95
  </div>
96
96
  <div class="col-xs-12 col-sm-4 col-md-4">
97
- <h3 class="card-pf-subtitle"><%= _('OEM Distribution') %></h3>
98
97
  <%=
99
- flot_pie_chart(
100
- 'omaha_oem_distribution_chart',
101
- _('OEM Distribution'),
102
- @oem_distribution.to_chart_data,
103
- :class => 'statistics-pie small',
104
- :search => "omaha_group = #{@omaha_group} and omaha_oem = ~VAL~"
98
+ react_component('ChartBox', type: 'donut',
99
+ status: 'RESOLVED',
100
+ title: _('OEM Distribution'),
101
+ chart: {
102
+ data: @oem_distribution.to_chart_data,
103
+ search: hosts_path(search: "omaha_group = #{@omaha_group} and omaha_oem = ~VAL~")
104
+ }
105
105
  )
106
106
  %>
107
107
  </div>
@@ -186,13 +186,3 @@
186
186
  </div>
187
187
  <% end %>
188
188
  </div>
189
- <script>
190
- $(document).on('ContentLoad', function () {
191
- refreshCharts();
192
- // matchHeight the contents of each .card-pf and then the .card-pf itself
193
- $(".row-cards-pf > [class*='col'] > .card-pf .card-pf-title").matchHeight();
194
- $(".row-cards-pf > [class*='col'] > .card-pf > .card-pf-body").matchHeight();
195
- $(".row-cards-pf > [class*='col'] > .card-pf > .card-pf-footer").matchHeight();
196
- $(".row-cards-pf > [class*='col'] > .card-pf").matchHeight();
197
- });
198
- </script>
@@ -23,6 +23,9 @@ module ForemanOmaha
23
23
  Foreman::Plugin.register :foreman_omaha do
24
24
  requires_foreman '>= 3.0'
25
25
 
26
+ automatic_assets(false)
27
+ precompile_assets(['foreman_omaha/version_breakdown.css', 'foreman_omaha/application.js'])
28
+
26
29
  apipie_documented_controllers ["#{ForemanOmaha::Engine.root}/app/controllers/api/v2/*.rb"]
27
30
 
28
31
  register_custom_status HostStatus::OmahaStatus
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ForemanOmaha
4
- VERSION = '5.0.0'
4
+ VERSION = '5.0.1'
5
5
  end
@@ -17,10 +17,8 @@ module ForemanOmaha
17
17
  end
18
18
 
19
19
  test 'calculates the oem distribution' do
20
- expected = [
21
- { :label => 'rackspace', :data => 5 }
22
- ]
23
- assert_equal(expected, oem_distribition_chart.to_chart_data.sort_by { |e| e[:label] })
20
+ expected = [['rackspace', 5]]
21
+ assert_same_elements expected, oem_distribition_chart.to_chart_data
24
22
  end
25
23
  end
26
24
  end
@@ -18,11 +18,8 @@ module ForemanOmaha
18
18
  end
19
19
 
20
20
  test 'calculates the status distribution' do
21
- expected = [
22
- { :label => 'Complete', :data => 5, :color => '#89A54E' },
23
- { :label => 'Downloading', :data => 3, :color => '#3D96AE' }
24
- ]
25
- assert_equal(expected, status_distribition_chart.to_chart_data.sort_by { |e| e[:label] })
21
+ expected = [['Complete', 5], ['Downloading', 3]]
22
+ assert_same_elements expected, status_distribition_chart.to_chart_data
26
23
  end
27
24
  end
28
25
  end
@@ -18,11 +18,8 @@ module ForemanOmaha
18
18
  end
19
19
 
20
20
  test 'calculates the version distribution' do
21
- expected = [
22
- { :label => '1068.9.0', :data => 5 },
23
- { :label => '1465.7.0', :data => 7 }
24
- ]
25
- assert_equal(expected, version_distribition_chart.to_chart_data.sort_by { |e| e[:label] })
21
+ expected = [['1068.9.0', 5], ['1465.7.0', 7]]
22
+ assert_same_elements expected, version_distribition_chart.to_chart_data
26
23
  end
27
24
  end
28
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_omaha
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0
4
+ version: 5.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Timo Goebel
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-25 00:00:00.000000000 Z
11
+ date: 2022-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jquery-matchheight-rails
@@ -204,7 +204,7 @@ homepage: http://github.com/theforeman/foreman_omaha
204
204
  licenses:
205
205
  - GPL-3
206
206
  metadata: {}
207
- post_install_message:
207
+ post_install_message:
208
208
  rdoc_options: []
209
209
  require_paths:
210
210
  - lib
@@ -219,32 +219,32 @@ required_rubygems_version: !ruby/object:Gem::Requirement
219
219
  - !ruby/object:Gem::Version
220
220
  version: '0'
221
221
  requirements: []
222
- rubygems_version: 3.1.6
223
- signing_key:
222
+ rubygems_version: 3.3.3
223
+ signing_key:
224
224
  specification_version: 4
225
225
  summary: This plug-in adds support for the Omaha procotol to The Foreman.
226
226
  test_files:
227
- - test/unit/omaha_fact_parser_test.rb
228
- - test/unit/charts/version_distribution_test.rb
229
- - test/unit/charts/oem_distribution_test.rb
230
- - test/unit/charts/status_distribution_test.rb
231
- - test/unit/group_version_breakdown_test.rb
232
- - test/unit/host_test.rb
233
- - test/unit/host_status/omaha_status_test.rb
234
- - test/unit/renderer_test.rb
235
- - test/unit/omaha_report_test.rb
236
- - test/graphql/queries/omaha_group_query_test.rb
237
- - test/graphql/queries/omaha_report_query_test.rb
238
- - test/graphql/queries/omaha_groups_query_test.rb
239
- - test/graphql/queries/omaha_reports_query_test.rb
240
- - test/graphql/queries/host_query_extensions_test.rb
241
- - test/factories/smart_proxy.rb
242
227
  - test/factories/feature.rb
243
- - test/factories/host.rb
244
228
  - test/factories/foreman_omaha_factories.rb
245
- - test/test_plugin_helper.rb
246
- - test/functional/omaha_groups_controller_test.rb
247
- - test/functional/omaha_hosts_controller_test.rb
229
+ - test/factories/host.rb
230
+ - test/factories/smart_proxy.rb
248
231
  - test/functional/api/v2/omaha_groups_controller_test.rb
249
232
  - test/functional/api/v2/omaha_reports_controller_test.rb
233
+ - test/functional/omaha_groups_controller_test.rb
234
+ - test/functional/omaha_hosts_controller_test.rb
250
235
  - test/functional/omaha_reports_controller_test.rb
236
+ - test/graphql/queries/host_query_extensions_test.rb
237
+ - test/graphql/queries/omaha_group_query_test.rb
238
+ - test/graphql/queries/omaha_groups_query_test.rb
239
+ - test/graphql/queries/omaha_report_query_test.rb
240
+ - test/graphql/queries/omaha_reports_query_test.rb
241
+ - test/test_plugin_helper.rb
242
+ - test/unit/charts/oem_distribution_test.rb
243
+ - test/unit/charts/status_distribution_test.rb
244
+ - test/unit/charts/version_distribution_test.rb
245
+ - test/unit/group_version_breakdown_test.rb
246
+ - test/unit/host_status/omaha_status_test.rb
247
+ - test/unit/host_test.rb
248
+ - test/unit/omaha_fact_parser_test.rb
249
+ - test/unit/omaha_report_test.rb
250
+ - test/unit/renderer_test.rb