summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-commands/htdocs/luci-static/resources/view
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2022-10-25 00:55:14 +0200
committerJo-Philipp Wich <jo@mein.io>2022-10-25 01:03:38 +0200
commitdd1c538b2ed4e025be6a4006e0e8e2a2bf37ad18 (patch)
tree6cabbe7b5abc3e683709d8961e4070808bf3b145 /applications/luci-app-commands/htdocs/luci-static/resources/view
parent036424df5b76111f32d4dce0253bfb8260d8a41f (diff)
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>
Diffstat (limited to 'applications/luci-app-commands/htdocs/luci-static/resources/view')
-rw-r--r--applications/luci-app-commands/htdocs/luci-static/resources/view/commands.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/applications/luci-app-commands/htdocs/luci-static/resources/view/commands.js b/applications/luci-app-commands/htdocs/luci-static/resources/view/commands.js
new file mode 100644
index 0000000000..6d369733c6
--- /dev/null
+++ b/applications/luci-app-commands/htdocs/luci-static/resources/view/commands.js
@@ -0,0 +1,34 @@
+'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();
+ }
+});