From ce04c596a961ffbfb55bceea60410197e8adc314 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Fri, 7 Oct 2016 11:24:51 +0200 Subject: [PATCH] B #4852: Fix VR create dialog reset --- src/sunstone/public/app/sunstone.js | 15 ++++++++++++++- .../form-panels/instantiate.js | 8 ++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/sunstone/public/app/sunstone.js b/src/sunstone/public/app/sunstone.js index 18367602ff..5ef6fa39a6 100644 --- a/src/sunstone/public/app/sunstone.js +++ b/src/sunstone/public/app/sunstone.js @@ -967,12 +967,25 @@ define(function(require) { }, 13) } + /** + * Resets the form panel. The loading screen is shown, then the panel is reset + * and shown + * + * @param {String} tabId TAB_ID. Optional, if it is not provided the current + * tab will be used + * @param {String} formPanelId TAB_ID. Optional, if it is not provided the + * visible form panel will be used + */ var _resetFormPanel = function(tabId, formPanelId) { + if (tabId == undefined){ + tabId = _getTab() + } + _popFormPanelLoading(tabId); setTimeout(function() { var formPanelInstance; - if (formPanelId) { + if (formPanelId != undefined) { formPanelInstance = SunstoneCfg["tabs"][tabId]['formPanelInstances'][formPanelId]; } else { formPanelInstance = SunstoneCfg["tabs"][tabId].activeFormPanel; diff --git a/src/sunstone/public/app/tabs/vrouter-templates-tab/form-panels/instantiate.js b/src/sunstone/public/app/tabs/vrouter-templates-tab/form-panels/instantiate.js index 53e6194bcf..7e06241c30 100644 --- a/src/sunstone/public/app/tabs/vrouter-templates-tab/form-panels/instantiate.js +++ b/src/sunstone/public/app/tabs/vrouter-templates-tab/form-panels/instantiate.js @@ -152,11 +152,11 @@ define(function(require) { success: function(request, response){ OpenNebulaAction.clear_cache("VM"); - Sunstone.resetFormPanel(TAB_ID, that.formPanelId); - Sunstone.hideFormPanel(TAB_ID); + Sunstone.resetFormPanel(); + Sunstone.hideFormPanel(); }, error: function(request, response) { - Sunstone.hideFormPanelLoading(TAB_ID); + Sunstone.hideFormPanelLoading(); Notifier.notifyError(Locale.tr( "Failed to create VMs. Virtual Router may need to be deleted manually.")); @@ -165,7 +165,7 @@ define(function(require) { }); }, error: function(request, response) { - Sunstone.hideFormPanelLoading(TAB_ID); + Sunstone.hideFormPanelLoading(); Notifier.onError(request, response); }, });