diff --git a/ui/scripts/network.js b/ui/scripts/network.js
index 78c90e1a1ff..cc6e9a7553b 100755
--- a/ui/scripts/network.js
+++ b/ui/scripts/network.js
@@ -1186,10 +1186,6 @@
}
});
- if (!networkHavingELB) {
- hiddenTabs.push("addloadBalancer");
- }
-
if (isVPC || isAdvancedSGZone || isSharedNetwork) {
hiddenTabs.push('egressRules');
}
@@ -1657,241 +1653,6 @@
}
});
}
- },
-
- addloadBalancer: { // EIP/ELB Basic zone: Add Load Balancer tab in network detailView
- title: 'label.add.load.balancer',
- custom: function(args) {
- var context = args.context;
-
- return $('
').addClass('loadBalancer').multiEdit({
- context: context,
- listView: $.extend(true, {}, cloudStack.sections.instances, {
- listView: {
- filters: false,
-
- dataProvider: function(args) {
- var data = {
- page: args.page,
- pageSize: pageSize,
- domainid: g_domainid,
- account: g_account,
- networkid: args.context.networks[0].id,
- listAll: true
- };
-
- $.ajax({
- url: createURL('listVirtualMachines'),
- data: data,
- dataType: 'json',
- async: true,
- success: function(data) {
- args.response.success({
- data: $.grep(
- data.listvirtualmachinesresponse.virtualmachine ?
- data.listvirtualmachinesresponse.virtualmachine : [],
- function(instance) {
- var nonAutoScale = 0;
- if (instance.displayname == null)
- nonAutoScale = 1;
- else {
- if (instance.displayname.match(/AutoScale-LB-/) == null)
- nonAutoScale = 1;
- else {
- if (instance.displayname.match(/AutoScale-LB-/).length)
- nonAutoScale = 0;
- }
- }
- var isActiveState = $.inArray(instance.state, ['Destroyed', 'Expunging']) == -1;
- return nonAutoScale && isActiveState;
- }
- )
- });
- },
- error: function(data) {
- args.response.error(parseXMLHttpResponse(data));
- }
- });
- }
- }
- }),
- multipleAdd: true,
- fields: {
- 'name': {
- edit: true,
- label: 'label.name'
- },
- 'publicport': {
- edit: true,
- label: 'label.public.port'
- },
- 'privateport': {
- edit: true,
- label: 'label.private.port'
- },
- 'algorithm': {
- label: 'label.algorithm',
- select: function(args) {
- var data = [{
- id: 'roundrobin',
- name: 'roundrobin',
- description: _l('label.lb.algorithm.roundrobin')
- }, {
- id: 'leastconn',
- name: 'leastconn',
- description: _l('label.lb.algorithm.leastconn')
- }, {
- id: 'source',
- name: 'source',
- description: _l('label.lb.algorithm.source')
- }];
- if (typeof args.context != 'undefined') {
- var lbAlgs = getLBAlgorithms(args.context.networks[0]);
- data = (lbAlgs.length == 0) ? data : lbAlgs;
- }
- args.response.success({
- data: data
- });
- }
- },
- 'sticky': {
- label: 'label.stickiness',
- custom: {
- buttonLabel: 'label.configure',
- action: cloudStack.lbStickyPolicy.dialog()
- }
- },
- 'autoScale': {
- label: 'label.autoscale',
- custom: {
- requireValidation: true,
- buttonLabel: 'label.configure',
- action: cloudStack.uiCustom.autoscaler(cloudStack.autoscaler)
- }
- },
- 'add-vm': {
- label: 'label.add.vms',
- addButton: true
- },
- 'state' : {
- edit: 'ignore',
- label: 'label.state'
- }
- },
-
- add: { //basic zone - elastic IP - Add Load Balancer tab - Add VMs button
- label: 'label.add.vms',
- action: function(args) {
- var data = {
- algorithm: args.data.algorithm,
- name: args.data.name,
- privateport: args.data.privateport,
- publicport: args.data.publicport,
- openfirewall: false,
- domainid: g_domainid,
- account: g_account
- };
-
- if ('vpc' in args.context) { //from VPC section
- if (args.data.tier == null) {
- args.response.error('Tier is required');
- return;
- }
- $.extend(data, {
- networkid: args.data.tier
- });
- } else { //from Guest Network section
- $.extend(data, {
- networkid: args.context.networks[0].id
- });
- }
-
- var stickyData = $.extend(true, {}, args.data.sticky);
-
- $.ajax({
- url: createURL('createLoadBalancerRule'),
- data: data,
- dataType: 'json',
- async: true,
- success: function(data) {
- var itemData = args.itemData;
- //var jobID = data.createloadbalancerruleresponse.jobid; //CS-16964: use jobid from assignToLoadBalancerRule instead of createLoadBalancerRule
-
- $.ajax({
- url: createURL('assignToLoadBalancerRule'),
- data: {
- id: data.createloadbalancerruleresponse.id,
- virtualmachineids: $.map(itemData, function(elem) {
- return elem.id;
- }).join(',')
- },
- dataType: 'json',
- async: true,
- success: function(data) {
- var jobID = data.assigntoloadbalancerruleresponse.jobid; //CS-16964: use jobid from assignToLoadBalancerRule instead of createLoadBalancerRule
- var lbCreationComplete = false;
-
- args.response.success({
- _custom: {
- jobId: jobID
- },
- notification: {
- label: 'label.add.load.balancer',
- poll: function(args) {
- var complete = args.complete;
- var error = args.error;
-
- pollAsyncJobResult({
- _custom: args._custom,
- complete: function(args) {
- if (lbCreationComplete) {
- return;
- }
-
- lbCreationComplete = true;
- cloudStack.dialog.notice({
- message: _l('message.add.load.balancer.under.ip') + args.data.loadbalancer.publicip
- });
-
- if (stickyData &&
- stickyData.methodname &&
- stickyData.methodname != 'None') {
- cloudStack.lbStickyPolicy.actions.add(
- args.data.loadbalancer.id,
- stickyData,
- complete, // Complete
- complete // Error
- );
- } else {
- complete();
- }
- },
- error: error
- });
- }
- }
- });
- },
- error: function(data) {
- args.response.error(parseXMLHttpResponse(data));
- }
- });
- },
- error: function(data) {
- args.response.error(parseXMLHttpResponse(data));
- }
- });
- }
- },
-
-
- dataProvider: function(args) {
- args.response.success({ //no LB listing in AddLoadBalancer tab
- data: []
- });
- }
- });
- }
}
}
}