From 45dd2bcbb31adf24cd00e2179a85756aa5dbc1a4 Mon Sep 17 00:00:00 2001 From: Robert Stein Date: Fri, 5 May 2023 10:05:42 +0200 Subject: [PATCH 1/2] fix(#163): display error message in Home When containers cannot be loaded by Docker client display an error message. --- ui/src/Home.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ui/src/Home.tsx b/ui/src/Home.tsx index 8e99b39..1166885 100644 --- a/ui/src/Home.tsx +++ b/ui/src/Home.tsx @@ -29,6 +29,8 @@ export function Home() { const [showCargo, setShowCargo] = useState(false); const [unbridgeLoadingList, setUnbridgeLoadingList] = useState([] as Array); const [containerNamsepaceMap, setContainerNamespaceMap] = useState({} as { [key: string]: string }); + const [noRowsLabel, setNoRowsLabel] = useState('No containers found'); + const ddClient = createDockerDesktopClient(); const dispatch = useDispatch(); @@ -212,6 +214,8 @@ export function Home() { } setContainers(containers); setContainersLoading(false); + }).catch(err => { + setNoRowsLabel(`An error occured retrieving the containers: ${err}`) }); } @@ -280,7 +284,7 @@ export function Home() { getRowId={getRowId} disableRowSelectionOnClick={true} onRowClick={openContainer} - localeText={{ noRowsLabel: 'No containers found' }} + localeText={{ noRowsLabel: noRowsLabel }} /> From 70ab2e144eecc89bc55c83f8f2f0a24ec8de6301 Mon Sep 17 00:00:00 2001 From: Robert Stein Date: Fri, 5 May 2023 10:10:46 +0200 Subject: [PATCH 2/2] fix: enable container reloading on error --- ui/src/Home.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ui/src/Home.tsx b/ui/src/Home.tsx index 1166885..a19f9c7 100644 --- a/ui/src/Home.tsx +++ b/ui/src/Home.tsx @@ -21,7 +21,10 @@ import { resetSteps, setMode, setSnackbar, setView } from './store/ui'; import { Gefyra } from './gefyraClient'; import { GefyraListRequest, GefyraUnbridgeRequest } from 'gefyra/lib/protocol'; +const noRowsDefault = 'No containers found'; + export function Home() { + const [containers, setContainers] = useState([]); const [bridges, setBridges] = useState([] as Array); const [containersLoading, setContainersLoading] = useState(false); @@ -29,7 +32,7 @@ export function Home() { const [showCargo, setShowCargo] = useState(false); const [unbridgeLoadingList, setUnbridgeLoadingList] = useState([] as Array); const [containerNamsepaceMap, setContainerNamespaceMap] = useState({} as { [key: string]: string }); - const [noRowsLabel, setNoRowsLabel] = useState('No containers found'); + const [noRowsLabel, setNoRowsLabel] = useState(noRowsDefault); const ddClient = createDockerDesktopClient(); const dispatch = useDispatch(); @@ -207,6 +210,7 @@ export function Home() { filters: filters }) .then((containers: any) => { + setNoRowsLabel(noRowsDefault) if (!showCargo) { containers = containers.filter((container: { Names: string[] }) => { return !container.Names.includes('/gefyra-cargo'); @@ -216,6 +220,7 @@ export function Home() { setContainersLoading(false); }).catch(err => { setNoRowsLabel(`An error occured retrieving the containers: ${err}`) + setContainersLoading(false); }); }