Display ConfigKeys of enum types as drop-down list In the Add Application wizard, required config keys that are enumerated types will appear as drop-down lists.
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/commit/e1351b9a Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/tree/e1351b9a Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/diff/e1351b9a Branch: refs/heads/0.6.0 Commit: e1351b9a3987b95abce54b6e0b726ed5abc9611e Parents: 33ae7c8 Author: Richard Downer <[email protected]> Authored: Thu Oct 10 16:29:43 2013 +0100 Committer: Richard Downer <[email protected]> Committed: Thu Oct 10 18:33:34 2013 +0100 ---------------------------------------------------------------------- .../assets/tpl/app-add-wizard/required-config-entry.html | 9 +++++++++ 1 file changed, 9 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/e1351b9a/usage/jsgui/src/main/webapp/assets/tpl/app-add-wizard/required-config-entry.html ---------------------------------------------------------------------- diff --git a/usage/jsgui/src/main/webapp/assets/tpl/app-add-wizard/required-config-entry.html b/usage/jsgui/src/main/webapp/assets/tpl/app-add-wizard/required-config-entry.html index f2b0bd4..d892af4 100644 --- a/usage/jsgui/src/main/webapp/assets/tpl/app-add-wizard/required-config-entry.html +++ b/usage/jsgui/src/main/webapp/assets/tpl/app-add-wizard/required-config-entry.html @@ -8,6 +8,15 @@ <input id="checkboxValue" type="checkbox" class="input-medium" name="checkboxValue<% if (data.defaultValue===true) { %>" checked="true<% } %>"> + <% } else if (data.type==="java.lang.Enum") { %> + <select id="value" class="input-medium" name="value" style="width: 250px"> + <% var length = data.possibleValues.length, + element = null; + for (var i = 0; i < length; i++) { + element = data.possibleValues[i]; %> + <option value="<%= element.value %>"<% if (data.defaultValue == element.value) { %> selected="selected"<% } %>><%= element.description %></option> + <% } %> + </select> <% } else { %> <input id="value" type="text" class="input-medium" name="value" value="<% if (typeof data.defaultValue !== "undefined") { %><%= data.defaultValue %><% }
