luci-base: ui.js: order menu entries with the same weight by name
authorJo-Philipp Wich <jo@mein.io>
Fri, 3 Jul 2020 12:30:30 +0000 (14:30 +0200)
committerJo-Philipp Wich <jo@mein.io>
Sat, 4 Jul 2020 22:53:09 +0000 (00:53 +0200)
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 <jo@mein.io>
(cherry picked from commit 0c479891ae31bbe308c4d6e181c118ec3d65c05f)

modules/luci-base/htdocs/luci-static/resources/ui.js

index 8f81576344b08a99d771a3967d75819d32fdbeb8..5d6b2e43f71b59bb868d516c65ff55fa40d39d45 100644 (file)
@@ -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;
                });
        }
 });