From c2fa24a24ce9c21bd7d1f2811dfd42bd21007692 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Fri, 21 Feb 2014 13:21:20 -0800 Subject: [PATCH] CLOUDSTACK-6154: UI > compute offerings > memory field > check if value is undefined before converting it. --- ui/scripts/configuration.js | 10 ++++++++-- ui/scripts/sharedFunctions.js | 3 +++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ui/scripts/configuration.js b/ui/scripts/configuration.js index 6adbade76b0..869b876865c 100644 --- a/ui/scripts/configuration.js +++ b/ui/scripts/configuration.js @@ -522,7 +522,10 @@ memory: { label: 'label.memory.mb', converter: function(args) { - return cloudStack.converters.convertBytes(args * 1024 * 1024); + if (args == undefined) + return ''; + else + return cloudStack.converters.convertBytes(args * 1024 * 1024); } }, networkrate: { @@ -1038,7 +1041,10 @@ memory: { label: 'label.memory.mb', converter: function(args) { - return cloudStack.converters.convertBytes(args * 1024 * 1024); + if (args == undefined) + return ''; + else + return cloudStack.converters.convertBytes(args * 1024 * 1024); } }, networkrate: { diff --git a/ui/scripts/sharedFunctions.js b/ui/scripts/sharedFunctions.js index 2a159675f31..9fa70e3bda4 100644 --- a/ui/scripts/sharedFunctions.js +++ b/ui/scripts/sharedFunctions.js @@ -900,6 +900,9 @@ var roleTypeDomainAdmin = "2"; cloudStack.converters = { convertBytes: function(bytes) { + if (bytes == undefined) + return ''; + if (bytes < 1024 * 1024) { return (bytes / 1024).toFixed(2) + " KB"; } else if (bytes < 1024 * 1024 * 1024) {