Skip to content

Commit 78e50c3

Browse files
author
Jessica Wang
committed
CLOUDSTACK-2678: portable IP ranges - regions detailView - Portable IP Ranges - implement Add Portable IP Range action.
1 parent 7ee71df commit 78e50c3

1 file changed

Lines changed: 79 additions & 5 deletions

File tree

ui/scripts/regions.js

Lines changed: 79 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -463,9 +463,11 @@
463463
id: 'portableIpRanges',
464464
label: 'Portable IP Ranges',
465465
fields: {
466-
name: { label: 'label.name' },
467-
gslbdomainname: { label: 'GSLB Domain Name' },
468-
gslblbmethod: { label: 'Algorithm' }
466+
startip: { label: 'label.start.IP' },
467+
endip: { label: 'label.end.IP' },
468+
gateway: { label: 'label.gateway' },
469+
netmask: { label: 'label.netmask' },
470+
vlan: { label: 'label.vlan' }
469471
},
470472
dataProvider: function(args) {
471473
$.ajax({
@@ -474,7 +476,7 @@
474476
regionid: args.context.regions[0].id
475477
},
476478
success: function(json) {
477-
var items = json.listportableipresponse.portableip;
479+
var items = json.listportableipresponse.portableiprange;
478480
args.response.success({
479481
data: items
480482
});
@@ -483,7 +485,79 @@
483485
args.response.error(parseXMLHttpResponse(json));
484486
}
485487
});
486-
}
488+
},
489+
actions: {
490+
add: {
491+
label: 'Add Portable IP Range',
492+
493+
messages: {
494+
notification: function(args) {
495+
return 'Add Portable IP Range';
496+
}
497+
},
498+
499+
createForm: {
500+
title: 'Add Portable IP Range',
501+
fields: {
502+
startip: {
503+
label: 'label.start.IP',
504+
validation: { required: true }
505+
},
506+
endip: {
507+
label: 'label.end.IP',
508+
validation: { required: true }
509+
},
510+
gateway: {
511+
label: 'label.gateway',
512+
validation: { required: true }
513+
},
514+
netmask: {
515+
label: 'label.netmask',
516+
validation: { required: true }
517+
},
518+
vlan: {
519+
label: 'label.vlan',
520+
validation: { required: false }
521+
}
522+
}
523+
},
524+
action: function(args) {
525+
var data = {
526+
regionid: args.context.regions[0].id,
527+
startip: args.data.startip,
528+
endip: args.data.endip,
529+
gateway: args.data.gateway,
530+
netmask: args.data.netmask
531+
};
532+
if(args.data.vlan != null && args.data.vlan.length > 0) {
533+
$.extend(data, {
534+
vlan: args.data.vlan
535+
})
536+
}
537+
$.ajax({
538+
url: createURL('createPortableIpRange'),
539+
data: data,
540+
success: function(json) {
541+
var jid = json.createportableiprangeresponse.jobid;
542+
args.response.success({
543+
_custom: {
544+
jobId: jid,
545+
getUpdatedItem: function(json) {
546+
return json.queryasyncjobresultresponse.jobresult.portableiprange;
547+
}
548+
}
549+
});
550+
},
551+
error: function(data) {
552+
args.response.error(parseXMLHttpResponse(data));
553+
}
554+
});
555+
},
556+
notification: {
557+
poll: pollAsyncJobResult
558+
}
559+
}
560+
}
487561
}
488562
},
489563

0 commit comments

Comments
 (0)