aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2016-02-03 16:40:24 +0100
committerStas Vilchik <vilchiks@gmail.com>2016-02-03 16:40:34 +0100
commit972b5acb8aee5140a4f5b100fa8f1716c4b46ba9 (patch)
tree7b265c8fdbd173322261e8add97e577280cd5b9e
parentc0f7db7fe6f32defc0abd81a929cd467f6164754 (diff)
downloadsonarqube-972b5acb8aee5140a4f5b100fa8f1716c4b46ba9.tar.gz
sonarqube-972b5acb8aee5140a4f5b100fa8f1716c4b46ba9.zip
SONAR-7252 improve issues widget on my account page
-rw-r--r--server/sonar-web/src/main/js/apps/account/components/IssueWidgets.js47
1 files changed, 41 insertions, 6 deletions
diff --git a/server/sonar-web/src/main/js/apps/account/components/IssueWidgets.js b/server/sonar-web/src/main/js/apps/account/components/IssueWidgets.js
index 3fec0fe2cff..8679486d1d6 100644
--- a/server/sonar-web/src/main/js/apps/account/components/IssueWidgets.js
+++ b/server/sonar-web/src/main/js/apps/account/components/IssueWidgets.js
@@ -35,6 +35,14 @@ function getTotalUrl () {
return window.baseUrl + '/account/issues#resolved=false';
}
+function getToFixUrl () {
+ return window.baseUrl + '/account/issues#resolved=false|statuses=CONFIRMED';
+}
+
+function getToReviewUrl () {
+ return window.baseUrl + '/account/issues#resolved=false|statuses=' + encodeURIComponent('OPEN,REOPENED');
+}
+
function getSeverityUrl (severity) {
return window.baseUrl + '/account/issues#resolved=false|severities=' + severity;
}
@@ -70,13 +78,15 @@ export default class IssueWidgets extends Component {
total: facets.total,
severities: facets.severities,
projects: facets.projects,
+ toFix: facets.toFix,
+ toReview: facets.toReview,
byDate
});
});
}
fetchFacets () {
- return getFacets(BASE_QUERY, ['severities', 'projectUuids']).then(r => {
+ return getFacets(BASE_QUERY, ['statuses', 'severities', 'projectUuids']).then(r => {
const severities = _.sortBy(
_.findWhere(r.facets, { property: 'severities' }).values,
(facet) => window.severityComparator(facet.val)
@@ -87,9 +97,14 @@ export default class IssueWidgets extends Component {
return Object.assign({}, p, base);
});
+ const statuses = _.findWhere(r.facets, { property: 'statuses' }).values;
+ const toFix = _.findWhere(statuses, { val: 'CONFIRMED' }).count;
+ const toReview = _.findWhere(statuses, { val: 'OPEN' }).count +
+ _.findWhere(statuses, { val: 'REOPENED' }).count;
+
const total = r.response.total;
- return { severities, projects, total };
+ return { severities, projects, toFix, toReview, total };
});
}
@@ -114,7 +129,7 @@ export default class IssueWidgets extends Component {
return (
<section className="abs-width-300 huge-spacer-top account-bar-chart">
<h4 className="spacer-bottom">
- {translate('my_account.issue_widget.by_creation_date')}
+ {translate('my_account.issue_widget.leak_over_last_week')}
</h4>
<BarChart
data={data}
@@ -131,7 +146,7 @@ export default class IssueWidgets extends Component {
render () {
return (
<section>
- <h2 className="spacer-bottom">{translate('issues.page')}</h2>
+ <h2 className="spacer-bottom">{translate('my_account.my_issues')}</h2>
{this.state.loading && (
<i className="spinner"/>
@@ -151,11 +166,33 @@ export default class IssueWidgets extends Component {
</a>
</td>
</tr>
+ <tr>
+ <td>
+ <span className="spacer-left">{translate('my_account.to_review')}</span>
+ </td>
+ <td className="thin nowrap text-right">
+ <a href={getToReviewUrl()}>
+ {formatMeasure(this.state.toReview, 'SHORT_INT')}
+ </a>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <span className="spacer-left">{translate('my_account.to_fix')}</span>
+ </td>
+ <td className="thin nowrap text-right">
+ <a href={getToFixUrl()}>
+ {formatMeasure(this.state.toFix, 'SHORT_INT')}
+ </a>
+ </td>
+ </tr>
</tbody>
</table>
</section>
)}
+ {!this.state.loading && this.renderByDate()}
+
{!this.state.loading && (
<section className="abs-width-300 huge-spacer-top">
<h4 className="spacer-bottom">
@@ -203,8 +240,6 @@ export default class IssueWidgets extends Component {
</table>
</section>
)}
-
- {!this.state.loading && this.renderByDate()}
</section>
);
}