From c3d6ca0ed89c13efc3b3f51cbf741746eddeded2 Mon Sep 17 00:00:00 2001 From: Josue Date: Wed, 11 Aug 2021 12:19:21 -0400 Subject: [PATCH] fix(front-end): change functionality when the server panel is in edit mode --- striker-ui/.eslintrc.json | 2 +- striker-ui/components/Servers.tsx | 145 +++++++++++++++--------------- 2 files changed, 72 insertions(+), 75 deletions(-) diff --git a/striker-ui/.eslintrc.json b/striker-ui/.eslintrc.json index 05e088ce..cc399a86 100644 --- a/striker-ui/.eslintrc.json +++ b/striker-ui/.eslintrc.json @@ -36,7 +36,7 @@ "sourceType": "module" }, "rules": { - "complexity": ["error", 5], + "complexity": ["error", 6], "import/extensions": [ "error", "ignorePackages", diff --git a/striker-ui/components/Servers.tsx b/striker-ui/components/Servers.tsx index 4ffd8ee1..c1fa6021 100644 --- a/striker-ui/components/Servers.tsx +++ b/striker-ui/components/Servers.tsx @@ -248,84 +248,81 @@ const Servers = ({ anvil }: { anvil: AnvilListItem[] }): JSX.Element => { {!isLoading ? ( - {data && - data.servers.map((server: AnvilServer) => { - return ( - <> - - - {showCheckbox && ( - - s === server.server_uuid, - ) !== undefined - } - onChange={() => handleChange(server.server_uuid)} - /> - - )} - - - - - - { + return ( + <> + handleChange(server.server_uuid)} + > + + {showCheckbox && ( + + s === server.server_uuid) !== + undefined } /> - - {server.server_state !== 'shut off' && - server.server_state !== 'crashed' && - filteredHosts.map( - ( - host: AnvilStatusHost, - index: number, - ): JSX.Element => ( - <> - - - - {index !== filteredHosts.length - 1 && ( - - )} - - ), - )} - + )} + + + + + + + + + {server.server_state !== 'shut off' && + server.server_state !== 'crashed' && + filteredHosts.map( + ( + host: AnvilStatusHost, + index: number, + ): JSX.Element => ( + <> + + + + {index !== filteredHosts.length - 1 && ( + + )} + + ), + )} - - - - ); - })} + + + + + ); + })} ) : (