Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
af88669a0f48
Commit
242aa5bd
authored
Jun 23, 2016
by
Josh Frye
Browse files
Round figures for system info
parent
f8db6feca94d
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/controllers/admin/system_info_controller.rb
View file @
af88669a
...
...
@@ -3,10 +3,10 @@ def show
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
app/views/admin/system_info/show.html.haml
View file @
af88669a
...
...
@@ -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
"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment