From: Jo-Philipp Wich Date: Fri, 3 Jul 2020 12:30:30 +0000 (+0200) Subject: luci-base: ui.js: order menu entries with the same weight by name X-Git-Url: http://git.openwrt.org/?a=commitdiff_plain;h=0c479891ae31bbe308c4d6e181c118ec3d65c05f;p=project%2Fluci.git luci-base: ui.js: order menu entries with the same weight by name The previous server side menu rendering ordered items first by their order weight value, then by their internal name. Do the same for client side menu rendering. Signed-off-by: Jo-Philipp Wich --- diff --git a/modules/luci-base/htdocs/luci-static/resources/ui.js b/modules/luci-base/htdocs/luci-static/resources/ui.js index a6598355d6..91a93b9e90 100644 --- a/modules/luci-base/htdocs/luci-static/resources/ui.js +++ b/modules/luci-base/htdocs/luci-static/resources/ui.js @@ -3053,7 +3053,13 @@ var UIMenu = baseclass.singleton(/** @lends LuCI.ui.menu.prototype */ { } return children.sort(function(a, b) { - return ((a.order || 1000) - (b.order || 1000)); + var wA = a.order || 1000, + wB = b.order || 1000; + + if (wA != wB) + return wA - wB; + + return a.name > b.name; }); } });