luci-base: dispatcher.uc: support `cbi` and `form` action types
authorJo-Philipp Wich <jo@mein.io>
Mon, 19 Sep 2022 12:19:24 +0000 (14:19 +0200)
committerJo-Philipp Wich <jo@mein.io>
Mon, 24 Oct 2022 23:03:37 +0000 (01:03 +0200)
Some existing LuCI apps ship menu.d JSON files with `cbi` and `form` typed
dispatch targets, support those as well.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-base/ucode/dispatcher.uc

index 84eff71d3ad773c527dc071ed33741a5d1a312ec..7ff8d49c125e3a8826f119b7e5f0aae827c7abd1 100644 (file)
@@ -776,6 +776,24 @@ function run_action(request_path, lang, tree, resolved, action) {
                }));
                break;
 
+       case 'cbi':
+               http.write(render(() => {
+                       runtime.call('luci.dispatcher', 'invoke_cbi_action',
+                               action.path, null,
+                               ...resolved.ctx.request_args
+                       );
+               }));
+               break;
+
+       case 'form':
+               http.write(render(() => {
+                       runtime.call('luci.dispatcher', 'invoke_form_action',
+                               action.path,
+                               ...resolved.ctx.request_args
+                       );
+               }));
+               break;
+
        case 'alias':
                dispatch(http, [ ...split(action.path, '/'), ...resolved.ctx.request_args ]);
                break;