From 5bc0eb5d4725edc6f7c8fdf4e82e3c4356beda42 Mon Sep 17 00:00:00 2001 From: Sergio Betanzos Date: Tue, 10 Nov 2020 13:21:10 +0100 Subject: [PATCH] M #~: Fix error pop in vnet instantiate form (#405) (cherry picked from commit 821ecfaf4bd7ce35be7d16b3f1197f6b6b879cb9) --- .../tabs/vnets-tab/form-panels/instantiate.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/sunstone/public/app/tabs/vnets-tab/form-panels/instantiate.js b/src/sunstone/public/app/tabs/vnets-tab/form-panels/instantiate.js index 224034aa4b..6472e09457 100644 --- a/src/sunstone/public/app/tabs/vnets-tab/form-panels/instantiate.js +++ b/src/sunstone/public/app/tabs/vnets-tab/form-panels/instantiate.js @@ -70,14 +70,18 @@ define(function(require) { this.templatesTable.initialize(); this.templatesTable.idInput().on("change", function(){ - $(".nameContainer", context).show(); + var template_id = $(this).val(); + var showRestForm = template_id !== ""; - var templatesContext = $(".list_of_vntemplates", context); - templatesContext.html(""); - templatesContext.show(); + $(".nameContainer", context).toggle(showRestForm); - var template_id = $(this).val(); + var templatesContext = $(".list_of_vntemplates", context); + templatesContext.html(""); + templatesContext.toggle(showRestForm); + + if (showRestForm) { that.setTemplateIds(context, [template_id]); + } }); Tips.setup(context); @@ -86,5 +90,7 @@ define(function(require) { function _onShow(context) { this.templatesTable.resetResourceTableSelect(); InstantiateTemplateFormPanel.prototype.onShow.call(this, context); + + $(".nameContainer", context).hide(); } });