Skip to content

Commit ecc30dd

Browse files
author
Jessica Wang
committed
CLOUDSTACK-2678: portable IP ranges - regions menu - Portable IP Ranges - implement Delete Portable IP Range action.
1 parent 78e50c3 commit ecc30dd

1 file changed

Lines changed: 91 additions & 3 deletions

File tree

ui/scripts/regions.js

Lines changed: 91 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -489,13 +489,11 @@
489489
actions: {
490490
add: {
491491
label: 'Add Portable IP Range',
492-
493492
messages: {
494493
notification: function(args) {
495494
return 'Add Portable IP Range';
496495
}
497496
},
498-
499497
createForm: {
500498
title: 'Add Portable IP Range',
501499
fields: {
@@ -557,7 +555,97 @@
557555
poll: pollAsyncJobResult
558556
}
559557
}
560-
}
558+
},
559+
560+
detailView: {
561+
name: 'Portable IP Range details',
562+
actions: {
563+
remove: {
564+
label: 'Delete Portable IP Range',
565+
messages: {
566+
confirm: function(args) {
567+
return 'Please confirm you want to delete Portable IP Range';
568+
},
569+
notification: function(args) {
570+
return 'Delete Portable IP Range';
571+
}
572+
},
573+
action: function(args) {
574+
var data = {
575+
id: args.context.portableIpRanges[0].id
576+
};
577+
$.ajax({
578+
url: createURL('deletePortableIpRange'),
579+
data: data,
580+
async: true,
581+
success: function(json) {
582+
var jid = json.deleteportablepublicipresponse.jobid;
583+
args.response.success({
584+
_custom: {
585+
jobId: jid
586+
}
587+
});
588+
},
589+
error: function(data) {
590+
args.response.error(parseXMLHttpResponse(data));
591+
}
592+
});
593+
},
594+
notification: {
595+
poll: pollAsyncJobResult
596+
}
597+
}
598+
},
599+
tabs: {
600+
details: {
601+
title: 'label.details',
602+
fields: [
603+
{
604+
id: { label: 'label.id' }
605+
},
606+
{
607+
startip: { label: 'label.start.IP' },
608+
endip: { label: 'label.end.IP' },
609+
gateway: { label: 'label.gateway' },
610+
netmask: { label: 'label.netmask' },
611+
vlan: { label: 'label.vlan' },
612+
portableipaddress: {
613+
label: 'Portable IPs',
614+
converter: function(args) {
615+
var text1 = '';
616+
if(args != null) {
617+
for(var i = 0; i < args.length; i++) {
618+
if(i > 0) {
619+
text1 += ', ';
620+
}
621+
text1 += args[i].ipaddress;
622+
}
623+
}
624+
return text1;
625+
}
626+
}
627+
}
628+
],
629+
dataProvider: function(args) {
630+
$.ajax({
631+
url: createURL('listPortableIpRanges'),
632+
data: {
633+
id: args.context.portableIpRanges[0].id
634+
},
635+
success: function(json) {
636+
var item = json.listportableipresponse.portableiprange[0];
637+
args.response.success({
638+
data: item
639+
});
640+
},
641+
error: function(json) {
642+
args.response.error(parseXMLHttpResponse(json));
643+
}
644+
});
645+
}
646+
}
647+
}
648+
}
561649
}
562650
},
563651

0 commit comments

Comments
 (0)