From bb540994351f93c93958a1fe3bd23e1d387d2d51 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Fri, 21 Feb 2014 14:01:52 -0800 Subject: [PATCH] CLOUDSTACK-6154: UI > compute offerings > memory field > check if value is undefined before converting it. (cherry picked from commit d1440217e9a44b6c12b588cbdca52daac6335d0c) Signed-off-by: Animesh Chaturvedi --- ui/scripts/configuration.js | 6 ++++++ ui/scripts/sharedFunctions.js | 3 +++ 2 files changed, 9 insertions(+) diff --git a/ui/scripts/configuration.js b/ui/scripts/configuration.js index 420cb7b2de4..e52f51998fd 100644 --- a/ui/scripts/configuration.js +++ b/ui/scripts/configuration.js @@ -522,6 +522,9 @@ memory: { label: 'label.memory.mb', converter: function(args) { + if (args == undefined) + return ''; + else return cloudStack.converters.convertBytes(args * 1024 * 1024); } }, @@ -1038,6 +1041,9 @@ memory: { label: 'label.memory.mb', converter: function(args) { + if (args == undefined) + return ''; + else return cloudStack.converters.convertBytes(args * 1024 * 1024); } }, 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) {