Done FELIX-4016 Provide more meta data to the UPnP action arguments
https://issues.apache.org/jira/browse/FELIX-4016
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1464973 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/webconsole-plugins/upnp/src/main/resources/res/upnp.css b/webconsole-plugins/upnp/src/main/resources/res/upnp.css
index 2e5d5ce..3fd79a5 100644
--- a/webconsole-plugins/upnp/src/main/resources/res/upnp.css
+++ b/webconsole-plugins/upnp/src/main/resources/res/upnp.css
@@ -37,3 +37,6 @@
margin: 0;
padding: 0;
}
+div.info {
+ font-size: 75%;
+}
diff --git a/webconsole-plugins/upnp/src/main/resources/res/upnp.html b/webconsole-plugins/upnp/src/main/resources/res/upnp.html
index 9e66769..01558a8 100644
--- a/webconsole-plugins/upnp/src/main/resources/res/upnp.html
+++ b/webconsole-plugins/upnp/src/main/resources/res/upnp.html
@@ -93,7 +93,7 @@
<h3>${actions.title}</h3>
<div class="ui-widget-header ui-corner-top buttonGroup">
${actions.select}
- <select name="c">
+ <select name="c" class="ui-state-default">
<option value="---">---</option>
</select>
<button title="${actions.invoke.title}"><span class="ui-icon ui-icon-play"> </span></button>
diff --git a/webconsole-plugins/upnp/src/main/resources/res/upnp.js b/webconsole-plugins/upnp/src/main/resources/res/upnp.js
index a4e294f..2acfc45 100644
--- a/webconsole-plugins/upnp/src/main/resources/res/upnp.js
+++ b/webconsole-plugins/upnp/src/main/resources/res/upnp.js
@@ -219,8 +219,24 @@
var _tr = actionsTableRow.clone().appendTo(actionsTableBody);
_tr.find('td:eq(0)').text(_arg.name);
_tr.find('td:eq(1)').text(_arg.type);
- var _el = _tr.find('input').attr('id', 'arg'+i);
- _arg['element'] = _el;
+ var _el = false;
+ if (_arg.allowed) {
+ var selectData = '<select class="ui-state-default">';
+ for(var s in _arg.allowed) selectData += '<option>' + _arg.allowed[s] + '</option>';
+ _el = $(selectData + '</select>').appendTo( _tr.find('td:eq(2)').empty() );
+ } else {
+ _el = _tr.find('input');
+ }
+ _arg['element'] = _el.attr('id', 'arg'+i);
+ var infoData = false;
+ if (_arg.min || _arg.max || _arg.step) {
+ infoData = '<div class="info">';
+ if (_arg.min || _arg.max) infoData += '[' + _arg.min + ', ' + _arg.max + ']';
+ if (_arg.step) infoData += '/' + _arg.step;
+ infoData += '</div>';
+ }
+ if (infoData) _el.after(infoData);
+ if (_arg['default']) _el.val(_arg['default']);
}
actionsTable.removeClass('ui-helper-hidden');
} else {