|
@@ -26,6 +26,14 @@ App.NumberWidgetView = Em.View.extend(App.WidgetMixin, {
|
|
*/
|
|
*/
|
|
value: '',
|
|
value: '',
|
|
|
|
|
|
|
|
+ displayValue: function () {
|
|
|
|
+ var value = parseFloat(this.get('value'));
|
|
|
|
+ if (isNaN(value)) return Em.I18n.t('common.na');
|
|
|
|
+ var value = value % 1 != 0? value.toFixed(2): value;
|
|
|
|
+ var unit = this.get('content.properties.display_unit')? this.get('content.properties.display_unit'): '';
|
|
|
|
+ return value + unit;
|
|
|
|
+ }.property('value'),
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* common metrics container
|
|
* common metrics container
|
|
* @type {Array}
|
|
* @type {Array}
|
|
@@ -41,7 +49,9 @@ App.NumberWidgetView = Em.View.extend(App.WidgetMixin, {
|
|
var warningThreshold = parseFloat(this.get('content.properties.warning_threshold'));
|
|
var warningThreshold = parseFloat(this.get('content.properties.warning_threshold'));
|
|
var errorThreshold = parseFloat(this.get('content.properties.error_threshold'));
|
|
var errorThreshold = parseFloat(this.get('content.properties.error_threshold'));
|
|
|
|
|
|
- if (isNaN(warningThreshold) || isNaN(errorThreshold) || value <= warningThreshold) {
|
|
|
|
|
|
+ if (isNaN(value)) {
|
|
|
|
+ return 'grey';
|
|
|
|
+ } else if (isNaN(warningThreshold) || isNaN(errorThreshold) || value <= warningThreshold) {
|
|
return 'green';
|
|
return 'green';
|
|
} else if (value <= errorThreshold) {
|
|
} else if (value <= errorThreshold) {
|
|
return 'orange';
|
|
return 'orange';
|