Skip to content

Commit

Permalink
ui: Fix empty SVG height to prevent service mesh from breaking when t…
Browse files Browse the repository at this point in the history
…here are no upstreams (#10122)
  • Loading branch information
kaxcode authored and mikemorris committed May 5, 2021
1 parent 1d6ebf0 commit c41ef2d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .changelog/10122.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
ui: Adding conditional to prevent Service Mesh from breaking when there are no Upstreams
```
18 changes: 10 additions & 8 deletions ui/packages/consul-ui/app/components/topology-metrics/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

this.upView = {
x: upstreamLines.x,
y: upstreamLines.y,
width: upstreamLines.width,
height: upstreamColumn.height,
};
const upstreamColumn = document.getElementById('upstream-column');

if (upstreamColumn) {
this.upView = {
x: upstreamLines.x,
y: upstreamLines.y,
width: upstreamLines.width,
height: upstreamColumn.getBoundingClientRect().height + 10,
};
}

// Get Card elements positions
const downCards = [
Expand Down

0 comments on commit c41ef2d

Please sign in to comment.