aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/overview/issues/severities.js
blob: 26008e4648f65de01c1cf2e78e7ac7f99b16a35d (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
import _ from 'underscore';
import React from 'react';
import SeverityHelper from '../../../components/shared/severity-helper';
import { DomainHeader } from '../domain/header';
import { getComponentIssuesUrl } from '../../../helpers/urls';
import { formatMeasure } from '../../../helpers/measures';


export default class extends React.Component {
  sortedSeverities () {
    return _.sortBy(this.props.severities, s => window.severityComparator(s.val));
  }

  render () {
    let rows = this.sortedSeverities().map(s => {
      let href = getComponentIssuesUrl(this.props.component.key, { resolved: 'false', severities: s.val });
      return <tr key={s.val}>
        <td>
          <SeverityHelper severity={s.val}/>
        </td>
        <td className="thin text-right">
          <a className="cell-link" href={href}>
            {formatMeasure(s.count, 'SHORT_INT')}
          </a>
        </td>
      </tr>;
    });

    return <div className="overview-domain-section">
      <DomainHeader title="Prioritized Issues"/>
      <table className="data zebra">
        <tbody>{rows}</tbody>
      </table>
    </div>;
  }
}