From 85f9b761767801952b884aadbf5594fe41c4ea1c Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Wed, 7 Feb 2018 21:05:38 -0500 Subject: [PATCH] Add disk space usage info --- src/bitrate.js | 5 ++++- src/ui/server.js | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/bitrate.js b/src/bitrate.js index 63a024d..7afe386 100644 --- a/src/bitrate.js +++ b/src/bitrate.js @@ -15,7 +15,9 @@ export function convertFromBitrate(value, unit) { } 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"]; } else if (bitrate > Rates["MiB/s"]) { return [bitrate / Rates["MiB/s"], "MiB/s"]; @@ -46,6 +48,7 @@ export function formatBitrate(bitrate) { export function formatAmount(amount) { const units = { + "TiB/s": "TiB", "GiB/s": "GiB", "MiB/s": "MiB", "KiB/s": "KiB", diff --git a/src/ui/server.js b/src/ui/server.js index 5a3423b..934b0c4 100644 --- a/src/ui/server.js +++ b/src/ui/server.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import { connect } from 'react-redux'; import moment from 'moment'; -import { formatBitrate } from '../bitrate'; +import { formatBitrate, formatAmount } from '../bitrate'; import { ws_disconnect } from '../socket'; import DateDisplay from './date'; import Ratio from './ratio'; @@ -28,6 +28,8 @@ function Server({ server, dispatch }) {
Running since
+
Disk space free
+
{formatAmount(server.free_space)}
Current network use
{`${