ui: Fix empty SVG height to prevent service mesh from breaking when there are no upstreams (#10122)

This commit is contained in:
Kenia 2021-04-28 09:22:18 -04:00 committed by GitHub
parent 16f1995d6d
commit c9b7fe5051
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 7 deletions

3
.changelog/10122.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:bug
ui: Adding conditional to prevent Service Mesh from breaking when there are no Upstreams
```

View File

@ -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');
if (upstreamColumn) {
this.upView = {
x: upstreamLines.x,
y: upstreamLines.y,
width: upstreamLines.width,
height: upstreamColumn.height,
height: upstreamColumn.getBoundingClientRect().height + 10,
};
}
// Get Card elements positions
const downCards = [