Merge pull request #2031 from Sir3lit/showunlimited

Show "unlimited" not 0
This commit is contained in:
Dane Everitt 2020-06-23 19:24:32 -07:00 committed by GitHub
commit 3d99b50e15
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 7 deletions

View file

@ -52,6 +52,8 @@ export default ({ server, className }: { server: Server; className: string | und
alarms.memory = isAlarmState(stats.memoryUsageInBytes, server.limits.memory); alarms.memory = isAlarmState(stats.memoryUsageInBytes, server.limits.memory);
alarms.disk = server.limits.disk === 0 ? false : isAlarmState(stats.diskUsageInBytes, server.limits.disk); alarms.disk = server.limits.disk === 0 ? false : isAlarmState(stats.diskUsageInBytes, server.limits.disk);
} }
const disklimit = server.limits.disk != 0 ? bytesToHuman(server.limits.disk * 1000 * 1000) : "Unlimited";
const memorylimit = server.limits.memory != 0 ? bytesToHuman(server.limits.memory * 1000 * 1000) : "Unlimited";
return ( return (
<Link to={`/server/${server.id}`} className={`grey-row-box cursor-pointer ${className}`}> <Link to={`/server/${server.id}`} className={`grey-row-box cursor-pointer ${className}`}>
@ -127,7 +129,7 @@ export default ({ server, className }: { server: Server; className: string | und
{bytesToHuman(stats.memoryUsageInBytes)} {bytesToHuman(stats.memoryUsageInBytes)}
</p> </p>
</div> </div>
<p className={'text-xs text-neutral-600 text-center mt-1'}>of {bytesToHuman(server.limits.memory * 1000 * 1000)}</p> <p className={'text-xs text-neutral-600 text-center mt-1'}>of {memorylimit}</p>
</div> </div>
<div className={'flex-1 ml-4'}> <div className={'flex-1 ml-4'}>
<div className={'flex justify-center'}> <div className={'flex justify-center'}>
@ -147,9 +149,7 @@ export default ({ server, className }: { server: Server; className: string | und
{bytesToHuman(stats.diskUsageInBytes)} {bytesToHuman(stats.diskUsageInBytes)}
</p> </p>
</div> </div>
<p className={'text-xs text-neutral-600 text-center mt-1'}> <p className={'text-xs text-neutral-600 text-center mt-1'}>of {disklimit}</p>
of {bytesToHuman(server.limits.disk * 1000 * 1000)}
</p>
</div> </div>
</React.Fragment> </React.Fragment>
} }

View file

@ -81,6 +81,9 @@ export default () => {
}; };
}, [ instance, connected ]); }, [ instance, connected ]);
const disklimit = server.limits.disk != 0 ? bytesToHuman(server.limits.disk * 1000 * 1000) : "Unlimited";
const memorylimit = server.limits.memory != 0 ? bytesToHuman(server.limits.memory * 1000 * 1000) : "Unlimited";
return ( return (
<PageContentBlock className={'flex'}> <PageContentBlock className={'flex'}>
<div className={'w-1/4'}> <div className={'w-1/4'}>
@ -112,8 +115,8 @@ export default () => {
className={'mr-1'} className={'mr-1'}
/> />
&nbsp;{bytesToHuman(memory)} &nbsp;{bytesToHuman(memory)}
<span className={'text-neutral-500'}> / {bytesToHuman(server.limits.memory * 1000 * 1000)}</span> <span className={'text-neutral-500'}> / {memorylimit}</span>
</p> </p>
<p className={'text-xs mt-2'}> <p className={'text-xs mt-2'}>
<FontAwesomeIcon <FontAwesomeIcon
icon={faHdd} icon={faHdd}
@ -121,7 +124,7 @@ export default () => {
className={'mr-1'} className={'mr-1'}
/> />
&nbsp;{bytesToHuman(disk)} &nbsp;{bytesToHuman(disk)}
<span className={'text-neutral-500'}> / {bytesToHuman(server.limits.disk * 1000 * 1000)}</span> <span className={'text-neutral-500'}> / {disklimit}</span>
</p> </p>
</TitledGreyBox> </TitledGreyBox>
{!server.isInstalling ? {!server.isInstalling ?