luci/applications/luci-app-commands/htdocs/luci-static/resources/view/commands.js
Jo-Philipp Wich dd1c538b2e luci-app-commands: rewrite to client side rendering
Rewrite the luci-app-command configuration to client side cbi forms and
port the server side templates and controller logic to ucode.

Also utilize a query string parameter to pass custom arguments.

Fixes: #5559
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-10-25 01:03:38 +02:00

34 lines
1,003 B
JavaScript

'use strict';
'require view';
'require form';
return view.extend({
render: function(data) {
var m, s, o;
m = new form.Map('luci', _('Custom Commands'),
_('This page allows you to configure custom shell commands which can be easily invoked from the web interface.'));
s = m.section(form.GridSection, 'command');
s.nodescriptions = true;
s.anonymous = true;
s.addremove = true;
o = s.option(form.Value, 'name', _('Description'),
_('A short textual description of the configured command'));
o = s.option(form.Value, 'command', _('Command'), _('Command line to execute'));
o.textvalue = function(section_id) {
return E('code', [ this.cfgvalue(section_id) ]);
};
o = s.option(form.Flag, 'param', _('Custom arguments'),
_('Allow the user to provide additional command line arguments'));
o = s.option(form.Flag, 'public', _('Public access'),
_('Allow executing the command and downloading its output without prior authentication'));
return m.render();
}
});