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/78366e55
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/78366e55
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/78366e55

Branch: refs/heads/sf-plugins
Commit: 78366e55835afade53d4cd791a878d4eecab66ce
Parents: ce6912c
Author: Mike Tutkowski <mike.tutkow...@solidfire.com>
Authored: Tue Jul 7 17:38:26 2015 -0600
Committer: CloudStack <cloudstack@cloudstack-virtual-machine.(none)>
Committed: Tue Jul 28 13:42:41 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/78366e55/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