From bc86e349e77ed47e709a573051d2c4446e6f52e7 Mon Sep 17 00:00:00 2001 From: Anurag Awasthi Date: Fri, 28 Jun 2019 15:40:20 +0530 Subject: [PATCH 1/2] Bug fix for distinting between string and map type tags in forms Some APIs consume 'tags' param as string and some consume as maps. Since each API can have at most one 'tags' param the extraction of map based tags should only happen when strings based tags are not extracted from the form serialization. --- ui/scripts/ui/dialog.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ui/scripts/ui/dialog.js b/ui/scripts/ui/dialog.js index de2709ef57f0..244cccf0b408 100644 --- a/ui/scripts/ui/dialog.js +++ b/ui/scripts/ui/dialog.js @@ -778,7 +778,14 @@ var complete = function($formContainer) { var $form = $formContainer.find('form'); - var data = $.extend(cloudStack.serializeForm($form), {'tags' : cloudStack.getTagsFromForm($form)}); + var data = cloudStack.serializeForm($form)); + if (!data.tags) { + // Some APIs consume tags as a string (such as disk offering creation). + // The UI of those use a tagger that is not a custom cloudStack.tagger + // but rather a string. That case is handled by usual serialization. We + // only need to check extract tags when the string tags are not present. + $.extend(data, {'tags' : cloudStack.getTagsFromForm($form)}); + } if (!$formContainer.find('form').valid()) { // Ignore hidden field validation From 1b713d467f4a0eb0fbfe59ee35d36b10dd6f15ec Mon Sep 17 00:00:00 2001 From: Anurag Awasthi Date: Fri, 28 Jun 2019 15:55:43 +0530 Subject: [PATCH 2/2] Fix typo --- ui/scripts/ui/dialog.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/scripts/ui/dialog.js b/ui/scripts/ui/dialog.js index 244cccf0b408..d014ac999652 100644 --- a/ui/scripts/ui/dialog.js +++ b/ui/scripts/ui/dialog.js @@ -778,7 +778,7 @@ var complete = function($formContainer) { var $form = $formContainer.find('form'); - var data = cloudStack.serializeForm($form)); + var data = cloudStack.serializeForm($form); if (!data.tags) { // Some APIs consume tags as a string (such as disk offering creation). // The UI of those use a tagger that is not a custom cloudStack.tagger