aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/quality-profiles/profile-changelog-view.js
blob: 4d9e18ad660f5269754f29d546d2303d0b4ac008 (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
import Marionette from 'backbone.marionette';
import './templates';

export default Marionette.ItemView.extend({
  template: Templates['quality-profile-changelog'],

  events: {
    'submit #quality-profile-changelog-form': 'onFormSubmit',
    'click .js-show-more-changelog': 'onShowMoreChangelogClick',
    'click .js-hide-changelog': 'onHideChangelogClick'
  },

  onFormSubmit: function (e) {
    e.preventDefault();
    this.model.fetchChangelog(this.getSearchParameters());
  },

  onShowMoreChangelogClick: function (e) {
    e.preventDefault();
    this.model.fetchMoreChangelog();
  },

  onHideChangelogClick: function (e) {
    e.preventDefault();
    this.model.resetChangelog();
  },

  getSearchParameters: function () {
    var form = this.$('#quality-profile-changelog-form');
    return {
      since: form.find('[name="since"]').val(),
      to: form.find('[name="to"]').val()
    };
  }
});