From 42e94cc79fa6729cdeb3e80e9de0c86474c961cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Fri, 29 Apr 2016 16:09:50 +0200 Subject: [PATCH] Feature #3182: Disable create button if no template is selected in VM creation --- src/sunstone/public/app/sunstone.js | 8 +++++--- .../app/tabs/templates-tab/form-panels/instantiate.js | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/sunstone/public/app/sunstone.js b/src/sunstone/public/app/sunstone.js index 00d3884683..4f1fffce47 100644 --- a/src/sunstone/public/app/sunstone.js +++ b/src/sunstone/public/app/sunstone.js @@ -427,7 +427,7 @@ define(function(require) { return false; }) - $('#' + customId + 'submit_button', actionBlock).on("click", function() { + $('.submit_button', actionBlock).on("click", function() { _submitFormPanel(tabName); return false; }) @@ -828,7 +828,6 @@ define(function(require) { function _showFormPanel(tabId, formPanelId, action, onShow2) { var context = $("#" + tabId); _popFormPanelLoading(tabId); - _enableFormPanelSubmit(tabId); _showFormPanelSubmit(tabId); setTimeout(function() { @@ -897,6 +896,8 @@ define(function(require) { $(".sunstone-form-title", context).text(Locale.tr("Submitting...")); $(".submit_button", context).text(Locale.tr("Submitting...")); + _disableFormPanelSubmit(tabId); + setTimeout(function() { var formPanelInstance = SunstoneCfg["tabs"][tabId].activeFormPanel @@ -910,7 +911,6 @@ define(function(require) { var _resetFormPanel = function(tabId, formPanelId) { _popFormPanelLoading(tabId); - _enableFormPanelSubmit(tabId); setTimeout(function() { var formPanelInstance; @@ -965,6 +965,7 @@ define(function(require) { $("div[form-panel-id="+formPanelInstance.formPanelId+"]", context).fadeIn(); } + _enableFormPanelSubmit(tabId); } function _hideFormPanel(tabId) { @@ -984,6 +985,7 @@ define(function(require) { $(".sunstone-form-title", context).text(Locale.tr("Loading...")); $(".submit_button", context).text(Locale.tr("Loading...")); + _disableFormPanelSubmit(tabId); $(".tabs-contentForm", context).hide(); $(".loadingForm", context).show(); diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate.js b/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate.js index d8225e28c2..2c2a398d8c 100644 --- a/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate.js +++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate.js @@ -252,7 +252,7 @@ define(function(require) { idsDone += 1; if (idsLength == idsDone){ - Sunstone.enableFormPanelSubmit(TAB_ID); + Sunstone.enableFormPanelSubmit(that.tabId); } }, error: function(request, error_json, container) { @@ -264,7 +264,7 @@ define(function(require) { } function _onShow(context) { - Sunstone.disableFormPanelSubmit(TAB_ID); + Sunstone.disableFormPanelSubmit(this.tabId); $("input.instantiate_pers", context).change();