Skip to content

Commit

Permalink
Merge pull request #166 from gefyrahq/#163
Browse files Browse the repository at this point in the history
fix(#163): display error message in Home
  • Loading branch information
SteinRobert authored May 5, 2023
2 parents 866dbad + 70ab2e1 commit 45b6311
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion ui/src/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,19 @@ 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<string>);
const [containersLoading, setContainersLoading] = useState(false);
const [bridgesLoading, setBridgesLoading] = useState(true);
const [showCargo, setShowCargo] = useState(false);
const [unbridgeLoadingList, setUnbridgeLoadingList] = useState([] as Array<string>);
const [containerNamsepaceMap, setContainerNamespaceMap] = useState({} as { [key: string]: string });
const [noRowsLabel, setNoRowsLabel] = useState(noRowsDefault);

const ddClient = createDockerDesktopClient();
const dispatch = useDispatch();

Expand Down Expand Up @@ -205,13 +210,17 @@ export function Home() {
filters: filters
})
.then((containers: any) => {
setNoRowsLabel(noRowsDefault)
if (!showCargo) {
containers = containers.filter((container: { Names: string[] }) => {
return !container.Names.includes('/gefyra-cargo');
});
}
setContainers(containers);
setContainersLoading(false);
}).catch(err => {
setNoRowsLabel(`An error occured retrieving the containers: ${err}`)
setContainersLoading(false);
});
}

Expand Down Expand Up @@ -280,7 +289,7 @@ export function Home() {
getRowId={getRowId}
disableRowSelectionOnClick={true}
onRowClick={openContainer}
localeText={{ noRowsLabel: 'No containers found' }}
localeText={{ noRowsLabel: noRowsLabel }}
/>
</div>
</Grid>
Expand Down

0 comments on commit 45b6311

Please sign in to comment.