forked from Alex/Pterodactyl-Panel
Merge branch 'develop' into v2
This commit is contained in:
commit
c48d573cc9
@ -23,6 +23,7 @@ class StatsTransformer extends Transformer
|
|||||||
'disk_bytes' => Arr::get($data, 'utilization.disk_bytes', 0),
|
'disk_bytes' => Arr::get($data, 'utilization.disk_bytes', 0),
|
||||||
'network_rx_bytes' => Arr::get($data, 'utilization.network.rx_bytes', 0),
|
'network_rx_bytes' => Arr::get($data, 'utilization.network.rx_bytes', 0),
|
||||||
'network_tx_bytes' => Arr::get($data, 'utilization.network.tx_bytes', 0),
|
'network_tx_bytes' => Arr::get($data, 'utilization.network.tx_bytes', 0),
|
||||||
|
'uptime' => Arr::get($data, 'utilization.uptime', 0),
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ services:
|
|||||||
- cache
|
- cache
|
||||||
volumes:
|
volumes:
|
||||||
- "/srv/pterodactyl/var/:/app/var/"
|
- "/srv/pterodactyl/var/:/app/var/"
|
||||||
- "/srv/pterodactyl/nginx/:/etc/nginx/conf.d/"
|
- "/srv/pterodactyl/nginx/:/etc/nginx/http.d/"
|
||||||
- "/srv/pterodactyl/certs/:/etc/letsencrypt/"
|
- "/srv/pterodactyl/certs/:/etc/letsencrypt/"
|
||||||
- "/srv/pterodactyl/logs/:/app/storage/logs"
|
- "/srv/pterodactyl/logs/:/app/storage/logs"
|
||||||
environment:
|
environment:
|
||||||
|
@ -10,6 +10,7 @@ export interface ServerStats {
|
|||||||
diskUsageInBytes: number;
|
diskUsageInBytes: number;
|
||||||
networkRxInBytes: number;
|
networkRxInBytes: number;
|
||||||
networkTxInBytes: number;
|
networkTxInBytes: number;
|
||||||
|
uptime: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default (server: string): Promise<ServerStats> => {
|
export default (server: string): Promise<ServerStats> => {
|
||||||
@ -23,6 +24,7 @@ export default (server: string): Promise<ServerStats> => {
|
|||||||
diskUsageInBytes: attributes.resources.disk_bytes,
|
diskUsageInBytes: attributes.resources.disk_bytes,
|
||||||
networkRxInBytes: attributes.resources.network_rx_bytes,
|
networkRxInBytes: attributes.resources.network_rx_bytes,
|
||||||
networkTxInBytes: attributes.resources.network_tx_bytes,
|
networkTxInBytes: attributes.resources.network_tx_bytes,
|
||||||
|
uptime: attributes.resources.uptime,
|
||||||
}))
|
}))
|
||||||
.catch(reject);
|
.catch(reject);
|
||||||
});
|
});
|
||||||
|
@ -92,7 +92,7 @@ const ServerDetailsBlock = () => {
|
|||||||
/>
|
/>
|
||||||
{!status ? 'Connecting...' : (isInstalling ? 'Installing' : (isTransferring) ? 'Transferring' : status)}
|
{!status ? 'Connecting...' : (isInstalling ? 'Installing' : (isTransferring) ? 'Transferring' : status)}
|
||||||
{stats.uptime > 0 &&
|
{stats.uptime > 0 &&
|
||||||
<span css={tw`ml-2`}>
|
<span css={tw`ml-2 lowercase`}>
|
||||||
(<UptimeDuration uptime={stats.uptime / 1000}/>)
|
(<UptimeDuration uptime={stats.uptime / 1000}/>)
|
||||||
</span>
|
</span>
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,15 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
export default ({ uptime }: { uptime: number }) => {
|
export default ({ uptime }: { uptime: number }) => {
|
||||||
const hours = Math.floor(Math.floor(uptime) / 60 / 60);
|
const days = Math.floor(uptime / (24 * 60 * 60));
|
||||||
|
const hours = Math.floor(Math.floor(uptime) / 60 / 60 % 24);
|
||||||
const remainder = Math.floor(uptime - (hours * 60 * 60));
|
const remainder = Math.floor(uptime - (hours * 60 * 60));
|
||||||
const minutes = Math.floor(remainder / 60);
|
const minutes = Math.floor(remainder / 60 % 60);
|
||||||
const seconds = remainder % 60;
|
const seconds = remainder % 60;
|
||||||
|
|
||||||
return (
|
if (days > 0) {
|
||||||
<>
|
return <>{days}d {hours}h {minutes}m</>;
|
||||||
{hours.toString().padStart(2, '0')}:{minutes.toString().padStart(2, '0')}:{seconds.toString().padStart(2, '0')}
|
}
|
||||||
</>
|
|
||||||
);
|
return <>{hours}h {minutes}m {seconds}s</>;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user