aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/coffee/quality-gate/views/quality-gate-detail-view.coffee
blob: ff2ca9c70ea8da67a08cb7a8bbb51a17c0491755 (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
define [
  'backbone.marionette',
  'templates/quality-gates',
  'quality-gate/collections/conditions',
  'quality-gate/views/quality-gate-detail-header-view',
  'quality-gate/views/quality-gate-detail-conditions-view',
  'quality-gate/views/quality-gate-detail-projects-view'
], (
  Marionette,
  Templates,
  Conditions,
  QualityGateDetailHeaderView,
  QualityGateDetailConditionsView,
  QualityGateDetailProjectsView
) ->

  class QualityGateDetailView extends Marionette.Layout
    template: Templates['quality-gate-detail']


    regions:
      conditionsRegion: '#quality-gate-conditions'
      projectsRegion: '#quality-gate-projects'


    modelEvents:
      'change': 'render'


    onRender: ->
      @showConditions()
      @showProjects()


    showConditions: ->
      conditions = new Conditions @model.get('conditions')
      view = new QualityGateDetailConditionsView
        app: @options.app
        collection: conditions
        gateId: @model.id
        qualityGate: @model
      @conditionsRegion.show view


    showProjects: ->
      view = new QualityGateDetailProjectsView
        app: @options.app
        model: @model
        gateId: @model.id
      @projectsRegion.show view