Display unlimited throttle correctly

This commit is contained in:
Drew DeVault 2017-09-08 13:57:21 +09:00
parent a1aa140848
commit 589150b817

View File

@ -2,6 +2,10 @@ import React, { Component } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { formatBitrate } from '../bitrate'; import { formatBitrate } from '../bitrate';
function throttle(v) {
return v === null ? "Unlimited" : formatBitrate(v);
}
function Server({ server }) { function Server({ server }) {
if (!server.id) { if (!server.id) {
// TODO: websocket status? // TODO: websocket status?
@ -20,9 +24,9 @@ function Server({ server }) {
<dd>{formatBitrate(server.rate_down)}</dd> <dd>{formatBitrate(server.rate_down)}</dd>
{/* TODO: Editable */} {/* TODO: Editable */}
<dt>Throttle up</dt> <dt>Throttle up</dt>
<dd>{formatBitrate(server.throttle_up)}</dd> <dd>{throttle(server.throttle_up)}</dd>
<dt>Throttle down</dt> <dt>Throttle down</dt>
<dd>{formatBitrate(server.throttle_down)}</dd> <dd>{throttle(server.throttle_down)}</dd>
</dl> </dl>
</div> </div>
); );