mirror of
https://github.com/openwrt/luci.git
synced 2026-02-04 12:06:01 +08:00
When a menu JSON describes an endpoint like
"admin/app/edit/*" : { ...
and the user navigates to
admin/app/edit/
instead of the URI which supplies an ID to edit, like
admin/app/edit/myfoobarthing
we now can use 'alias' and 'rewrite' to redirect
transparently for more generic endpoints.
Without this, it's possible to navigate to
admin/app/edit/
and the corresponding view does not receive a suitable
path/ID to derive data from, when views use anything
derived via L.env.requestpath.
This menu JSON
"admin/app/entry/*": {
"action": {
"type": "view",
"path": "app/entry"
}
},
"admin/app/entries": {
"title": "entries",
"order": 5,
"action": {
"type": "view",
"path": "app/entries"
}
},
"admin/app/entry": {
"action": {
"type": "alias",
"path": "admin/app/entries"
}
},
Produces JSON with a wildcardaction element
"entry":
{
"satisfied": true,
"wildcard": true,
"action":
{
"type": "alias",
"path": "admin/app/entries"
},
"wildcardaction":
{
"type": "view",
"path": "app/entry"
}
},
"entries":
{
"satisfied": true,
"action":
{
"type": "view",
"path": "app/entries"
},
"order": 5,
"title": "entries"
},
Signed-off-by: Paul Donald <newtwen+github@gmail.com>