aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/overview/leak-dups.jsx
blob: 20cf2be1eb8db991fa6de625cb8e64394ddbce19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import React from 'react';
import Card from './card';
import MeasureVariation from './helpers/measure-variation';
import DrilldownLink from './helpers/drilldown-link';
import Donut from './helpers/donut';

export default React.createClass({
  render: function () {
    const
        density = this.props.leak.duplications,
        lines = this.props.leak.duplicatedLines,
        donutData = [
          { value: density, fill: '#f3ca8e' },
          { value: 100 - density, fill: '#e6e6e6' }
        ];

    if (density == null) {
      return null;
    }

    return (
        <Card>
          <div className="measures">
            <div className="measures-chart">
              <Donut data={donutData} size="47"/>
            </div>
            <div className="measure measure-big" data-metric="duplicated_lines_density">
              <span className="measure-value">
                <MeasureVariation value={density} type="PERCENT"/>
              </span>
              <span className="measure-name">{window.t('overview.metric.duplications')}</span>
            </div>
          </div>
          <ul className="list-inline big-spacer-top measures-chart-indent">
            <li>
              <span><MeasureVariation value={lines} type="SHORT_INT"/></span>&nbsp;
              <span>{window.t('overview.metric.duplicated_lines')}</span>
            </li>
          </ul>
        </Card>
    );
  }
});