cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bfede...@apache.org
Subject git commit: updated refs/heads/master to f9450cc
Date Tue, 02 Sep 2014 20:58:37 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 24dd6cee7 -> f9450cc11


CLOUDSTACK-6694: WIP: Add front-end for internal LB subselect


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

Branch: refs/heads/master
Commit: f9450cc1187544379e7f075960fca4c5103139a0
Parents: 24dd6ce
Author: Brian Federle <brian.federle@citrix.com>
Authored: Tue Sep 2 13:56:18 2014 -0700
Committer: Brian Federle <brian.federle@citrix.com>
Committed: Tue Sep 2 13:56:18 2014 -0700

----------------------------------------------------------------------
 ui/scripts/vpc.js | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f9450cc1/ui/scripts/vpc.js
----------------------------------------------------------------------
diff --git a/ui/scripts/vpc.js b/ui/scripts/vpc.js
index 83c5b83..4981efe 100644
--- a/ui/scripts/vpc.js
+++ b/ui/scripts/vpc.js
@@ -955,6 +955,54 @@
                                             listView: $.extend(true, {}, cloudStack.sections.instances.listView,
{
                                                 type: 'checkbox',
                                                 filters: false,
+                                                multiSelect: false,
+                                                subselect: {
+                                                    isMultiple: true,
+                                                    label: 'label.use.vm.ip',
+                                                    dataProvider: function(args) {      
 
+                                                        var instance = args.context.instances[0];
+                                                        var network = args.context.networks[0];
+
+                                                        $.ajax({
+                                                            url: createURL('listNics'),
+                                                            data: {
+                                                                virtualmachineid: instance.id,
+                                                                nicId: instance.nic[0].id
+                                                            },
+                                                            success: function(json) {   
            	
+                                                                var nic = json.listnicsresponse.nic[0];
+                                                                var primaryIp = nic.ipaddress;
+                                                                var secondaryIps = nic.secondaryip
? nic.secondaryip : [];
+                                                                var ipSelection = [];
+                                                                var existingIps = $(args.context.subItemData).map(
+                                                                    function(index, item)
{ return item.itemIp; }
+                                                                );
+
+                                                                // Add primary IP as default
+                                                                if ($.inArray(primaryIp,
existingIps) == -1) {
+                                                                    ipSelection.push({
+                                                                        id: primaryIp,
+                                                                        description: primaryIp
+ ' (Primary)'
+                                                                    });
+                                                                }
+
+                                                                // Add secondary IPs
+                                                                $(secondaryIps).map(function(index,
secondaryIp) {
+                                                                    if ($.inArray(secondaryIp.ipaddress,
existingIps) == -1) {
+                                                                        ipSelection.push({
+                                                                            id: secondaryIp.ipaddress,
+                                                                            description:
secondaryIp.ipaddress
+                                                                        });
+                                                                    }
+                                                                });
+
+                                                                args.response.success({
+                                                                    data: ipSelection
+                                                                });
+                                                            }
+                                                        });
+                                                    }
+                                                },
                                                 dataProvider: function(args) {
                                                     var assignedInstances;
                                                     $.ajax({
@@ -1007,7 +1055,18 @@
                                                 }
                                             }),
                                             action: function(args) {
+                                                var $rows = $(':ui-dialog .list-view tbody
tr');
                                                 var vms = args.context.instances;
+                                                
+                                                // Assign subselect values
+                                                $(vms).each(function() {
+                                                    var vm = this;
+                                                    var $vmRow = $rows.filter(function()
{
+                                                        return $(this).data('json-obj') ===
vm;
+                                                    });
+                                                    $.extend(vm, { _subselect: $vmRow.find('.subselect
select').val() });
+                                                });
+
                                                 var array1 = [];
                                                 for (var i = 0; i < vms.length; i++) {
                                                     array1.push(vms[i].id);


Mime
View raw message