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 <anim...@apache.org> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/bb540994 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/bb540994 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/bb540994 Branch: refs/heads/4.3 Commit: bb540994351f93c93958a1fe3bd23e1d387d2d51 Parents: a652737 Author: Jessica Wang <jessicaw...@apache.org> Authored: Fri Feb 21 14:01:52 2014 -0800 Committer: Animesh Chaturvedi <anim...@apache.org> Committed: Tue Mar 4 23:38:26 2014 -0800 ---------------------------------------------------------------------- ui/scripts/configuration.js | 6 ++++++ ui/scripts/sharedFunctions.js | 3 +++ 2 files changed, 9 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bb540994/ui/scripts/configuration.js ---------------------------------------------------------------------- diff --git a/ui/scripts/configuration.js b/ui/scripts/configuration.js index 420cb7b..e52f519 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); } }, http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bb540994/ui/scripts/sharedFunctions.js ---------------------------------------------------------------------- diff --git a/ui/scripts/sharedFunctions.js b/ui/scripts/sharedFunctions.js index 2a15967..9fa70e3 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) {