aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/quality-gates/details-view.js
blob: 9af1b38e65e50f546c214558c54bf73c60c2d6c9 (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
define([
  './conditions',
  './gate-conditions-view',
  './gate-projects-view',
  './templates'
], function (Conditions, DetailConditionsView, ProjectsView) {

  return Marionette.LayoutView.extend({
    template: Templates['quality-gate-detail'],

    regions: {
      conditionsRegion: '#quality-gate-conditions',
      projectsRegion: '#quality-gate-projects'
    },

    modelEvents: {
      'change': 'render'
    },

    onRender: function () {
      this.showConditions();
      this.showProjects();
    },

    showConditions: function () {
      var conditions = new Conditions(this.model.get('conditions')),
          view = new DetailConditionsView({
            canEdit: this.options.canEdit,
            collection: conditions,
            model: this.model,
            metrics: this.options.metrics,
            periods: this.options.periods
          });
      this.conditionsRegion.show(view);
    },

    showProjects: function () {
      var view = new ProjectsView({
        canEdit: this.options.canEdit,
        model: this.model
      });
      this.projectsRegion.show(view);
    }
  });

});