diff options
| author | Hunternif | 2019-04-22 23:22:04 +0700 |
|---|---|---|
| committer | Hunternif | 2019-04-22 23:27:07 +0700 |
| commit | 5ed908aedfc49da831cc91cc9ed2b152167493a4 (patch) | |
| tree | 644427e0940897923d8eb16e66458fb1a1e6c5c8 | |
| parent | a20306ca443d7486a935493e55b06d79463c1f25 (diff) | |
client: fix displaying 0 in number inputs
| -rw-r--r-- | client/js/util/views.js | 4 | ||||
| -rw-r--r-- | client/js/views/tag_metric_view.js | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/client/js/util/views.js b/client/js/util/views.js index ee4c209..c4275e0 100644 --- a/client/js/util/views.js +++ b/client/js/util/views.js @@ -102,7 +102,7 @@ function makeSelect(options) { } function makeInput(options) { - options.value = options.value || ''; + options.value = options.value === 0 ? 0 : options.value || ''; return _makeLabel(options) + makeElement('input', options); } @@ -251,6 +251,8 @@ function _serializeElement(name, attributes) { } else if (attributes[key] === false || attributes[key] === undefined) { return ''; + } else if (attributes[key] === 0) { + return `${key}="0"`; } const attribute = misc.escapeHtml(attributes[key] || ''); return `${key}="${attribute}"`; diff --git a/client/js/views/tag_metric_view.js b/client/js/views/tag_metric_view.js index 0c684f8..1b3f31f 100644 --- a/client/js/views/tag_metric_view.js +++ b/client/js/views/tag_metric_view.js @@ -19,8 +19,8 @@ class TagMetricView extends events.EventTarget { ctx.metricMax = ctx.tag.metric.max; } else { // default new values - ctx.metricMin = '0'; - ctx.metricMax = '10'; + ctx.metricMin = 0; + ctx.metricMax = 10; } views.replaceContent(this._hostNode, template(ctx)); |