diff --git a/src/sunstone/public/app/tabs/vnets-templates-tab/actions.js b/src/sunstone/public/app/tabs/vnets-templates-tab/actions.js index dee10c6901..ce5c539eb7 100644 --- a/src/sunstone/public/app/tabs/vnets-templates-tab/actions.js +++ b/src/sunstone/public/app/tabs/vnets-templates-tab/actions.js @@ -64,7 +64,6 @@ define(function(require) { call: OpenNebulaResource.update, callback: function(req) { // Reset the wizard - Sunstone.getDialog(ADD_AR_DIALOG_ID).hide(); Sunstone.getDialog(ADD_AR_DIALOG_ID).reset(); Sunstone.runAction("VNTemplate.show",req.request.data[0]); @@ -77,7 +76,6 @@ define(function(require) { call: OpenNebulaResource.update, callback: function(req) { // Reset the wizard - Sunstone.getDialog(UPDATE_AR_DIALOG_ID).hide(); Sunstone.getDialog(UPDATE_AR_DIALOG_ID).reset(); Sunstone.runAction("VNTemplate.show",req.request.data[0]); diff --git a/src/sunstone/public/app/tabs/vnets-templates-tab/dialogs/add-ar.js b/src/sunstone/public/app/tabs/vnets-templates-tab/dialogs/add-ar.js index 701c2ae9c5..ef66648adf 100644 --- a/src/sunstone/public/app/tabs/vnets-templates-tab/dialogs/add-ar.js +++ b/src/sunstone/public/app/tabs/vnets-templates-tab/dialogs/add-ar.js @@ -99,9 +99,7 @@ define(function(require) { delete that.element.TEMPLATE.AR_POOL; Sunstone.runAction('VNTemplate.add_ar', that.vntmplId, TemplateUtils.templateToString(that.element.TEMPLATE)); - }) - .on("submit", function(ev) { - ev.preventDefault(); + return false; }); } diff --git a/src/sunstone/public/app/tabs/vnets-templates-tab/dialogs/instantiate-add-ar.js b/src/sunstone/public/app/tabs/vnets-templates-tab/dialogs/instantiate-add-ar.js index 6852c5733c..bba025adae 100644 --- a/src/sunstone/public/app/tabs/vnets-templates-tab/dialogs/instantiate-add-ar.js +++ b/src/sunstone/public/app/tabs/vnets-templates-tab/dialogs/instantiate-add-ar.js @@ -133,11 +133,10 @@ define(function(require) { $("#ar_list_datatable", that.context).DataTable().columns.adjust().draw(); $("#ar_list_datatable tbody tr:last", that.context).attr("ar", data.AR_ID); - - Sunstone.getDialog(DIALOG_ID).hide(); }) .on("submit", function(ev) { ev.preventDefault(); + Sunstone.getDialog(DIALOG_ID).hide(); }); $("#instantiate_add_ar_ar_type_ip4", context).prop('checked', true); diff --git a/src/sunstone/public/app/tabs/vnets-templates-tab/dialogs/update-ar.js b/src/sunstone/public/app/tabs/vnets-templates-tab/dialogs/update-ar.js index 527e8211b1..d4d91be3a7 100644 --- a/src/sunstone/public/app/tabs/vnets-templates-tab/dialogs/update-ar.js +++ b/src/sunstone/public/app/tabs/vnets-templates-tab/dialogs/update-ar.js @@ -79,15 +79,19 @@ define(function(require) { }) .on('formvalid.zf.abide', function(ev, frm) { var data = that.arTab.retrieve(); - data['AR_ID'] = that.arId; - - for (i in that.element.TEMPLATE.AR) { - if ( that.element.TEMPLATE.AR[i].AR_ID == that.arId ) { - that.element.TEMPLATE.AR[i] = data; - break; + + if (Array.isArray(that.element.TEMPLATE.AR)){ + for (i in that.element.TEMPLATE.AR) { + if ( that.element.TEMPLATE.AR[i].AR_ID == that.arId ) { + that.element.TEMPLATE.AR[i] = data; + break; + } } } + else { + that.element.TEMPLATE.AR = data; + } delete that.element.TEMPLATE.AR_POOL; @@ -97,6 +101,7 @@ define(function(require) { }) .on("submit", function(ev) { ev.preventDefault(); + Sunstone.getDialog(DIALOG_ID).hide(); } ); } diff --git a/src/sunstone/public/app/utils/dialogs/dialog.js b/src/sunstone/public/app/utils/dialogs/dialog.js index a127b1666f..62d376e7f4 100644 --- a/src/sunstone/public/app/utils/dialogs/dialog.js +++ b/src/sunstone/public/app/utils/dialogs/dialog.js @@ -72,7 +72,7 @@ define(function(require) { } function _hide() { - this.dialogElement.foundation("close"); + this.dialogElement.foundation("close"); } function _reset() {