summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/tools/wtstats/template/views/stat.js
blob: a327503e8c953b9e0c50adf27522827b3ededd62 (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
var AmpersandView = require('ampersand-view'),
    debug = require('debug')('view:stat');

var StatView = module.exports = AmpersandView.extend({
  template: require('./templates/stat.jade'),
  render: function () {
    this.renderWithTemplate(this.model);
  },
  events: {
    'click': 'clicked',
  },
  bindings: {
    'model.selected': {
      type: 'booleanClass',
      hook: 'circle',
      yes: 'fa-circle',
      no: 'fa-circle-o'
    }
  },
  clicked: function (event) {
    // ignore shift+click, app handles those
    if (event.shiftKey) {
      this.model.app.toggleAllExcept(this.model);
    } else {
      this.model.app.clearSelectionState();
      this.model.toggle('selected');
    }
    this.parent.parent.statChanged(this, {all: event.shiftKey, propagate: true});
  }
});