diff --git a/src/sunstone/public/app/sunstone.js b/src/sunstone/public/app/sunstone.js index 1267258694..4d74f9cf3d 100644 --- a/src/sunstone/public/app/sunstone.js +++ b/src/sunstone/public/app/sunstone.js @@ -1031,7 +1031,10 @@ define(function(require) { } var context = $("#" + tabId); - $('[href="back"]', context).trigger("click"); + + if (_formPanelVisible(context)){ + $('[href="back"]', context).trigger("click"); + } } function _popFormPanelLoading(tabId) { diff --git a/src/sunstone/public/app/tabs/templates-tab/actions-common.js b/src/sunstone/public/app/tabs/templates-tab/actions-common.js index 49aa8a145f..8fca2ad97b 100644 --- a/src/sunstone/public/app/tabs/templates-tab/actions-common.js +++ b/src/sunstone/public/app/tabs/templates-tab/actions-common.js @@ -80,8 +80,9 @@ define(function(require) { type: "multiple", call: OpenNebulaResource.delete_recursive, callback : function(request, response) { - var elementId = request.request.data[0].toString(); - Sunstone.getDataTable(TAB_ID).deleteElement(elementId); + if (Sunstone.getTab() == TAB_ID) { + Sunstone.showTab(TAB_ID); + } }, elements: function(opts) { return Sunstone.getDataTable(TAB_ID).elements(opts); diff --git a/src/sunstone/public/app/tabs/vnets-tab/form-panels/create.js b/src/sunstone/public/app/tabs/vnets-tab/form-panels/create.js index 2d53738c35..ca5adc902f 100644 --- a/src/sunstone/public/app/tabs/vnets-tab/form-panels/create.js +++ b/src/sunstone/public/app/tabs/vnets-tab/form-panels/create.js @@ -324,7 +324,7 @@ define(function(require) { this.setHeader(element); this.resourceId = element.ID; - $("#default_sg_warning").hide(); + $("#default_sg_warning", context).hide(); // Populates the Avanced mode Tab $('#template', context).val(TemplateUtils.templateToString(element.TEMPLATE)); @@ -380,7 +380,7 @@ define(function(require) { CustomTagsTable.fill($("#vnetCreateContextTab", context), element.TEMPLATE); // Remove the first AR added in initialize_ - $("#vnetCreateARTab i.remove-tab", context).trigger("click"); + $("#vnetCreateARTab ul#vnet_wizard_ar_tabs i.remove-tab", context).trigger("click"); $("#vnetCreateARTab #vnetCreateARTabUpdate", context).show(); $("#vnetCreateARTab #vnetCreateARTabCreate", context).hide(); } diff --git a/src/sunstone/public/app/utils/common-actions.js b/src/sunstone/public/app/utils/common-actions.js index c793f9b27f..4c1abc2c00 100644 --- a/src/sunstone/public/app/utils/common-actions.js +++ b/src/sunstone/public/app/utils/common-actions.js @@ -98,8 +98,11 @@ define(function(require) { type: "multiple", call : that.openNebulaResource.del, callback : function(request, response) { - var elementId = request.request.data.toString(); - Sunstone.getDataTable(that.tabId).deleteElement(elementId); + var tab = $('#' + that.tabId); + + if (Sunstone.getTab() == that.tabId) { + Sunstone.showTab(that.tabId); + } }, elements: function(opts) { return Sunstone.getDataTable(that.tabId).elements(opts); diff --git a/src/sunstone/public/app/utils/tab-datatable.js b/src/sunstone/public/app/utils/tab-datatable.js index 20be6d9635..a11be5fa26 100644 --- a/src/sunstone/public/app/utils/tab-datatable.js +++ b/src/sunstone/public/app/utils/tab-datatable.js @@ -160,7 +160,6 @@ define(function(require) { 'tableCheckboxesListener': _tableCheckboxesListener, 'onlyOneCheckboxListener': _onlyOneCheckboxListener, 'infoListener': _infoListener, - 'deleteElement': _deleteElement, 'updateElement': _updateElement, 'elements': _elements, 'updateView': _updateView, @@ -436,19 +435,6 @@ define(function(require) { }); } - //deletes an element with id 'elementId' from a dataTable - function _deleteElement(elementId) { - var tag = '#' + this.resource.toLowerCase() + '_' + elementId; - var tr = $(tag, this.dataTable).parents('tr')[0]; - this.dataTable.fnDeleteRow(tr); - this.recountCheckboxes(); - - var tab = this.dataTable.parents(".tab"); - if (Sunstone.rightInfoVisible(tab)) { - $("a[href='back']", tab).click(); - } - } - //Add a listener to the check-all box of a datatable, enabling it to //check and uncheck all the checkboxes of its elements. function _initCheckAllBoxes() {