lib/riemann/dash/public/views/gauge.js in riemann-dash-0.2.5 vs lib/riemann/dash/public/views/gauge.js in riemann-dash-0.2.6

- old
+ new

@@ -3,10 +3,11 @@ var Gauge = function(json) { view.View.call(this, json); this.query = json.query; this.title = json.title; + this.commaSeparateThousands = json.commaSeparateThousands; this.clickFocusable = true; this.el.addClass('gauge'); this.el.append( '<div class="box">' + '<div class="quickfit metric value">?</div>' + @@ -21,11 +22,11 @@ var reflowed = false; var me = this; var value = this.el.find('.value'); this.sub = subs.subscribe(this.query, function(e) { me.box.attr('class', 'box state ' + e.state); - value.text(format.float(e.metric)); + value.text(format.float(e.metric, 2, me.commaSeparateThousands)); value.attr('title', e.description); // The first time, do a full-height reflow. if (reflowed) { value.quickfit(fitopts); @@ -43,18 +44,21 @@ Gauge.prototype.json = function() { return $.extend(view.View.prototype.json.call(this), { type: 'Gauge', title: this.title, - query: this.query + query: this.query, + commaSeparateThousands: this.commaSeparateThousands }); } var editTemplate = _.template( "<label for='title'>Title</label>" + "<input type='text' name='title' value='{{title}}' /><br />" + "<label for='query'>Query</label>" + - '<textarea type="text" name="query" class="query">{{query}}</textarea>' ); + '<textarea type="text" name="query" class="query">{{query}}</textarea>' + + "<label for='commaSeparateThousands'>Comma Separate Thousands</label>" + + "<input type='checkbox' name='commaSeparateThousands' {% if(commaSeparateThousands) { %} checked='checked' {% } %} />" ); Gauge.prototype.editForm = function() { return editTemplate(this); }