grkvlt commented on code in PR #325:
URL: https://github.com/apache/brooklyn-ui/pull/325#discussion_r875633721


##########
ui-modules/utils/utils/general.js:
##########
@@ -54,10 +54,23 @@ export function isNonEmpty(object) {
     return true; 
 }
 
+export function uiModuleComparator(moduleA, moduleB) {
+    if(moduleA.order && moduleB.order){
+        if (moduleA.order > moduleB.order) {

Review Comment:
   another simplification maybe `if (moduleA.order != moduleB.order) return 
moduleA.order - moduleB.order`



##########
ui-modules/utils/utils/general.js:
##########
@@ -54,10 +54,23 @@ export function isNonEmpty(object) {
     return true; 
 }
 
+export function uiModuleComparator(moduleA, moduleB) {
+    if(moduleA.order && moduleB.order){
+        if (moduleA.order > moduleB.order) {
+            return 1;
+        }
+        if(moduleA.order < moduleB.order) {
+            return -1;
+        }
+    }
+    // If no order implemented or is the same, order by name
+    return moduleA.name > moduleB.name ? 1: -1;

Review Comment:
   is something like `moduleA.name.localeCompare(moduleB.name)` better?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to