return getMeasuresAndMeta(componentKey, METRICS, {
additionalFields: 'metrics,periods'
- }).then(r => {
- if (this.mounted) {
- this.setState({
- loading: false,
- measures: enhanceMeasuresWithMetrics(r.component.measures, r.metrics),
- periods: r.periods
- });
+ }).then(
+ r => {
+ if (this.mounted) {
+ this.setState({
+ loading: false,
+ measures: enhanceMeasuresWithMetrics(r.component.measures, r.metrics),
+ periods: r.periods
+ });
+ }
+ },
+ error => {
+ throwGlobalError(error);
+ if (this.mounted) {
+ this.setState({ loading: false });
+ }
}
- }, throwGlobalError);
+ );
}
loadHistory(component /*: Component */) {
}
render() {
+ const { measures } = this.props;
+ const codeSmellsMeasure = measures.find(measure => measure.metric.key === 'code_smells');
+ if (codeSmellsMeasure == null) {
+ return null;
+ }
return (
<div className="overview-card" id="overview-code-smells">
{this.renderHeader()}