aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/quality-gates/details-view.js
blob: 0c97cb26c016e0c4663ac111616df39e462af5e3 (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
import Marionette from 'backbone.marionette';
import Conditions from './conditions';
import DetailConditionsView from './gate-conditions-view';
import ProjectsView from './gate-projects-view';
import './templates';

export default 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);
  }
});