diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js index 54ae111faa4..831a01bc386 100644 --- a/ui/scripts/instances.js +++ b/ui/scripts/instances.js @@ -1645,7 +1645,7 @@ var jsonObj = args.context.instances[0]; args.response.success({ data: { - totalCPU: _s(jsonObj.cpunumber) + " x " + cloudStack.converters.convertHz(jsonObj.cpuspeed), + totalCPU: jsonObj.cpunumber + " x " + cloudStack.converters.convertHz(jsonObj.cpuspeed), cpuused: jsonObj.cpuused, networkkbsread: (jsonObj.networkkbsread == null || jsonObj.networkkbsread == 0)? "N/A": cloudStack.converters.convertBytes(jsonObj.networkkbsread * 1024), networkkbswrite: (jsonObj.networkkbswrite == null || jsonObj.networkkbswrite == 0)? "N/A": cloudStack.converters.convertBytes(jsonObj.networkkbswrite * 1024) diff --git a/ui/scripts/system.js b/ui/scripts/system.js index 891efe761b5..1b66055a466 100644 --- a/ui/scripts/system.js +++ b/ui/scripts/system.js @@ -5695,7 +5695,7 @@ var jsonObj = args.context.hosts[0]; args.response.success({ data: { - totalCPU: _s(jsonObj.cpunumber) + " x " + cloudStack.converters.convertHz(jsonObj.cpuspeed), + totalCPU: jsonObj.cpunumber + " x " + cloudStack.converters.convertHz(jsonObj.cpuspeed), cpuused: jsonObj.cpuused, cpuallocated: (jsonObj.cpuallocated == null || jsonObj.cpuallocated == 0)? "N/A": jsonObj.cpuallocated, memorytotal: (jsonObj.memorytotal == null || jsonObj.memorytotal == 0)? "N/A": cloudStack.converters.convertBytes(jsonObj.memorytotal * 1024), diff --git a/ui/scripts/ui/utils.js b/ui/scripts/ui/utils.js index 0287976d87b..a1662a021ce 100644 --- a/ui/scripts/ui/utils.js +++ b/ui/scripts/ui/utils.js @@ -60,10 +60,24 @@ * * Strip unwanted characters from user-based input */ - cloudStack.sanitize = window._s = function(str) { - if (!str) return ''; - - var sanitized = str + cloudStack.sanitize = window._s = function(value) { + if(typeof(value) == "number") { + //alert("number does not need to be sanitized. Only string needs to be sanitized."); + return value; + } + else if(typeof(value) == "boolean") { + //alert("boolean does not need to be sanitized. Only string needs to be sanitized."); + return value; + } + else if(typeof(value) == "object") { + //alert("object cant not be sanitized. Only string can be sanitized."); + return value; + } + else if(typeof(value) == null || typeof(value) == "undefined") { + return ''; + } + + var sanitized = value .replace(/&/g, "&") .replace(//g, ">");