1
1
mirror of https://github.com/pterodactyl/panel.git synced 2024-11-22 09:02:28 +01:00

Show starting/stopping correctly in stats; closes #4209

This commit is contained in:
DaneEveritt 2022-06-30 20:33:09 -04:00
parent 3120e1d4a0
commit 0d0c595909
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53

View File

@ -15,6 +15,7 @@ import UptimeDuration from '@/components/server/UptimeDuration';
import StatBlock from '@/components/server/console/StatBlock';
import useWebsocketEvent from '@/plugins/useWebsocketEvent';
import classNames from 'classnames';
import { capitalize } from '@/lib/strings';
type Stats = Record<'memory' | 'cpu' | 'disk' | 'uptime' | 'rx' | 'tx', number>;
@ -97,7 +98,13 @@ const ServerDetailsBlock = ({ className }: { className?: string }) => {
title={'Uptime'}
color={getBackgroundColor(status === 'running' ? 0 : status !== 'offline' ? 9 : 10, 10)}
>
{stats.uptime > 0 ? <UptimeDuration uptime={stats.uptime / 1000} /> : 'Offline'}
{status === 'starting' || status === 'stopping' ? (
capitalize(status)
) : stats.uptime > 0 ? (
<UptimeDuration uptime={stats.uptime / 1000} />
) : (
'Offline'
)}
</StatBlock>
<StatBlock icon={faMicrochip} title={'CPU Load'} color={getBackgroundColor(stats.cpu, limits.cpu)}>
{status === 'offline' ? (