Skip to content

Commit

Permalink
Fix missing details message in Topology view.
Browse files Browse the repository at this point in the history
  • Loading branch information
kialam authored and jbradberry committed Sep 23, 2022
1 parent 3018074 commit 78cc9fb
Showing 1 changed file with 27 additions and 28 deletions.
55 changes: 27 additions & 28 deletions awx/ui/src/screens/TopologyView/MeshGraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function MeshGraph({ data, showLegend, zoom, setShowZoomControls }) {
const [simulationProgress, setSimulationProgress] = useState(null);
const history = useHistory();
const {
result: { instance, instanceGroups },
result: { instance = {}, instanceGroups },
error: fetchError,
isLoading,
request: fetchDetails,
Expand All @@ -68,12 +68,13 @@ function MeshGraph({ data, showLegend, zoom, setShowZoomControls }) {
result: {},
}
);

const { error: fetchInstanceError, dismissError } =
useDismissableError(fetchError);

useEffect(() => {
fetchDetails();
if (selectedNode) {
fetchDetails();
}
}, [selectedNode, fetchDetails]);

function updateNodeSVG(nodes) {
Expand Down Expand Up @@ -383,33 +384,31 @@ function MeshGraph({ data, showLegend, zoom, setShowZoomControls }) {
<div id="chart" style={{ position: 'relative', height: '100%' }}>
{showLegend && <Legend />}
{instance && (
<>
{fetchInstanceError && (
<AlertModal
variant="error"
title={t`Error!`}
isOpen
onClose={dismissError}
>
{t`Failed to update instance.`}
<ErrorDetail error={fetchInstanceError} />
</AlertModal>
)}
<Tooltip
isNodeSelected={isNodeSelected}
renderNodeIcon={renderNodeIcon(selectedNode)}
selectedNode={selectedNode}
fetchInstance={fetchDetails}
instanceGroups={instanceGroups}
instanceDetail={instance}
isLoading={isLoading}
redirectToDetailsPage={() =>
redirectToDetailsPage(selectedNode, history)
}
/>
</>
<Tooltip
isNodeSelected={isNodeSelected}
renderNodeIcon={renderNodeIcon(selectedNode)}
selectedNode={selectedNode}
fetchInstance={fetchDetails}
instanceGroups={instanceGroups}
instanceDetail={instance}
isLoading={isLoading}
redirectToDetailsPage={() =>
redirectToDetailsPage(selectedNode, history)
}
/>
)}
<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>
);
}
Expand Down

0 comments on commit 78cc9fb

Please sign in to comment.