Show "unlimited" not 0
Shows unlimited for resources if they're set to "0" Im sure we could also just remove the "of {limit}" part if its unlimited? Dane Advise Im sure there is a 100x better way of doing this? Dane please advise.
This commit is contained in:
parent
6e588b37d3
commit
564933fcb1
2 changed files with 34 additions and 6 deletions
|
@ -53,6 +53,21 @@ export default ({ server, className }: { server: Server; className: string | und
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let disklimit;
|
||||||
|
let memorylimit;
|
||||||
|
|
||||||
|
if(server.limits.disk != 0) {
|
||||||
|
disklimit = bytesToHuman(server.limits.disk * 1000 * 1000);
|
||||||
|
} else {
|
||||||
|
disklimit = "Unlimited";
|
||||||
|
};
|
||||||
|
|
||||||
|
if(server.limits.memory != 0) {
|
||||||
|
memorylimit = bytesToHuman(server.limits.memory * 1000 * 1000);
|
||||||
|
} else {
|
||||||
|
memorylimit = "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}`}>
|
||||||
<div className={'icon'}>
|
<div className={'icon'}>
|
||||||
|
@ -127,7 +142,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 +162,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>
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,6 +81,21 @@ export default () => {
|
||||||
};
|
};
|
||||||
}, [ instance, connected ]);
|
}, [ instance, connected ]);
|
||||||
|
|
||||||
|
|
||||||
|
let memorylimit;
|
||||||
|
let disklimit;
|
||||||
|
|
||||||
|
if(server.limits.disk != 0 ) {
|
||||||
|
disklimit = <span className={'text-neutral-500'}> / {server.limits.memory} MB</span>;
|
||||||
|
} else {
|
||||||
|
disklimit = <span className={'text-neutral-500'}> / Unlimited</span>;
|
||||||
|
};
|
||||||
|
if(server.limits.memory != 0 ) {
|
||||||
|
memorylimit = <span className={'text-neutral-500'}> / {server.limits.memory} MB</span>;
|
||||||
|
} else {
|
||||||
|
memorylimit = <span className={'text-neutral-500'}> / Unlimited</span>;
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageContentBlock className={'flex'}>
|
<PageContentBlock className={'flex'}>
|
||||||
<div className={'w-1/4'}>
|
<div className={'w-1/4'}>
|
||||||
|
@ -112,7 +127,7 @@ export default () => {
|
||||||
className={'mr-1'}
|
className={'mr-1'}
|
||||||
/>
|
/>
|
||||||
{bytesToHuman(memory)}
|
{bytesToHuman(memory)}
|
||||||
<span className={'text-neutral-500'}> / {server.limits.memory} MB</span>
|
{memorylimit}
|
||||||
</p>
|
</p>
|
||||||
<p className={'text-xs mt-2'}>
|
<p className={'text-xs mt-2'}>
|
||||||
<FontAwesomeIcon
|
<FontAwesomeIcon
|
||||||
|
@ -121,7 +136,7 @@ export default () => {
|
||||||
className={'mr-1'}
|
className={'mr-1'}
|
||||||
/>
|
/>
|
||||||
{bytesToHuman(disk)}
|
{bytesToHuman(disk)}
|
||||||
<span className={'text-neutral-500'}> / {server.limits.disk} MB</span>
|
{disklimit}
|
||||||
</p>
|
</p>
|
||||||
</TitledGreyBox>
|
</TitledGreyBox>
|
||||||
{!server.isInstalling ?
|
{!server.isInstalling ?
|
||||||
|
|
Loading…
Add table
Reference in a new issue