A touch more abstraction.
This commit is contained in:
parent
ed43a27e46
commit
b9ba87e7d3
|
|
@ -442,6 +442,11 @@ function fmt_resource_bar(used_label, limit_label, ratio, colour, help) {
|
|||
return res;
|
||||
}
|
||||
|
||||
function fmt_resource_bar_count(used, total, thresholds) {
|
||||
return fmt_resource_bar(used, total + ' available', used / total,
|
||||
fmt_color(used / total, thresholds));
|
||||
}
|
||||
|
||||
function fmt_shortened_uri(uri0) {
|
||||
var uri = fmt_escape_html(uri0);
|
||||
if (uri.indexOf('?') == -1) {
|
||||
|
|
|
|||
|
|
@ -14,10 +14,7 @@
|
|||
File descriptors <span class="help" id="file-descriptors"></span>
|
||||
</th>
|
||||
<td>
|
||||
<%= fmt_resource_bar(node.fd_used,
|
||||
node.fd_total + ' available',
|
||||
node.fd_used / node.fd_total,
|
||||
fmt_color(node.fd_used / node.fd_total, FD_THRESHOLDS)) %>
|
||||
<%= fmt_resource_bar_count(node.fd_used, node.fd_total, FD_THRESHOLDS) %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
@ -25,11 +22,7 @@
|
|||
Socket descriptors <span class="help" id="socket-descriptors"></span>
|
||||
</th>
|
||||
<td>
|
||||
<%= fmt_resource_bar(node.sockets_used,
|
||||
node.sockets_total + ' available',
|
||||
node.sockets_used / node.sockets_total,
|
||||
fmt_color(node.sockets_used / node.sockets_total,
|
||||
FD_THRESHOLDS)) %>
|
||||
<%= fmt_resource_bar_count(node.sockets_used, node.sockets_total, FD_THRESHOLDS) %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
@ -37,11 +30,7 @@
|
|||
Erlang processes
|
||||
</th>
|
||||
<td>
|
||||
<%= fmt_resource_bar(node.proc_used,
|
||||
node.proc_total + ' available',
|
||||
node.proc_used / node.proc_total,
|
||||
fmt_color(node.proc_used / node.proc_total,
|
||||
PROCESS_THRESHOLDS)) %>
|
||||
<%= fmt_resource_bar_count(node.proc_used, node.proc_total, PROCESS_THRESHOLDS) %>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
|
|
|||
Loading…
Reference in New Issue