aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/coffee/quality-gate/collections/quality-gates.coffee
blob: 9fbae78dd88af09c84c0ef739cddfd306f09e3a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
define [
  'quality-gate/models/quality-gate'
], (
  QualityGate
) ->

  class QualityGates extends Backbone.Collection
    model: QualityGate


    url: ->
      "#{baseUrl}/api/qualitygates/list"


    # {
    #   "qualitygates": [
    #     { "id": 42, "name": "QG 1" },
    #     { "id": 43, "name": "QG 2" },
    #     { "id": 44, "name": "QG 3" }
    #   ],
    #   "default": 42
    # }
    parse: (r) ->
      r.qualitygates.map (gate) ->
        _.extend gate, default: gate.id == r.default


    comparator: (item) -> item.get('name').toLowerCase()