From 98d8275743344826e81ee59ba7435ca75b43f2cd Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Tue, 24 Oct 2017 16:43:03 -0700 Subject: Fix for gas price to be lowered. --- ui/app/components/bn-as-decimal-input.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'ui/app/components/bn-as-decimal-input.js') diff --git a/ui/app/components/bn-as-decimal-input.js b/ui/app/components/bn-as-decimal-input.js index d84834d06..db5af1f46 100644 --- a/ui/app/components/bn-as-decimal-input.js +++ b/ui/app/components/bn-as-decimal-input.js @@ -31,6 +31,8 @@ BnAsDecimalInput.prototype.render = function () { const suffix = props.suffix const style = props.style const valueString = value.toString(10) + const newMin = min && this.downsize(min.toString(10), scale) + const newMax = max && this.downsize(max.toString(10), scale) const newValue = this.downsize(valueString, scale) return ( @@ -47,8 +49,8 @@ BnAsDecimalInput.prototype.render = function () { type: 'number', step: 'any', required: true, - min, - max, + min: newMin, + max: newMax, style: extend({ display: 'block', textAlign: 'right', @@ -128,15 +130,15 @@ BnAsDecimalInput.prototype.updateValidity = function (event) { } BnAsDecimalInput.prototype.constructWarning = function () { - const { name, min, max } = this.props + const { name, min, max, scale } = this.props let message = name ? name + ' ' : '' if (min && max) { - message += `must be greater than or equal to ${min} and less than or equal to ${max}.` + message += `must be greater than or equal to ${this.downsize(min.toString(10), scale)} and less than or equal to ${this.downsize(max.toString(10), scale)}.` } else if (min) { - message += `must be greater than or equal to ${min}.` + message += `must be greater than or equal to ${this.downsize(min.toString(10), scale)}.` } else if (max) { - message += `must be less than or equal to ${max}.` + message += `must be less than or equal to ${this.downsize(max.toString(10), scale)}.` } else { message += 'Invalid input.' } -- cgit From e1b9734cbfdf032a21ce75ac8f480f6ba4668bd2 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Wed, 25 Oct 2017 11:35:18 -0700 Subject: Move upsize conversions for input warning at front of fn. --- ui/app/components/bn-as-decimal-input.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'ui/app/components/bn-as-decimal-input.js') diff --git a/ui/app/components/bn-as-decimal-input.js b/ui/app/components/bn-as-decimal-input.js index db5af1f46..d3658b202 100644 --- a/ui/app/components/bn-as-decimal-input.js +++ b/ui/app/components/bn-as-decimal-input.js @@ -131,14 +131,16 @@ BnAsDecimalInput.prototype.updateValidity = function (event) { BnAsDecimalInput.prototype.constructWarning = function () { const { name, min, max, scale } = this.props + const newMin = this.downsize(min.toString(10), scale) + const newMax = this.downsize(max.toString(10), scale) let message = name ? name + ' ' : '' if (min && max) { - message += `must be greater than or equal to ${this.downsize(min.toString(10), scale)} and less than or equal to ${this.downsize(max.toString(10), scale)}.` + message += `must be greater than or equal to ${newMin} and less than or equal to ${newMax}.` } else if (min) { - message += `must be greater than or equal to ${this.downsize(min.toString(10), scale)}.` + message += `must be greater than or equal to ${newMin}.` } else if (max) { - message += `must be less than or equal to ${this.downsize(max.toString(10), scale)}.` + message += `must be less than or equal to ${newMax}.` } else { message += 'Invalid input.' } -- cgit From e7a22fc62bc8063ed89ddbaccd34e6311e2a6017 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Wed, 25 Oct 2017 11:47:40 -0700 Subject: Account for non-submitted mins and max --- ui/app/components/bn-as-decimal-input.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ui/app/components/bn-as-decimal-input.js') diff --git a/ui/app/components/bn-as-decimal-input.js b/ui/app/components/bn-as-decimal-input.js index d3658b202..000ac22c8 100644 --- a/ui/app/components/bn-as-decimal-input.js +++ b/ui/app/components/bn-as-decimal-input.js @@ -131,8 +131,8 @@ BnAsDecimalInput.prototype.updateValidity = function (event) { BnAsDecimalInput.prototype.constructWarning = function () { const { name, min, max, scale } = this.props - const newMin = this.downsize(min.toString(10), scale) - const newMax = this.downsize(max.toString(10), scale) + const newMin = min && this.downsize(min.toString(10), scale) + const newMax = max && this.downsize(max.toString(10), scale) let message = name ? name + ' ' : '' if (min && max) { -- cgit From 4903f3e71a0b2a8b4b0d212b61d6efae78f29f8f Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Wed, 25 Oct 2017 11:52:16 -0700 Subject: Add labels to clarify warning. --- ui/app/components/bn-as-decimal-input.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'ui/app/components/bn-as-decimal-input.js') diff --git a/ui/app/components/bn-as-decimal-input.js b/ui/app/components/bn-as-decimal-input.js index 000ac22c8..22e37602e 100644 --- a/ui/app/components/bn-as-decimal-input.js +++ b/ui/app/components/bn-as-decimal-input.js @@ -130,17 +130,17 @@ BnAsDecimalInput.prototype.updateValidity = function (event) { } BnAsDecimalInput.prototype.constructWarning = function () { - const { name, min, max, scale } = this.props + const { name, min, max, scale, suffix } = this.props const newMin = min && this.downsize(min.toString(10), scale) const newMax = max && this.downsize(max.toString(10), scale) let message = name ? name + ' ' : '' if (min && max) { - message += `must be greater than or equal to ${newMin} and less than or equal to ${newMax}.` + message += `must be greater than or equal to ${newMin} ${suffix} and less than or equal to ${newMax} ${suffix}.` } else if (min) { - message += `must be greater than or equal to ${newMin}.` + message += `must be greater than or equal to ${newMin} ${suffix}.` } else if (max) { - message += `must be less than or equal to ${newMax}.` + message += `must be less than or equal to ${newMax} ${suffix}.` } else { message += 'Invalid input.' } -- cgit