Skip to content

Commit a292bfb

Browse files
author
Jessica Wang
committed
CLOUDSTACK-747: UI - VPC tier - Public LB IP - populate listView of Public LB IP.
1 parent bc7d7e6 commit a292bfb

1 file changed

Lines changed: 28 additions & 91 deletions

File tree

‎ui/scripts/vpc.js‎

Lines changed: 28 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -587,100 +587,37 @@
587587
listView: {
588588
id: 'publicLbIps',
589589
fields: {
590-
ipaddress: { label: 'label.ip.address' },
591-
type: { label: 'label.type' }
592-
},
593-
dataProvider: function(args) {
594-
args.response.success({
595-
data: [
596-
{ ipaddress: '10.3.2.1', type: 'Internal' },
597-
{ ipaddress: '10.3.2.3', type: 'Internal' },
598-
{ ipaddress: '10.232.1.4', type: 'Public' }
599-
]
600-
});
601-
},
602-
actions: {
603-
add: {
604-
label: 'Add Public LB',
605-
createForm: {
606-
title: 'Add Public LB',
607-
fields: {
608-
name: { label: 'label.name', validation: { required: true } },
609-
description: { label: 'label.description', validation: { required: false } },
610-
sourceipaddress: { label: 'Source IP Address', validation: { required: false } },
611-
sourceport: { label: 'sourceport', validation: { required: true } },
612-
instanceport: { label: 'instanceport', validation: { required: true } },
613-
algorithm: {
614-
label: 'label.algorithm',
615-
validation: { required: true },
616-
select: function(args) {
617-
args.response.success({
618-
data: [
619-
{ id: 'source', description: 'source' },
620-
{ id: 'roundrobin', description: 'roundrobin' },
621-
{ id: 'leastconn', description: 'leastconn' }
622-
]
623-
});
624-
}
625-
}
626-
}
627-
},
628-
messages: {
629-
notification: function(args) {
630-
return 'Add Public LB';
631-
}
632-
},
633-
action: function(args) {
634-
var data = {
635-
name: args.data.name,
636-
sourceport: args.data.sourceport,
637-
instanceport: args.data.instanceport,
638-
algorithm: args.data.algorithm,
639-
networkid: args.context.networks[0].id,
640-
sourceipaddressnetworkid: args.context.networks[0].id,
641-
scheme: 'Public'
642-
};
643-
if(args.data.description != null && args.data.description.length > 0){
644-
$.extend(data, {
645-
description: args.data.description
646-
});
647-
}
648-
if(args.data.sourceipaddress != null && args.data.sourceipaddress.length > 0){
649-
$.extend(data, {
650-
sourceipaddress: args.data.sourceipaddress
651-
});
652-
}
653-
$.ajax({
654-
url: createURL('createLoadBalancer'),
655-
data: data,
656-
success: function(json){
657-
var jid = json.createloadbalancerresponse.jobid;
658-
args.response.success(
659-
{_custom:
660-
{jobId: jid,
661-
getUpdatedItem: function(json) {
662-
return json.queryasyncjobresultresponse.jobresult.loadbalancerrule;
663-
}
664-
}
665-
}
666-
);
667-
}
668-
});
669-
670-
args.response.success();
671-
},
672-
notification: {
673-
poll: function(args) {
674-
args.complete({
675-
data: {
676-
ipaddress: '10.0.3.2',
677-
type: 'Internal'
678-
}
679-
});
590+
ipaddress: {
591+
label: 'label.ips',
592+
converter: function(text, item) {
593+
if (item.issourcenat) {
594+
return text + ' [' + _l('label.source.nat') + ']';
680595
}
596+
597+
return text;
681598
}
599+
},
600+
zonename: { label: 'label.zone' },
601+
virtualmachinedisplayname: { label: 'label.vm.name' },
602+
state: {
603+
converter: function(str) {
604+
// For localization
605+
return str;
606+
},
607+
label: 'label.state', indicator: { 'Allocated': 'on', 'Released': 'off' }
682608
}
683-
}
609+
},
610+
dataProvider: function(args) {
611+
$.ajax({
612+
url: createURL('listPublicIpAddresses'),
613+
async: false,
614+
data: { networkid: args.context.networks[0].id, forloadbalancing: true },
615+
success: function(json) {
616+
var items = json.listpublicipaddressesresponse;
617+
args.response.success({ data: items });
618+
}
619+
});
620+
}
684621
}
685622
},
686623

0 commit comments

Comments
 (0)