From: <dcr...@hy...> - 2009-06-16 02:39:04
|
Author: dcrutchf Date: 2009-06-15 17:37:02 -0700 (Mon, 15 Jun 2009) New Revision: 13353 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=13353 Modified: trunk/src/org/hyperic/hq/ui/action/resource/common/monitor/alerts/config/ConditionBean.java Log: [HHQ-3191] - All Metrics displays 1% instead of 100% in Indicator page Modified: trunk/src/org/hyperic/hq/ui/action/resource/common/monitor/alerts/config/ConditionBean.java =================================================================== --- trunk/src/org/hyperic/hq/ui/action/resource/common/monitor/alerts/config/ConditionBean.java 2009-06-15 23:42:15 UTC (rev 13352) +++ trunk/src/org/hyperic/hq/ui/action/resource/common/monitor/alerts/config/ConditionBean.java 2009-06-16 00:37:02 UTC (rev 13353) @@ -434,12 +434,34 @@ } try { - acv.setThreshold(BizappUtils.parseMeasurementValue( - getAbsoluteValue(), unit)); + // First check for percentage character + String stringValue = getAbsoluteValue(); + + if (!stringValue.endsWith("%")) { + // Doesn't have percentage character + // so let's add one, but before we do + // let's check the numeric value + // if it's between 0 and 1 they are likely + // representing the percentage as a decimal + // and we'll leave it alone otherwise, we add + // the % char and try again + double numericValue = getThresholdValue(); + + if (numericValue >= 1) { + stringValue += "%"; + } + } + + acv.setThreshold( + BizappUtils.parseMeasurementValue( + stringValue, + unit + ) + ); } catch (ParseException e) { - // Just set the value acv.setThreshold(getThresholdValue()); } + acv.setComparator( getComparator() ); } else if (getThresholdType().equals(TYPE_PERC)) { acv.setType(EventConstants.TYPE_BASELINE); |