Add disk space usage info

This commit is contained in:
Drew DeVault 2018-02-07 21:05:38 -05:00
parent 653e31ca25
commit 85f9b76176
2 changed files with 7 additions and 2 deletions

View File

@ -15,7 +15,9 @@ export function convertFromBitrate(value, unit) {
} }
export function convertedRate(bitrate) { export function convertedRate(bitrate) {
if (bitrate > Rates["GiB/s"]) { if (bitrate > Rates["TiB/s"]) {
return [bitrate / Rates["TiB/s"], "TiB/s"];
} else if (bitrate > Rates["GiB/s"]) {
return [bitrate / Rates["GiB/s"], "GiB/s"]; return [bitrate / Rates["GiB/s"], "GiB/s"];
} else if (bitrate > Rates["MiB/s"]) { } else if (bitrate > Rates["MiB/s"]) {
return [bitrate / Rates["MiB/s"], "MiB/s"]; return [bitrate / Rates["MiB/s"], "MiB/s"];
@ -46,6 +48,7 @@ export function formatBitrate(bitrate) {
export function formatAmount(amount) { export function formatAmount(amount) {
const units = { const units = {
"TiB/s": "TiB",
"GiB/s": "GiB", "GiB/s": "GiB",
"MiB/s": "MiB", "MiB/s": "MiB",
"KiB/s": "KiB", "KiB/s": "KiB",

View File

@ -1,7 +1,7 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import moment from 'moment'; import moment from 'moment';
import { formatBitrate } from '../bitrate'; import { formatBitrate, formatAmount } from '../bitrate';
import { ws_disconnect } from '../socket'; import { ws_disconnect } from '../socket';
import DateDisplay from './date'; import DateDisplay from './date';
import Ratio from './ratio'; import Ratio from './ratio';
@ -28,6 +28,8 @@ function Server({ server, dispatch }) {
<dl> <dl>
<dt>Running since</dt> <dt>Running since</dt>
<dd><DateDisplay when={moment(server.started)} /></dd> <dd><DateDisplay when={moment(server.started)} /></dd>
<dt>Disk space free</dt>
<dd>{formatAmount(server.free_space)}</dd>
<dt>Current network use</dt> <dt>Current network use</dt>
<dd> <dd>
{`${ {`${