CLOUDSTACK-1064:A type error occurs when trying to add account/register 
template: this is because of accounts conext being undefined


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/44ceff42
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/44ceff42
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/44ceff42

Branch: refs/heads/ui-plugins
Commit: 44ceff422477411107c0355d09ad2b0a9facfed0
Parents: 9deea9b
Author: Pranav Saxena <[email protected]>
Authored: Fri Jan 25 16:42:42 2013 +0530
Committer: Pranav Saxena <[email protected]>
Committed: Fri Jan 25 16:42:42 2013 +0530

----------------------------------------------------------------------
 ui/scripts/accounts.js |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/44ceff42/ui/scripts/accounts.js
----------------------------------------------------------------------
diff --git a/ui/scripts/accounts.js b/ui/scripts/accounts.js
index 59e9d8b..4c327ee 100644
--- a/ui/scripts/accounts.js
+++ b/ui/scripts/accounts.js
@@ -642,12 +642,16 @@
                     },
                     vmLimit: {
                       label: 'label.instance.limits',
-                      isEditable: function(context) {                          
                                                          
+                      isEditable: function(context) {
+
+                                   if(context.accounts == undefined)
+                                         return false;
+                                               else {                          
                                                          
                                                                                
          if (context.accounts[0].accounttype == roleTypeUser || 
context.accounts[0].accounttype == roleTypeDomainAdmin) //updateResourceLimits 
is only allowed on account whose type is user or domain-admin
                                                                                
                  return true;
                                                                                
                else
                                                                                
                  return false;
-                                                                               
        }
+                                                                               
                        }       }
                     },
                     ipLimit: {
                       label: 'label.ip.limits',

Reply via email to