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 <jo@mein.io>
This commit is contained in:
Jo-Philipp Wich 2020-07-03 14:30:30 +02:00
parent dcea4e84f4
commit 0c479891ae

View file

@ -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;
});
}
});