]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-6150 It should be possible to select a custom author in the facet on Issues...
authorStas Vilchik <vilchiks@gmail.com>
Thu, 5 Feb 2015 15:18:40 +0000 (16:18 +0100)
committerStas Vilchik <vilchiks@gmail.com>
Thu, 5 Feb 2015 15:18:40 +0000 (16:18 +0100)
server/sonar-web/src/main/coffee/issues/facets-view.coffee
server/sonar-web/src/main/coffee/issues/facets/author-facet.coffee [new file with mode: 0644]

index a116b380b9008a107832d58a7e6070315add65ee..d5b1f8459035658564827a3535d3996239425334 100644 (file)
@@ -15,6 +15,7 @@ define [
   'issues/facets/file-facet'
   'issues/facets/reporter-facet'
   'issues/facets/language-facet'
+  'issues/facets/author-facet'
   'issues/facets/issue-key-facet'
   'issues/facets/context-facet'
 ], (
@@ -34,6 +35,7 @@ define [
   FileFacet
   ReporterFacet
   LanguageFacet
+  AuthorFacet
   IssueKeyFacet
   ContextFacet
 ) ->
@@ -55,6 +57,7 @@ define [
         when 'fileUuids' then FileFacet
         when 'reporters' then ReporterFacet
         when 'languages' then LanguageFacet
+        when 'authors' then AuthorFacet
         when 'issues' then IssueKeyFacet
         when 'context' then ContextFacet
         else BaseFacet
diff --git a/server/sonar-web/src/main/coffee/issues/facets/author-facet.coffee b/server/sonar-web/src/main/coffee/issues/facets/author-facet.coffee
new file mode 100644 (file)
index 0000000..73a56c6
--- /dev/null
@@ -0,0 +1,27 @@
+define [
+  'issues/facets/custom-values-facet'
+], (
+  CustomValuesFacet
+) ->
+
+
+  class extends CustomValuesFacet
+
+    getUrl: ->
+      "#{baseUrl}/api/issues/authors"
+
+
+    prepareSearch: ->
+      @$('.js-custom-value').select2
+        placeholder: 'Search...'
+        minimumInputLength: 2
+        allowClear: false
+        formatNoMatches: -> t 'select2.noMatches'
+        formatSearching: -> t 'select2.searching'
+        formatInputTooShort: -> tp 'select2.tooShort', 2
+        width: '100%'
+        ajax:
+          quietMillis: 300
+          url: @getUrl()
+          data: (term) -> { q: term, ps: 25 }
+          results: (data) -> { more: false, results: data.authors.map (author) -> { id: author, text: author } }