Skip to content

Commit

Permalink
Added missing units on Heatmap tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
h-kataria committed Jan 18, 2017
1 parent 15936e9 commit 3bdc651
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Expand Up @@ -87,7 +87,7 @@ angular.module('miq.util').factory('infraChartsMixin', ['pfUtils', function(pfUt
tooltip += "<br> " + __("Usage: Unknown");
} else {
percent = d.percent
tooltip += "<br>" + __("Usage: ") + sprintf(__("%d%% in use of %d total"), (percent * 100).toFixed(0), d.total);
tooltip += "<br>" + __("Usage: ") + sprintf(__("%d%% in use of %d %s total"), (percent * 100).toFixed(0), d.total, d.unit);
}

return {
Expand Down
6 changes: 4 additions & 2 deletions app/services/ems_infra_dashboard_service.rb
Expand Up @@ -105,6 +105,7 @@ def heatmaps
:id => m.resource.id,
:node => m.resource.name,
:provider => provider_name,
:unit => "Cores",
:total => m.derived_vm_numvcpus.present? ? m.derived_vm_numvcpus.round : nil,
:percent => m.cpu_usage_rate_average.present? ?
(m.cpu_usage_rate_average / 100.0).round(CPU_USAGE_PRECISION) : nil # pf accepts fractions 90% = 0.90
Expand All @@ -114,7 +115,8 @@ def heatmaps
:id => m.resource.id,
:node => m.resource.name,
:provider => m.resource.ext_management_system.name,
:total => m.derived_memory_available.present? ? m.derived_memory_available.round : nil,
:unit => "GB",
:total => m.derived_memory_available.present? ? (m.derived_memory_available / 1024).round : nil,
:percent => m.mem_usage_absolute_average.present? ?
(m.mem_usage_absolute_average / 100.0).round(CPU_USAGE_PRECISION) : nil # pf accepts fractions 90% = 0.90
}
Expand Down Expand Up @@ -201,6 +203,6 @@ def daily_provider_metrics

@daily_metrics ||= Metric::Helper.find_for_interval_name('daily', tp)
.where(:resource => (@ems || ManageIQ::Providers::InfraManager.all))
.where('timestamp > ?', 30.days.ago.utc).order('timestamp')
.where('timestamp > ?', 30000.days.ago.utc).order('timestamp')
end
end

0 comments on commit 3bdc651

Please sign in to comment.