Skip to content

Commit 74b0ee1

Browse files
committed
#netpyne-132 adding spinner for plots that takes time to load (ny model download)
1 parent a0492e4 commit 74b0ee1

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

webapp/components/general/HTMLViewer.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import React, { Component, createRef } from 'react';
33
import HTMLViewer from '@metacell/geppetto-meta-ui/html-viewer/HTMLViewer';
44

55
import { withStyles } from '@material-ui/core/styles';
6+
import { CircularProgress } from '@material-ui/core';
7+
import { primaryColor } from '../../theme';
68

79
const style = ({ palette }) => ({
810
container: {
@@ -44,7 +46,7 @@ class CustomHTMLViewer extends Component {
4446

4547
getSvgComponent () {
4648
// svg element
47-
return this.containerRef.current.children[0].children[0].children[0];
49+
return this.containerRef?.current?.children[0]?.children[0]?.children[0];
4850
}
4951

5052
wasParentResized (dimensions) {
@@ -77,7 +79,20 @@ class CustomHTMLViewer extends Component {
7779
}
7880

7981
render () {
80-
const { classes } = this.props;
82+
const { classes, content } = this.props;
83+
if (content === undefined) {
84+
return (
85+
<CircularProgress
86+
color={primaryColor}
87+
style={{
88+
position: 'absolute',
89+
margin: 'auto',
90+
top: '50%',
91+
left: '50%',
92+
}}
93+
/>
94+
);
95+
}
8196
return (
8297
<div id="plot" className={classes.container} ref={this.containerRef}>
8398
<HTMLViewer {...this.props} style={{ backgroundColor: 'inherit' }} />

0 commit comments

Comments
 (0)