From f85bcca528139bc6f7f68de5ad665cb6b8006265 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Fri, 18 Jul 2014 16:23:40 +0600 Subject: SONAR-5453 Add a filter to display 'Open' and 'Reopen' issues in the component viewer --- .../src/main/coffee/component-viewer/header/issues-header.coffee | 8 +++++++- .../src/main/coffee/component-viewer/mixins/main-issues.coffee | 3 +++ .../src/main/hbs/component-viewer/header/issues-header.hbs | 8 +++++++- 3 files changed, 17 insertions(+), 2 deletions(-) (limited to 'server') diff --git a/server/sonar-web/src/main/coffee/component-viewer/header/issues-header.coffee b/server/sonar-web/src/main/coffee/component-viewer/header/issues-header.coffee index 05fdb8daa1f..ecfa4b5a918 100644 --- a/server/sonar-web/src/main/coffee/component-viewer/header/issues-header.coffee +++ b/server/sonar-web/src/main/coffee/component-viewer/header/issues-header.coffee @@ -27,6 +27,7 @@ define [ 'click .js-filter-fixed-issues': 'filterByFixedIssues' 'click .js-filter-unresolved-issues': 'filterByUnresolvedIssues' 'click .js-filter-false-positive-issues': 'filterByFalsePositiveIssues' + 'click .js-filter-open-issues': 'filterByOpenIssues' 'click .js-filter-BLOCKER-issues': 'filterByBlockerIssues' 'click .js-filter-CRITICAL-issues': 'filterByCriticalIssues' 'click .js-filter-MAJOR-issues': 'filterByMajorIssues' @@ -86,6 +87,11 @@ define [ @state.set 'activeHeaderItem', '.js-filter-false-positive-issues' + filterByOpenIssues: (e) -> + @header.filterLines e, 'filterByOpenIssues' + @state.set 'activeHeaderItem', '.js-filter-open-issues' + + filterByRule: (e) -> rule = $(e.currentTarget).data 'rule' @header.filterLines e, 'filterByRule', rule @@ -120,4 +126,4 @@ define [ serializeData: -> _.extend super, period: @state.get('period')?.toJSON() - hasIssues: @state.get('severities')?.length || @state.get('rules')?.length \ No newline at end of file + hasIssues: @state.get('severities')?.length || @state.get('rules')?.length diff --git a/server/sonar-web/src/main/coffee/component-viewer/mixins/main-issues.coffee b/server/sonar-web/src/main/coffee/component-viewer/mixins/main-issues.coffee index 8e38c7f2d39..9feefc4770d 100644 --- a/server/sonar-web/src/main/coffee/component-viewer/mixins/main-issues.coffee +++ b/server/sonar-web/src/main/coffee/component-viewer/mixins/main-issues.coffee @@ -119,6 +119,9 @@ define [ # False Positive filterByFalsePositiveIssues: -> @filterByIssues (issue) -> issue.resolution == 'FALSE-POSITIVE' + # Open/Reopened Issues + filterByOpenIssues: -> @filterByIssues (issue) -> issue.status == 'OPEN' || issue.status == 'REOPENED' + # Rule filterByRule: (rule) -> @filterByIssues (issue) -> issue.rule == rule && !issue.resolution diff --git a/server/sonar-web/src/main/hbs/component-viewer/header/issues-header.hbs b/server/sonar-web/src/main/hbs/component-viewer/header/issues-header.hbs index 8729e3714b9..91ba1ecc927 100644 --- a/server/sonar-web/src/main/hbs/component-viewer/header/issues-header.hbs +++ b/server/sonar-web/src/main/hbs/component-viewer/header/issues-header.hbs @@ -8,7 +8,7 @@
- {{#if hasIssues}}{{t 'component_viewer.measure_section.resolutions'}}{{else}}{{t 'component_viewer.no_issues'}}{{/if}} + {{#if hasIssues}}{{t 'component_viewer.measure_section.filters'}}{{else}}{{t 'component_viewer.no_issues'}}{{/if}}