|
From: <jt...@hy...> - 2007-03-24 20:58:06
|
Author: jtravis Date: 2007-03-24 12:58:04 -0800 (Sat, 24 Mar 2007) New Revision: 3866 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=3866 Modified: trunk/ui_plugins/rendit_sys/org/hyperic/hq/ui/rendit/BaseController.groovy trunk/ui_plugins/rendit_sys/org/hyperic/hq/ui/rendit/helpers/ResourceHelper.groovy Log: Fix typo, allow strings to contain integers for finding by Id .. fix url bounds problem Modified: trunk/ui_plugins/rendit_sys/org/hyperic/hq/ui/rendit/BaseController.groovy =================================================================== --- trunk/ui_plugins/rendit_sys/org/hyperic/hq/ui/rendit/BaseController.groovy 2007-03-24 20:56:03 UTC (rev 3865) +++ trunk/ui_plugins/rendit_sys/org/hyperic/hq/ui/rendit/BaseController.groovy 2007-03-24 20:58:04 UTC (rev 3866) @@ -81,7 +81,7 @@ URLEncoder.encode("" + o.value, "UTF-8") + "&" } - if (url[-1] == '?' || url[-1] == '&') + if (url.length() > 0 && (url[-1] == '?' || url[-1] == '&')) url = url[0..-2] return "<a href=\"$url\">$text</a>" }, Modified: trunk/ui_plugins/rendit_sys/org/hyperic/hq/ui/rendit/helpers/ResourceHelper.groovy =================================================================== --- trunk/ui_plugins/rendit_sys/org/hyperic/hq/ui/rendit/helpers/ResourceHelper.groovy 2007-03-24 20:56:03 UTC (rev 3865) +++ trunk/ui_plugins/rendit_sys/org/hyperic/hq/ui/rendit/helpers/ResourceHelper.groovy 2007-03-24 20:58:04 UTC (rev 3866) @@ -17,7 +17,7 @@ str: {name -> platMan.findPlatformTypeByName(name)}, int: {id -> platMan.findPlatformTypeValueById(id)}], group: [ - str: {name -> groupMap.findGroupByName(userVal, name)}, + str: {name -> groupMan.findGroupByName(userVal, name)}, int: {id -> groupMan.findGroup(userVal, id)}], ] @@ -86,6 +86,12 @@ def resourceVal = args[resourceType] def argType = (resourceVal instanceof String) ? 'str' : 'int' + + try { // If it's a string with an integer inside, try that + resourceVal = Integer.parseInt(resourceVal) + argType = 'int' + } catch(NumberFormatException e) { + } NAME_FINDERS[resourceType][argType](resourceVal) } } |