From 01058512352f49546e38765c01cf317898ef771d Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Fri, 3 Jul 2020 14:30:30 +0200 Subject: [PATCH] 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 (cherry picked from commit 0c479891ae31bbe308c4d6e181c118ec3d65c05f) --- modules/luci-base/htdocs/luci-static/resources/ui.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/luci-base/htdocs/luci-static/resources/ui.js b/modules/luci-base/htdocs/luci-static/resources/ui.js index 8f81576344..5d6b2e43f7 100644 --- a/modules/luci-base/htdocs/luci-static/resources/ui.js +++ b/modules/luci-base/htdocs/luci-static/resources/ui.js @@ -3056,7 +3056,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; }); } }); -- 2.30.2