ohif-viewer/extensions/vtk/src/LoadingIndicator.js
Igor Octaviano 42c22df1b6
Segmentation UI for VTKjs (#1685)
* Add single viewport configuration

* Multiple viewport configuration

* Improve performance by using independent set methods

* Add jump to slice command

* Add context configuration

* Cache panel visibility

* Fix sync between vtk and cornerstone

* Remove apis index

* Add approach

* Add loading to update volumes

* Fix broken configuration

* Bump vtk version

* Use loading label

* Update cy tests after vtk loading label changed

* Remove loading for segs
2020-05-06 18:17:44 +01:00

51 lines
1.4 KiB
JavaScript

import './LoadingIndicator.css';
import React, { PureComponent } from 'react';
import { withTranslation } from 'react-i18next';
import PropTypes from 'prop-types';
class LoadingIndicator extends PureComponent {
static propTypes = {
percentComplete: PropTypes.number.isRequired,
error: PropTypes.object,
};
static defaultProps = {
percentComplete: 0,
error: null,
};
render() {
let percComplete;
if (this.props.percentComplete && this.props.percentComplete !== 100) {
percComplete = `${this.props.percentComplete}%`;
}
return (
<React.Fragment>
{this.props.error ? (
<div className="imageViewerErrorLoadingIndicator loadingIndicator">
<div className="indicatorContents">
<h4>Error Loading Image</h4>
<p className="description">An error has occurred.</p>
<p className="details">{this.props.error.message}</p>
</div>
</div>
) : (
<div className="imageViewerLoadingIndicator loadingIndicator">
<div className="indicatorContents">
<p>
{this.props.t('Loading...')}
<i className="fa fa-spin fa-circle-o-notch fa-fw" />
{percComplete}
</p>
</div>
</div>
)}
</React.Fragment>
);
}
}
export default withTranslation('Common')(LoadingIndicator);