From 242aa5bd66038e5c7393f17be51a73deaedd7d06 Mon Sep 17 00:00:00 2001 From: Josh Frye <joshfng@gmail.com> Date: Thu, 23 Jun 2016 08:52:19 -0400 Subject: [PATCH] Round figures for system info --- app/controllers/admin/system_info_controller.rb | 8 ++++---- app/views/admin/system_info/show.html.haml | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/controllers/admin/system_info_controller.rb b/app/controllers/admin/system_info_controller.rb index a548f941dc5..ab05ed2612a 100644 --- a/app/controllers/admin/system_info_controller.rb +++ b/app/controllers/admin/system_info_controller.rb @@ -3,10 +3,10 @@ class Admin::SystemInfoController < Admin::ApplicationController system_info = Vmstat.snapshot @load = system_info.load_average.collect { |v| v.round(2) }.join(', ') - @mem_used = Filesize.from("#{system_info.memory.active_bytes} B").to_s('GB') - @mem_total = Filesize.from("#{system_info.memory.total_bytes} B").to_s('GB') + @mem_used = Filesize.from("#{system_info.memory.active_bytes} B").to_f('GB').round + @mem_total = Filesize.from("#{system_info.memory.total_bytes} B").to_f('GB').round - @disk_used = Filesize.from("#{system_info.disks[0].used_bytes} B").to_s('GB') - @disk_total = Filesize.from("#{system_info.disks[0].total_bytes} B").to_s('GB') + @disk_used = Filesize.from("#{system_info.disks[0].used_bytes} B").to_f('GB').round + @disk_total = Filesize.from("#{system_info.disks[0].total_bytes} B").to_f('GB').round end end diff --git a/app/views/admin/system_info/show.html.haml b/app/views/admin/system_info/show.html.haml index 2a1fac6e48b..316a94f4d41 100644 --- a/app/views/admin/system_info/show.html.haml +++ b/app/views/admin/system_info/show.html.haml @@ -14,9 +14,9 @@ .light-well %h4 Memory .data - %h1= "#{@mem_used} / #{@mem_total}" + %h1= "#{@mem_used}GB / #{@mem_total}GB" .col-sm-4 .light-well %h4 Disk .data - %h1= "#{@disk_used} / #{@disk_total}" + %h1= "#{@disk_used}GB / #{@disk_total}GB" -- GitLab