1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-10 01:17:40 +03:00

B #6061: Fix issue removing AR on vnet template (#2439)

This commit is contained in:
Frederick Borges 2023-01-10 12:15:24 +01:00 committed by GitHub
parent 0784385caf
commit acba29efc2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -180,6 +180,9 @@ define(function(require) {
context.off("click", 'button#rm_ar_button');
context.on("click", 'button#rm_ar_button', function(){
var ar_id = $(this).attr('ar_id');
var ar_list = Array.isArray(that.element.TEMPLATE.AR)
? that.element.TEMPLATE.AR
: [that.element.TEMPLATE.AR]
Sunstone.getDialog(CONFIRM_DIALOG_ID).setParams({
//header :
@ -187,16 +190,15 @@ define(function(require) {
body : Locale.tr("This will delete all the addresses in this range"),
//question :
submit : function(){
var obj = {ar_id: ar_id};
for (i in that.element.TEMPLATE.AR) {
if ( that.element.TEMPLATE.AR[i].AR_ID == ar_id ) {
that.element.TEMPLATE.AR.splice(i, 1);
for (var i=0; i<ar_list.length; i++){
if (ar_id == i){
delete ar_list[i]
break;
}
}
delete that.element.TEMPLATE.AR_POOL;
that.element.TEMPLATE.AR = ar_list
that.element.TEMPLATE.AR_POOL = ar_list
Sunstone.runAction('VNTemplate.remove_ar', that.element.ID, TemplateUtils.templateToString(that.element.TEMPLATE));