This is an automated email from the ASF dual-hosted git repository.
rohit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/master by this push:
new 541d280 ui: Bug fix for distinguishing between string and map type
tags in forms (#3441)
541d280 is described below
commit 541d280e3b84d7205faa4e0e3caae6d45098f3b3
Author: Anurag Awasthi <[email protected]>
AuthorDate: Fri Jun 28 17:05:25 2019 +0530
ui: Bug fix for distinguishing between string and map type tags in forms
(#3441)
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 de2709e..d014ac9 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