Fix missing details message in Topology view.

This commit is contained in:
Kia Lam
2022-09-16 14:03:38 -07:00
committed by Jeff Bradberry
parent 301807466d
commit 78cc9fb019

View File

@@ -47,7 +47,7 @@ function MeshGraph({ data, showLegend, zoom, setShowZoomControls }) {
const [simulationProgress, setSimulationProgress] = useState(null); const [simulationProgress, setSimulationProgress] = useState(null);
const history = useHistory(); const history = useHistory();
const { const {
result: { instance, instanceGroups }, result: { instance = {}, instanceGroups },
error: fetchError, error: fetchError,
isLoading, isLoading,
request: fetchDetails, request: fetchDetails,
@@ -68,12 +68,13 @@ function MeshGraph({ data, showLegend, zoom, setShowZoomControls }) {
result: {}, result: {},
} }
); );
const { error: fetchInstanceError, dismissError } = const { error: fetchInstanceError, dismissError } =
useDismissableError(fetchError); useDismissableError(fetchError);
useEffect(() => { useEffect(() => {
if (selectedNode) {
fetchDetails(); fetchDetails();
}
}, [selectedNode, fetchDetails]); }, [selectedNode, fetchDetails]);
function updateNodeSVG(nodes) { function updateNodeSVG(nodes) {
@@ -383,18 +384,6 @@ function MeshGraph({ data, showLegend, zoom, setShowZoomControls }) {
<div id="chart" style={{ position: 'relative', height: '100%' }}> <div id="chart" style={{ position: 'relative', height: '100%' }}>
{showLegend && <Legend />} {showLegend && <Legend />}
{instance && ( {instance && (
<>
{fetchInstanceError && (
<AlertModal
variant="error"
title={t`Error!`}
isOpen
onClose={dismissError}
>
{t`Failed to update instance.`}
<ErrorDetail error={fetchInstanceError} />
</AlertModal>
)}
<Tooltip <Tooltip
isNodeSelected={isNodeSelected} isNodeSelected={isNodeSelected}
renderNodeIcon={renderNodeIcon(selectedNode)} renderNodeIcon={renderNodeIcon(selectedNode)}
@@ -407,9 +396,19 @@ function MeshGraph({ data, showLegend, zoom, setShowZoomControls }) {
redirectToDetailsPage(selectedNode, history) redirectToDetailsPage(selectedNode, history)
} }
/> />
</>
)} )}
<Loader className="simulation-loader" progress={simulationProgress} /> <Loader className="simulation-loader" progress={simulationProgress} />
{fetchInstanceError && (
<AlertModal
variant="error"
title={t`Error!`}
isOpen
onClose={dismissError}
>
{t`Failed to get instance.`}
<ErrorDetail error={fetchInstanceError} />
</AlertModal>
)}
</div> </div>
); );
} }