Updated Branches:
  refs/heads/4.3 3d601ba41 -> 8249974cc

CLOUDSTACK-1889: UI > accounts > Update Resource Count action > after action 
succeeds, pop up a dialog to show updated count of resources.


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

Branch: refs/heads/4.3
Commit: 8249974cc227a4513bf1dfb5cf98e3af6e507933
Parents: 3d601ba
Author: Jessica Wang <jessicaw...@apache.org>
Authored: Wed Nov 27 13:05:47 2013 -0800
Committer: Jessica Wang <jessicaw...@apache.org>
Committed: Wed Nov 27 13:06:10 2013 -0800

----------------------------------------------------------------------
 ui/scripts/accounts.js | 54 ++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 53 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8249974c/ui/scripts/accounts.js
----------------------------------------------------------------------
diff --git a/ui/scripts/accounts.js b/ui/scripts/accounts.js
index 7267252..72bc00f 100644
--- a/ui/scripts/accounts.js
+++ b/ui/scripts/accounts.js
@@ -372,7 +372,59 @@
                                         data: data,
                                         async: true,
                                         success: function(json) {
-                                            //var resourcecounts= 
json.updateresourcecountresponse.resourcecount;   //do nothing
+                                            var resourcecounts= 
json.updateresourcecountresponse.resourcecount;                                 
              
+                                            //pop up API response in a dialog 
box since only updateResourceCount API returns resourcecount 
(listResourceLimits API does NOT return resourcecount)
+                                            var msg = '';
+                                            if (resourcecounts != null) {
+                                               for (var i = 0; i < 
resourcecounts.length; i++) {                                                   
    
+                                                       switch 
(resourcecounts[i].resourcetype) {
+                                                       case '0':
+                                                               msg += 
'Instance'; //vmLimit
+                                                               break;
+                                                       case '1':
+                                                               msg += 'Public 
IP'; //ipLimit
+                                                               break;
+                                                       case '2':
+                                                               msg += 
'Volume'; //volumeLimit
+                                                               break;
+                                                       case '3':
+                                                           msg += 'Snapshot'; 
//snapshotLimit
+                                                           break;
+                                                       case '4':
+                                                               msg += 
'Template'; //templateLimit
+                                                               break;
+                                                       case '5':               
                                                
+                                                               continue; 
//resourcetype 5 is not in use. so, skip to next item.                          
                                      
+                                                               break;
+                                                       case '6':
+                                                               msg += 
'Network'; //networkLimit
+                                                               break;
+                                                       case '7':
+                                                               msg += 'VPC'; 
//vpcLimit
+                                                               break;
+                                                       case '8':
+                                                               msg += 'CPU'; 
//cpuLimit
+                                                               break;
+                                                       case '9':
+                                                               msg += 
'Memory'; //memoryLimit
+                                                               break;
+                                                       case '10':
+                                                               msg += 'Primary 
Storage'; //primaryStorageLimit
+                                                               break;
+                                                       case '11':
+                                                               msg += 
'Secondary Storage'; //secondaryStorageLimit
+                                                               break;      
+                                                       }
+                                                                               
                        
+                                                       msg += ' Count: ' + 
resourcecounts[i].resourcecount + ' <br> ';
+                                               }
+                                            }
+                                            
+                                            
+                                            cloudStack.dialog.notice({
+                                               message: msg
+                                            });                                
            
+                                            
                                             args.response.success();
                                         },
                                         error: function(json) {

Reply via email to