Add support for correct configkey conversion from the app wizard UI - step create
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/13a0372f Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/13a0372f Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/13a0372f Branch: refs/heads/master Commit: 13a0372f534fff68cc18277e975a85bbc1c368a1 Parents: 204e87c Author: Thomas Bouron <[email protected]> Authored: Thu Oct 15 09:16:23 2015 +0100 Committer: Thomas Bouron <[email protected]> Committed: Thu Oct 15 09:16:23 2015 +0100 ---------------------------------------------------------------------- .../assets/js/view/application-add-wizard.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/13a0372f/usage/jsgui/src/main/webapp/assets/js/view/application-add-wizard.js ---------------------------------------------------------------------- diff --git a/usage/jsgui/src/main/webapp/assets/js/view/application-add-wizard.js b/usage/jsgui/src/main/webapp/assets/js/view/application-add-wizard.js index 1c72e42..850ccf0 100644 --- a/usage/jsgui/src/main/webapp/assets/js/view/application-add-wizard.js +++ b/usage/jsgui/src/main/webapp/assets/js/view/application-add-wizard.js @@ -85,6 +85,13 @@ define([ if (entity.config && _.size(entity.config)) result["brooklyn.config"] = entity.config; return result; } + function getConvertedConfigValue(value) { + try { + return $.parseJSON(value); + } catch (e) { + return value; + } + } var ModalWizard = Backbone.View.extend({ tagName:'div', @@ -510,7 +517,7 @@ define([ getConfigMap:function (root) { var map = {} $('.app-add-wizard-config-entry',root).each( function (index,elt) { - map[$('#key',elt).val()] = $('#value',elt).val() + map[$('#key',elt).val()] = getConvertedConfigValue($('#value',elt).val()) }) return map; }, @@ -777,22 +784,14 @@ define([ } }, getConfigMap:function() { - var that = this; var map = {}; $('.app-add-wizard-config-entry').each( function (index,elt) { map[$('#key',elt).val()] = $('#checkboxValue',elt).length ? $('#checkboxValue',elt).is(':checked') : - that.getConvertedConfigValue($('#value',elt).val()) + getConvertedConfigValue($('#value',elt).val()) }) return map; }, - getConvertedConfigValue:function (value) { - try { - return $.parseJSON(value); - } catch (e) { - return value; - } - }, selectionVersion:function (event) { this.model.spec.set("version", $(event.currentTarget).val()) },
