diff --git a/.changelog/10122.txt b/.changelog/10122.txt new file mode 100644 index 0000000000..8353016bc5 --- /dev/null +++ b/.changelog/10122.txt @@ -0,0 +1,3 @@ +```release-note:bug +ui: Adding conditional to prevent Service Mesh from breaking when there are no Upstreams +``` diff --git a/ui/packages/consul-ui/app/components/topology-metrics/index.js b/ui/packages/consul-ui/app/components/topology-metrics/index.js index cb19b9e82b..0c8ca03857 100644 --- a/ui/packages/consul-ui/app/components/topology-metrics/index.js +++ b/ui/packages/consul-ui/app/components/topology-metrics/index.js @@ -108,14 +108,16 @@ export default class TopologyMetrics extends Component { // Calculate viewBox dimensions this.downView = document.getElementById('downstream-lines').getBoundingClientRect(); const upstreamLines = document.getElementById('upstream-lines').getBoundingClientRect(); - const upstreamColumn = document.getElementById('upstream-column').getBoundingClientRect(); + const upstreamColumn = document.getElementById('upstream-column'); - this.upView = { - x: upstreamLines.x, - y: upstreamLines.y, - width: upstreamLines.width, - height: upstreamColumn.height, - }; + if (upstreamColumn) { + this.upView = { + x: upstreamLines.x, + y: upstreamLines.y, + width: upstreamLines.width, + height: upstreamColumn.getBoundingClientRect().height + 10, + }; + } // Get Card elements positions const downCards = [