CLOUDSTACK-747: UI - VPC tier - Public LB IP - populate listView of Public LB IP.

This commit is contained in:
Jessica Wang 2013-05-23 11:53:25 -07:00
parent bc7d7e64c0
commit a292bfbfcd
1 changed files with 28 additions and 91 deletions

View File

@ -587,100 +587,37 @@
listView: {
id: 'publicLbIps',
fields: {
ipaddress: { label: 'label.ip.address' },
type: { label: 'label.type' }
},
dataProvider: function(args) {
args.response.success({
data: [
{ ipaddress: '10.3.2.1', type: 'Internal' },
{ ipaddress: '10.3.2.3', type: 'Internal' },
{ ipaddress: '10.232.1.4', type: 'Public' }
]
});
},
actions: {
add: {
label: 'Add Public LB',
createForm: {
title: 'Add Public LB',
fields: {
name: { label: 'label.name', validation: { required: true } },
description: { label: 'label.description', validation: { required: false } },
sourceipaddress: { label: 'Source IP Address', validation: { required: false } },
sourceport: { label: 'sourceport', validation: { required: true } },
instanceport: { label: 'instanceport', validation: { required: true } },
algorithm: {
label: 'label.algorithm',
validation: { required: true },
select: function(args) {
args.response.success({
data: [
{ id: 'source', description: 'source' },
{ id: 'roundrobin', description: 'roundrobin' },
{ id: 'leastconn', description: 'leastconn' }
]
});
}
}
}
},
messages: {
notification: function(args) {
return 'Add Public LB';
}
},
action: function(args) {
var data = {
name: args.data.name,
sourceport: args.data.sourceport,
instanceport: args.data.instanceport,
algorithm: args.data.algorithm,
networkid: args.context.networks[0].id,
sourceipaddressnetworkid: args.context.networks[0].id,
scheme: 'Public'
};
if(args.data.description != null && args.data.description.length > 0){
$.extend(data, {
description: args.data.description
});
}
if(args.data.sourceipaddress != null && args.data.sourceipaddress.length > 0){
$.extend(data, {
sourceipaddress: args.data.sourceipaddress
});
}
$.ajax({
url: createURL('createLoadBalancer'),
data: data,
success: function(json){
var jid = json.createloadbalancerresponse.jobid;
args.response.success(
{_custom:
{jobId: jid,
getUpdatedItem: function(json) {
return json.queryasyncjobresultresponse.jobresult.loadbalancerrule;
}
}
}
);
}
});
args.response.success();
},
notification: {
poll: function(args) {
args.complete({
data: {
ipaddress: '10.0.3.2',
type: 'Internal'
}
});
ipaddress: {
label: 'label.ips',
converter: function(text, item) {
if (item.issourcenat) {
return text + ' [' + _l('label.source.nat') + ']';
}
return text;
}
},
zonename: { label: 'label.zone' },
virtualmachinedisplayname: { label: 'label.vm.name' },
state: {
converter: function(str) {
// For localization
return str;
},
label: 'label.state', indicator: { 'Allocated': 'on', 'Released': 'off' }
}
}
},
dataProvider: function(args) {
$.ajax({
url: createURL('listPublicIpAddresses'),
async: false,
data: { networkid: args.context.networks[0].id, forloadbalancing: true },
success: function(json) {
var items = json.listpublicipaddressesresponse;
args.response.success({ data: items });
}
});
}
}
},