From c4f4f1f5c8ae91aebcd2c5468a77a0b9fa8924d3 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sat, 25 Apr 2020 17:58:09 -0700 Subject: [PATCH] Don't show an error in the listing if the server is still installing or suspended --- .../Api/Client/ServerTransformer.php | 2 ++ resources/scripts/api/server/getServer.ts | 4 ++++ .../scripts/components/dashboard/ServerRow.tsx | 17 ++++++++++++----- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/app/Transformers/Api/Client/ServerTransformer.php b/app/Transformers/Api/Client/ServerTransformer.php index 4a2fd49b2..2878f92f0 100644 --- a/app/Transformers/Api/Client/ServerTransformer.php +++ b/app/Transformers/Api/Client/ServerTransformer.php @@ -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, ]; } diff --git a/resources/scripts/api/server/getServer.ts b/resources/scripts/api/server/getServer.ts index 31e70fcc5..62cf61b78 100644 --- a/resources/scripts/api/server/getServer.ts +++ b/resources/scripts/api/server/getServer.ts @@ -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[] ]> => { diff --git a/resources/scripts/components/dashboard/ServerRow.tsx b/resources/scripts/components/dashboard/ServerRow.tsx index f3024f976..bac71e552 100644 --- a/resources/scripts/components/dashboard/ServerRow.tsx +++ b/resources/scripts/components/dashboard/ServerRow.tsx @@ -78,11 +78,18 @@ export default ({ server, className }: { server: Server; className: string | und !statsError ? : -
- - Connection Error - -
+ (server.isSuspended || server.isInstalling) ? +
+ + {server.isSuspended ? 'Suspended' : 'Installing'} + +
+ : +
+ + Connection Error + +
: