From acba29efc25950343b1c9b6f919594f376100e58 Mon Sep 17 00:00:00 2001 From: Frederick Borges Date: Tue, 10 Jan 2023 12:15:24 +0100 Subject: [PATCH] B #6061: Fix issue removing AR on vnet template (#2439) --- .../app/tabs/vnets-templates-tab/panels/ar.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/sunstone/public/app/tabs/vnets-templates-tab/panels/ar.js b/src/sunstone/public/app/tabs/vnets-templates-tab/panels/ar.js index c4b0a37a73..de60787bec 100644 --- a/src/sunstone/public/app/tabs/vnets-templates-tab/panels/ar.js +++ b/src/sunstone/public/app/tabs/vnets-templates-tab/panels/ar.js @@ -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