aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server
diff options
context:
space:
mode:
authorJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>2014-07-08 15:10:16 +0200
committerJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>2014-07-08 15:10:16 +0200
commitf0094e727e8937986b73660be9fa0c1c0b14a083 (patch)
treee40a8c221ec788bab6cb045c40329654d80ec780 /sonar-server
parentbb8edcd2ce9d932b56e2bd7b6e8f9b9f866f12eb (diff)
downloadsonarqube-f0094e727e8937986b73660be9fa0c1c0b14a083.tar.gz
sonarqube-f0094e727e8937986b73660be9fa0c1c0b14a083.zip
SONAR-5390 Add Active Severity filter in Coding Rules space
Diffstat (limited to 'sonar-server')
-rw-r--r--sonar-server/src/main/coffee/coding-rules/app.coffee22
-rw-r--r--sonar-server/src/main/coffee/coding-rules/views/filters/activation-filter-view.coffee38
-rw-r--r--sonar-server/src/main/coffee/coding-rules/views/filters/active-severities-filter-view.coffee7
-rw-r--r--sonar-server/src/main/coffee/coding-rules/views/filters/inheritance-filter-view.coffee45
-rw-r--r--sonar-server/src/main/coffee/coding-rules/views/filters/profile-dependent-filter-view.coffee52
5 files changed, 89 insertions, 75 deletions
diff --git a/sonar-server/src/main/coffee/coding-rules/app.coffee b/sonar-server/src/main/coffee/coding-rules/app.coffee
index a0ab8754246..103e12af957 100644
--- a/sonar-server/src/main/coffee/coding-rules/app.coffee
+++ b/sonar-server/src/main/coffee/coding-rules/app.coffee
@@ -44,6 +44,7 @@ requirejs [
'coding-rules/views/filters/query-filter-view',
'coding-rules/views/filters/quality-profile-filter-view',
'coding-rules/views/filters/inheritance-filter-view',
+ 'coding-rules/views/filters/active-severities-filter-view',
'coding-rules/views/filters/activation-filter-view',
'coding-rules/views/filters/characteristic-filter-view',
'coding-rules/views/filters/repository-filter-view',
@@ -79,6 +80,7 @@ requirejs [
QueryFilterView,
QualityProfileFilterView,
InheritanceFilterView,
+ ActiveSeveritiesFilterView,
ActivationFilterView,
CharacteristicFilterView,
RepositoryFilterView,
@@ -374,6 +376,26 @@ requirejs [
false: t 'coding_rules.filters.activation.inactive'
@filters.add @activationFilter
+ @filters.add new BaseFilters.Filter
+ name: t 'coding_rules.filters.active_severity'
+ property: 'active_severities'
+ type: ActiveSeveritiesFilterView
+ enabled: false
+ optional: true
+ qualityProfileFilter: @qualityProfileFilter
+ choices:
+ 'BLOCKER': t 'severity.BLOCKER'
+ 'CRITICAL': t 'severity.CRITICAL'
+ 'MAJOR': t 'severity.MAJOR'
+ 'MINOR': t 'severity.MINOR'
+ 'INFO': t 'severity.INFO'
+ choiceIcons:
+ 'BLOCKER': 'severity-blocker'
+ 'CRITICAL': 'severity-critical'
+ 'MAJOR': 'severity-major'
+ 'MINOR': 'severity-minor'
+ 'INFO': 'severity-info'
+
@languageFilter = new BaseFilters.Filter
name: t 'coding_rules.filters.language'
property: 'languages'
diff --git a/sonar-server/src/main/coffee/coding-rules/views/filters/activation-filter-view.coffee b/sonar-server/src/main/coffee/coding-rules/views/filters/activation-filter-view.coffee
index 7748b353fbe..00f379dc605 100644
--- a/sonar-server/src/main/coffee/coding-rules/views/filters/activation-filter-view.coffee
+++ b/sonar-server/src/main/coffee/coding-rules/views/filters/activation-filter-view.coffee
@@ -1,47 +1,19 @@
define [
- 'navigator/filters/choice-filters'
- 'coding-rules/views/filters/inheritance-filter-view'
+ 'coding-rules/views/filters/profile-dependent-filter-view'
], (
- ChoiceFilters
- InheritanceFilterView
+ ProfileDependentFilterView
) ->
- class ActivationFilterView extends ChoiceFilters.ChoiceFilterView
+ class ActivationFilterView extends ProfileDependentFilterView
tooltip: 'coding_rules.filters.activation.help'
- initialize: ->
- super
- @qualityProfileFilter = @model.get 'qualityProfileFilter'
- @listenTo @qualityProfileFilter, 'change:value', @onChangeQualityProfile
- @onChangeQualityProfile()
-
-
- onChangeQualityProfile: ->
- qualityProfileKey = @qualityProfileFilter.get 'value'
- if _.isArray(qualityProfileKey) && qualityProfileKey.length == 1
- @makeActive()
- else
- @makeInactive()
-
makeActive: ->
- @model.set inactive: false, title: ''
- @model.trigger 'change:enabled'
+ super
unless @model.get 'value'
@choices.each (model) -> model.set 'checked', model.id == 'true'
@model.set 'value', ['true']
- @$el.removeClass('navigator-filter-inactive').prop 'title', ''
- @options.filterBarView.moreCriteriaFilter.view.detailsView.enableByProperty(@detailsView.model.get 'property')
- @hideDetails()
-
-
- makeInactive: ->
- @model.set inactive: true, title: t @tooltip
- @model.trigger 'change:enabled'
- @choices.each (model) -> model.set 'checked', false
- @detailsView.updateLists()
- @detailsView.updateValue()
- @$el.addClass('navigator-filter-inactive').prop 'title', t @tooltip
+
showDetails: ->
diff --git a/sonar-server/src/main/coffee/coding-rules/views/filters/active-severities-filter-view.coffee b/sonar-server/src/main/coffee/coding-rules/views/filters/active-severities-filter-view.coffee
new file mode 100644
index 00000000000..3fd1733da6d
--- /dev/null
+++ b/sonar-server/src/main/coffee/coding-rules/views/filters/active-severities-filter-view.coffee
@@ -0,0 +1,7 @@
+define [
+ 'coding-rules/views/filters/profile-dependent-filter-view'
+], (
+ ProfileDependentFilterView
+) ->
+
+ class ActiveSeveritiesFilterView extends ProfileDependentFilterView
diff --git a/sonar-server/src/main/coffee/coding-rules/views/filters/inheritance-filter-view.coffee b/sonar-server/src/main/coffee/coding-rules/views/filters/inheritance-filter-view.coffee
index 99e8fd57ec1..367fd4210b0 100644
--- a/sonar-server/src/main/coffee/coding-rules/views/filters/inheritance-filter-view.coffee
+++ b/sonar-server/src/main/coffee/coding-rules/views/filters/inheritance-filter-view.coffee
@@ -1,19 +1,10 @@
define [
- 'navigator/filters/choice-filters'
+ 'coding-rules/views/filters/profile-dependent-filter-view'
], (
- ChoiceFilters
+ ProfileDependentFilterView
) ->
- class InheritanceFilterView extends ChoiceFilters.ChoiceFilterView
- tooltip: 'coding_rules.filters.inheritance.inactive'
-
-
- initialize: ->
- super
- @qualityProfileFilter = @model.get 'qualityProfileFilter'
- @listenTo @qualityProfileFilter, 'change:value', @onChangeQualityProfile
- @onChangeQualityProfile()
-
+ class InheritanceFilterView extends ProfileDependentFilterView
onChangeQualityProfile: ->
qualityProfileKey = @qualityProfileFilter.get 'value'
@@ -29,33 +20,3 @@ define [
@makeInactive()
else
@makeInactive()
-
-
- makeActive: ->
- @model.set inactive: false, title: ''
- @model.trigger 'change:enabled'
- @$el.removeClass('navigator-filter-inactive').prop 'title', ''
- @options.filterBarView.moreCriteriaFilter.view.detailsView.enableByProperty(@detailsView.model.get 'property')
- @hideDetails()
-
-
- makeInactive: ->
- @model.set inactive: true, title: t @tooltip
- @model.trigger 'change:enabled'
- @choices.each (model) -> model.set 'checked', false
- @detailsView.updateLists()
- @detailsView.updateValue()
- @$el.addClass('navigator-filter-inactive').prop 'title', t @tooltip
-
-
- showDetails: ->
- super unless @$el.is '.navigator-filter-inactive'
-
-
- restore: (value) ->
- value = value.split(',') if _.isString(value)
- if @choices && value.length > 0
- @model.set value: value, enabled: true
- @onChangeQualityProfile()
- else
- @clear()
diff --git a/sonar-server/src/main/coffee/coding-rules/views/filters/profile-dependent-filter-view.coffee b/sonar-server/src/main/coffee/coding-rules/views/filters/profile-dependent-filter-view.coffee
new file mode 100644
index 00000000000..a86c58cacdc
--- /dev/null
+++ b/sonar-server/src/main/coffee/coding-rules/views/filters/profile-dependent-filter-view.coffee
@@ -0,0 +1,52 @@
+define [
+ 'navigator/filters/choice-filters'
+], (
+ ChoiceFilters
+) ->
+
+ class ProfileDependentFilterView extends ChoiceFilters.ChoiceFilterView
+ tooltip: 'coding_rules.filters.activation.help'
+
+ initialize: ->
+ super
+ @qualityProfileFilter = @model.get 'qualityProfileFilter'
+ @listenTo @qualityProfileFilter, 'change:value', @onChangeQualityProfile
+ @onChangeQualityProfile()
+
+
+ onChangeQualityProfile: ->
+ qualityProfileKey = @qualityProfileFilter.get 'value'
+ if _.isArray(qualityProfileKey) && qualityProfileKey.length == 1
+ @makeActive()
+ else
+ @makeInactive()
+
+
+ makeActive: ->
+ @model.set inactive: false, title: ''
+ @model.trigger 'change:enabled'
+ @$el.removeClass('navigator-filter-inactive').prop 'title', ''
+ @options.filterBarView.moreCriteriaFilter.view.detailsView.enableByProperty(@detailsView.model.get 'property')
+ @hideDetails()
+
+
+ makeInactive: ->
+ @model.set inactive: true, title: t @tooltip
+ @model.trigger 'change:enabled'
+ @choices.each (model) -> model.set 'checked', false
+ @detailsView.updateLists()
+ @detailsView.updateValue()
+ @$el.addClass('navigator-filter-inactive').prop 'title', t @tooltip
+
+
+ showDetails: ->
+ super unless @$el.is '.navigator-filter-inactive'
+
+
+ restore: (value) ->
+ value = value.split(',') if _.isString(value)
+ if @choices && value.length > 0
+ @model.set value: value, enabled: true
+ @onChangeQualityProfile()
+ else
+ @clear()