import React from 'react'; import { DetailedMeasure } from './detailed-measure'; import { DonutChart } from '../../../components/charts/donut-chart'; import { DrilldownLink } from '../../../components/shared/drilldown-link'; import { formatMeasure, formatMeasureVariation } from '../../../helpers/measures'; export const CoverageMeasures = React.createClass({ propTypes: { measures: React.PropTypes.object.isRequired, leak: React.PropTypes.object.isRequired, prefix: React.PropTypes.string.isRequired }, getMetricName(metric) { const { prefix } = this.props; return prefix + metric; }, getNewCoverageMetricName () { const { prefix } = this.props; return 'new_' + prefix + 'coverage'; }, getCoverageMeasure() { const coverageMetricName = this.getMetricName('coverage'); return this.props.measures[coverageMetricName]; }, getCoverageLeak() { const coverageMetricName = this.getMetricName('coverage'); return this.props.leak[coverageMetricName]; }, getNewCoverageMeasure() { const newCoverageMetricName = this.getNewCoverageMetricName(); return this.props.leak[newCoverageMetricName]; }, renderCoverageLeak () { if (!this.props.leakPeriodDate) { return null; } const coverageLeak = this.getCoverageLeak(); return