mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
cloudstack 3.0 UI - fix a JS error "str.replace is undefined".
This commit is contained in:
parent
4b4cba10c7
commit
c4c68e2995
@ -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)
|
||||
|
||||
@ -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),
|
||||
|
||||
@ -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, "<")
|
||||
.replace(/>/g, ">");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user