]> source.dussan.org Git - sonarqube.git/commitdiff
Hide "Key" filter on Rules page
authorJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Wed, 16 Jul 2014 09:37:43 +0000 (11:37 +0200)
committerJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Wed, 16 Jul 2014 09:37:52 +0000 (11:37 +0200)
sonar-server/src/main/coffee/coding-rules/views/filter-bar-view.coffee

index 84641dd998e727fe72ad4525d545d859fa019e54..a5cf838ab49a7408f2cdfb3fd9b2ecb89394a25e 100644 (file)
@@ -3,12 +3,14 @@ define [
   'navigator/filters/base-filters',
   'navigator/filters/favorite-filters',
   'navigator/filters/more-criteria-filters',
+  'navigator/filters/read-only-filters',
   'templates/coding-rules'
 ], (
   FilterBarView,
   BaseFilters,
   FavoriteFiltersModule,
   MoreCriteriaFilters,
+  ReadOnlyFilterView,
   Templates
 ) ->
 
@@ -40,7 +42,10 @@ define [
 
 
     addMoreCriteriaFilter: ->
-      disabledFilters = this.collection.where enabled: false
+      readOnlyFilters = @collection.where(type: ReadOnlyFilterView)
+      console.log readOnlyFilters
+      disabledFilters = _.difference(@collection.where(enabled: false), readOnlyFilters)
+      console.log disabledFilters
       if disabledFilters.length > 0
         @moreCriteriaFilter = new BaseFilters.Filter
           type: MoreCriteriaFilters.MoreCriteriaFilterView,
@@ -53,7 +58,7 @@ define [
     changeEnabled: ->
       if @moreCriteriaFilter?
         disabledFilters = _.reject @collection.where(enabled: false), (filter) ->
-          filter.get('type') == MoreCriteriaFilters.MoreCriteriaFilterView
+          filter.get('type') in [MoreCriteriaFilters.MoreCriteriaFilterView, ReadOnlyFilterView]
 
         if disabledFilters.length == 0
           @moreCriteriaFilter.set { enabled: false }, { silent: true }