Don't show an error in the listing if the server is still installing or suspended

This commit is contained in:
Dane Everitt 2020-04-25 17:58:09 -07:00
parent f45c03a449
commit c4f4f1f5c8
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53
3 changed files with 18 additions and 5 deletions

View File

@ -56,6 +56,8 @@ class ServerTransformer extends BaseClientTransformer
'databases' => $server->database_limit,
'allocations' => $server->allocation_limit,
],
'is_suspended' => $server->suspended !== 0,
'is_installing' => $server->installed !== 1,
];
}

View File

@ -30,6 +30,8 @@ export interface Server {
databases: number;
allocations: number;
};
isSuspended: boolean;
isInstalling: boolean;
}
export const rawDataToServerObject = (data: any): Server => ({
@ -50,6 +52,8 @@ export const rawDataToServerObject = (data: any): Server => ({
} ],
limits: { ...data.limits },
featureLimits: { ...data.feature_limits },
isSuspended: data.is_suspended,
isInstalling: data.is_installing,
});
export default (uuid: string): Promise<[ Server, string[] ]> => {

View File

@ -78,11 +78,18 @@ export default ({ server, className }: { server: Server; className: string | und
!statsError ?
<SpinnerOverlay size={'tiny'} visible={true} backgroundOpacity={0.25}/>
:
<div className={'flex-1 text-center'}>
<span className={'bg-red-500 rounded px-2 py-1 text-red-100 text-xs'}>
Connection Error
</span>
</div>
(server.isSuspended || server.isInstalling) ?
<div className={'flex-1 text-center'}>
<span className={'bg-neutral-500 rounded px-2 py-1 text-neutral-100 text-xs'}>
{server.isSuspended ? 'Suspended' : 'Installing'}
</span>
</div>
:
<div className={'flex-1 text-center'}>
<span className={'bg-red-500 rounded px-2 py-1 text-red-100 text-xs'}>
Connection Error
</span>
</div>
:
<React.Fragment>
<div className={'flex-1 flex ml-4 justify-center'}>