Add account combo box to Add Shared Volume window

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

Branch: refs/heads/sf-plugins
Commit: cc64dc1d5849625b8d2bc1e1c07742a33f8dcce5
Parents: 18800c9
Author: Mike Tutkowski <[email protected]>
Authored: Tue Jul 7 17:38:26 2015 -0600
Committer: Mike Tutkowski <[email protected]>
Committed: Fri Sep 18 19:28:18 2015 -0600

----------------------------------------------------------------------
 ui/plugins/sfSharedVolume/sfSharedVolume.js | 39 ++++++++++++++++++------
 1 file changed, 30 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cc64dc1d/ui/plugins/sfSharedVolume/sfSharedVolume.js
----------------------------------------------------------------------
diff --git a/ui/plugins/sfSharedVolume/sfSharedVolume.js 
b/ui/plugins/sfSharedVolume/sfSharedVolume.js
index c6371ca..f8f3aaf 100644
--- a/ui/plugins/sfSharedVolume/sfSharedVolume.js
+++ b/ui/plugins/sfSharedVolume/sfSharedVolume.js
@@ -69,14 +69,14 @@
                   }
                 },
                 name: {
-                                 label: 'label.name',
+                  label: 'label.name',
                   docID: 'helpVolumeName',
                   validation: {
                     required: true
                   }
                 },
                 diskSize: {
-                                 label: 'label.disk.size.gb',
+                  label: 'label.disk.size.gb',
                   validation: {
                     required: true,
                     number: true
@@ -103,6 +103,27 @@
                     number: true
                   }
                 },
+                account: {
+                  label: 'Account',
+                  validation: {
+                    required: true
+                  },
+                  select: function(args) {
+                    $.ajax({
+                      url: createURL("listAccounts"),
+                      dataType: "json",
+                      async: true,
+                      success: function(json) {
+                        var accountObjs = json.listaccountsresponse.account;
+
+                        args.response.success({
+                          descriptionField: 'name',
+                          data: accountObjs
+                        });
+                      }
+                    });
+                  }
+                },
                 vlan: {
                   label: 'VLAN',
                   validation: {
@@ -126,22 +147,22 @@
                 }
               }
             },
-                       action: function(args) {
+            action: function(args) {
               var data = {
                 name: args.data.name,
-                               size: args.data.diskSize,
+                size: args.data.diskSize,
                 miniops: args.data.minIops,
                 maxiops: args.data.maxIops,
-                               burstiops: args.data.burstIops,
-                               sfvirtualnetworkid: args.data.vlan,
-                               accountid: 2
+                burstiops: args.data.burstIops,
+                accountid: args.data.account,
+                sfvirtualnetworkid: args.data.vlan
               };
 
               $.ajax({
                 url: createURL('createSolidFireVolume'),
                 data: data,
                 success: function(json) {
-                             var sfvolumeObj = 
json.createsolidfirevolumeresponse.apicreatesolidfirevolume;
+                  var sfvolumeObj = 
json.createsolidfirevolumeresponse.apicreatesolidfirevolume;
 
                   args.response.success({
                     data: sfvolumeObj
@@ -151,7 +172,7 @@
                   args.response.error(parseXMLHttpResponse(json));
                 }
               });
-                       }
+            }
           }
         },
         detailView: {

Reply via email to