Skip to content

Commit f9a1bc6

Browse files
committed
Show installing status instead of offline when a server is installing
1 parent 77abfd0 commit f9a1bc6

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

app/Http/Requests/Api/Client/Servers/Network/NewAllocationRequest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
namespace Pterodactyl\Http\Requests\Api\Client\Servers\Network;
44

5-
use Illuminate\Support\Collection;
6-
use Pterodactyl\Models\Allocation;
75
use Pterodactyl\Models\Permission;
86
use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest;
97

@@ -16,5 +14,4 @@ public function permission(): string
1614
{
1715
return Permission::ACTION_ALLOCATION_CREATE;
1816
}
19-
2017
}

resources/scripts/components/server/ServerDetailsBlock.tsx

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useEffect, useState } from 'react';
2-
import tw from 'twin.macro';
2+
import tw, { TwStyle } from 'twin.macro';
33
import { faCircle, faEthernet, faHdd, faMemory, faMicrochip, faServer } from '@fortawesome/free-solid-svg-icons';
44
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
55
import { bytesToHuman, megabytesToHuman } from '@/helpers';
@@ -13,6 +13,21 @@ interface Stats {
1313
disk: number;
1414
}
1515

16+
function statusToColor (status: string|null, installing: boolean): TwStyle {
17+
if (installing) {
18+
status = '';
19+
}
20+
21+
switch (status) {
22+
case 'offline':
23+
return tw`text-red-500`;
24+
case 'running':
25+
return tw`text-green-500`;
26+
default:
27+
return tw`text-yellow-500`;
28+
}
29+
}
30+
1631
const ServerDetailsBlock = () => {
1732
const [ stats, setStats ] = useState<Stats>({ memory: 0, cpu: 0, disk: 0 });
1833

@@ -49,6 +64,7 @@ const ServerDetailsBlock = () => {
4964
}, [ instance, connected ]);
5065

5166
const name = ServerContext.useStoreState(state => state.server.data!.name);
67+
const isInstalling = ServerContext.useStoreState(state => state.server.data!.isInstalling);
5268
const limits = ServerContext.useStoreState(state => state.server.data!.limits);
5369
const primaryAllocation = ServerContext.useStoreState(state => state.server.data!.allocations.filter(alloc => alloc.isDefault).map(
5470
allocation => (allocation.alias || allocation.ip) + ':' + allocation.port
@@ -65,10 +81,10 @@ const ServerDetailsBlock = () => {
6581
fixedWidth
6682
css={[
6783
tw`mr-1`,
68-
status === 'offline' ? tw`text-red-500` : (status === 'running' ? tw`text-green-500` : tw`text-yellow-500`),
84+
statusToColor(status, isInstalling),
6985
]}
7086
/>
71-
&nbsp;{!status ? 'Connecting...' : status}
87+
&nbsp;{!status ? 'Connecting...' : (isInstalling ? 'Installing' : status)}
7288
</p>
7389
<CopyOnClick text={primaryAllocation}>
7490
<p css={tw`text-xs mt-2`}>

0 commit comments

Comments
 (0)