From 972b5acb8aee5140a4f5b100fa8f1716c4b46ba9 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Wed, 3 Feb 2016 16:40:24 +0100 Subject: [PATCH] SONAR-7252 improve issues widget on my account page --- .../apps/account/components/IssueWidgets.js | 47 ++++++++++++++++--- 1 file 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 (

- {translate('my_account.issue_widget.by_creation_date')} + {translate('my_account.issue_widget.leak_over_last_week')}

-

{translate('issues.page')}

+

{translate('my_account.my_issues')}

{this.state.loading && ( @@ -151,11 +166,33 @@ export default class IssueWidgets extends Component { + + + {translate('my_account.to_review')} + + + + {formatMeasure(this.state.toReview, 'SHORT_INT')} + + + + + + {translate('my_account.to_fix')} + + + + {formatMeasure(this.state.toFix, 'SHORT_INT')} + + +
)} + {!this.state.loading && this.renderByDate()} + {!this.state.loading && (

@@ -203,8 +240,6 @@ export default class IssueWidgets extends Component {

)} - - {!this.state.loading && this.renderByDate()} ); } -- 2.39.5