CLOUDSTACK-1065: cloudstack UI - AWS Style Regions - remove region field from 
Add Account dialog since createAccount API does not take in regionid parameter.


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

Branch: refs/heads/marvin_refactor
Commit: b9dc54602ecf342ba4886905ba6ce06587fbb5a6
Parents: e0a0c1f
Author: Jessica Wang <[email protected]>
Authored: Wed Mar 20 16:47:52 2013 -0700
Committer: Prasanna Santhanam <[email protected]>
Committed: Sun Mar 31 22:02:17 2013 +0530

----------------------------------------------------------------------
 ui/scripts/accounts.js |  145 ++++---------------------------------------
 1 files changed, 13 insertions(+), 132 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b9dc5460/ui/scripts/accounts.js
----------------------------------------------------------------------
diff --git a/ui/scripts/accounts.js b/ui/scripts/accounts.js
index 8353d70..e36852f 100644
--- a/ui/scripts/accounts.js
+++ b/ui/scripts/accounts.js
@@ -112,7 +112,7 @@
                     label: 'label.last.name',
                     validation: { required: true },
                     docID: 'helpAccountLastName'
-                  },                  
+                  },
                   domainid: {
                     label: 'label.domain',
                     docID: 'helpAccountDomain',
@@ -195,7 +195,7 @@
                 $.extend(data, {
                                                                  email: 
args.data.email,
                   firstname: args.data.firstname,
-                  lastname: args.data.lastname,                 
+                  lastname: args.data.lastname,
                   domainid: args.data.domainid                                 
                                
                                                                });             
                                                              
 
@@ -290,7 +290,7 @@
                                                                          
domainid: accountObj.domainid,
                                                                                
account: accountObj.name,
                                                                                
newname: args.data.name,
-                                                                               
networkdomain: args.data.networkdomain                    
+                                                                               
networkdomain: args.data.networkdomain
                                                                        };
                 
                   $.ajax({
@@ -409,77 +409,6 @@
                                                                                
});
                                                                        }
 
-                                                                       
if(args.data.cpuLimit != null) {
-                                                                         var 
data = {
-                                                                               
  resourceType: 8,
-                                                                               
        max: args.data.cpuLimit,
-                                                                               
        domainid: accountObj.domainid,
-                                                                               
        account: accountObj.name
-                                                                               
};
-
-                                                                               
$.ajax({
-                                                                               
        url: createURL('updateResourceLimit'),
-                                                                               
        data: data,
-                                                                               
        async: false,
-                                                                               
        success: function(json) {
-                                                                               
                accountObj["cpuLimit"] = args.data.cpuLimit;
-                                                                               
        }
-                                                                               
});
-                                                                       }
-
-                                                                       
if(args.data.memoryLimit != null) {
-                                                                         var 
data = {
-                                                                               
  resourceType: 9,
-                                                                               
        max: args.data.memoryLimit,
-                                                                               
        domainid: accountObj.domainid,
-                                                                               
        account: accountObj.name
-                                                                               
};
-
-                                                                               
$.ajax({
-                                                                               
        url: createURL('updateResourceLimit'),
-                                                                               
        data: data,
-                                                                               
        async: false,
-                                                                               
        success: function(json) {
-                                                                               
                accountObj["memoryLimit"] = args.data.memoryLimit;
-                                                                               
        }
-                                                                               
});
-                                                                       }
-
-                                                                       
if(args.data.primaryStorageLimit != null) {
-                                                                         var 
data = {
-                                                                               
  resourceType: 10,
-                                                                               
        max: args.data.primaryStorageLimit,
-                                                                               
        domainid: accountObj.domainid,
-                                                                               
        account: accountObj.name
-                                                                               
};
-
-                                                                               
$.ajax({
-                                                                               
        url: createURL('updateResourceLimit'),
-                                                                               
        data: data,
-                                                                               
        async: false,
-                                                                               
        success: function(json) {
-                                                                               
                accountObj["primaryStorageLimit"] = 
args.data.primaryStorageLimit;
-                                                                               
        }
-                                                                               
});
-                                                                       }
-
-                                                                       
if(args.data.secondaryStorageLimit != null) {
-                                                                               
  var data = {
-                                                                               
          resourceType: 11,
-                                                                               
                max: args.data.secondaryStorageLimit,
-                                                                               
                domainid: accountObj.domainid,
-                                                                               
                account: accountObj.name
-                                                                               
        };
-
-                                                                               
        $.ajax({
-                                                                               
                url: createURL('updateResourceLimit'),
-                                                                               
                data: data,
-                                                                               
                async: false,
-                                                                               
                success: function(json) {
-                                                                               
                        accountObj["secondaryStorageLimit"] = 
args.data.secondaryStorageLimit;
-                                                                               
                }
-                                                                               
        });
-                                                                               
}
                   args.response.success({data: accountObj});
                 }
               },
@@ -704,7 +633,7 @@
                       converter: function(args){
                         return cloudStack.converters.toRole(args);
                       }
-                    },                    
+                    },
                     domain: { label: 'label.domain' },
                     state: { label: 'label.state' },
                     networkdomain: {
@@ -769,42 +698,6 @@
                                                                                
                  return false;
                                                                                
        }
                     },
-                    cpuLimit: {
-                      label: 'label.cpu.limits',
-                      isEditable: function(context) {
-                                                                               
          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;
-                                                                               
        }
-                    },
-                    memoryLimit: {
-                      label: 'label.memory.limits',
-                      isEditable: function(context) {
-                                                                               
          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;
-                                                                               
        }
-                    },
-                    primaryStorageLimit: {
-                      label: 'label.primary.storage.limits',
-                      isEditable: function(context) {
-                                                                               
          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;
-                                                                               
        }
-                    },
-                    secondaryStorageLimit: {
-                      label: 'label.secondary.storage.limits',
-                      isEditable: function(context) {
-                                                                               
          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;
-                                                                               
        }
-                    },
 
                     vmtotal: { label: 'label.total.of.vm' },
                     iptotal: { label: 'label.total.of.ip' },
@@ -832,11 +725,11 @@
                 dataProvider: function(args) {
                                                                  var data = {
                                                                          id: 
args.context.accounts[0].id
-                                                                       };
+                                                                       };      
                                                        
                                                                        $.ajax({
                                                                                
url: createURL('listAccounts'),
-                                                                               
data: data,
-                                                                               
success: function(json) {
+                                                                               
data: data,                                     
+                                                                               
success: function(json) {               
                                                                                
        var accountObj = json.listaccountsresponse.account[0];
                       var data = {
                                                                                
          domainid: accountObj.domainid,
@@ -844,7 +737,7 @@
                                                                                
        };
                                                                                
        $.ajax({
                                                                                
                url: createURL('listResourceLimits'),
-                                                                               
                data: data,
+                                                                               
                data: data,                                                     
                                
                                                                                
                success: function(json) {
                                                                                
                        var limits = 
json.listresourcelimitsresponse.resourcelimit;                                  
                                                                   
                                                                                
                        if (limits != null) {
@@ -866,34 +759,22 @@
                                                                                
                                        case "4":
                                                                                
                                                accountObj["templateLimit"] = 
limit.max;
                                                                                
                                                break;
-                                                                               
                                        case "7":
+                              case "7":
                                                                                
                                                accountObj["vpcLimit"] = 
limit.max;
                                                                                
                                                break;
-                                                                               
                                        case "8":
-                                                                               
                                                accountObj["cpuLimit"] = 
limit.max;
-                                                                               
                                                break;
-                                                                               
                                        case "9":
-                                                                               
                                                accountObj["memoryLimit"] = 
limit.max;
-                                                                               
                                                break;
-                                                                               
                                        case "10":
-                                                                               
                                                
accountObj["primaryStorageLimit"] = limit.max;
-                                                                               
                                                break;
-                                                                               
                                        case "11":
-                                                                               
                                                
accountObj["secondaryStorageLimit"] = limit.max;
-                                                                               
                                                break;
                                                                                
                                        }
                                                                                
                                }
-                                                                               
                        }
+                                                                               
                        }                                                       
                                                                                
                                                                        
                                                                                
                        args.response.success(
                                                                                
                                {
                                                                                
                                        actionFilter: accountActionfilter,
                                                                                
                                        data: accountObj 
                                                                                
                                }
-                                                                               
                        );
+                                                                               
                        );                                                      
                                                                                
                }
-                                                                               
        });
+                                                                               
        });                                                                     
                
                                                                                
}
-                                                                       });
+                                                                       });     
        
                 }
               }
             }

Reply via email to