Less Lines = Better
Same logic, just more compact and react like
This commit is contained in:
parent
564933fcb1
commit
3df0febd0c
2 changed files with 4 additions and 29 deletions
|
@ -52,21 +52,8 @@ export default ({ server, className }: { server: Server; className: string | und
|
|||
alarms.memory = isAlarmState(stats.memoryUsageInBytes, server.limits.memory);
|
||||
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";
|
||||
};
|
||||
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 (
|
||||
<Link to={`/server/${server.id}`} className={`grey-row-box cursor-pointer ${className}`}>
|
||||
|
|
|
@ -81,20 +81,8 @@ export default () => {
|
|||
};
|
||||
}, [ 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>;
|
||||
};
|
||||
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 (
|
||||
<PageContentBlock className={'flex'}>
|
||||
|
|
Loading…
Reference in a new issue