[Kimchi-devel] [PATCH] Improve code performance on UI

Ramon Medeiros ramonn at linux.vnet.ibm.com
Wed Jul 29 15:13:01 UTC 2015


Instead of sorting user each interaction, wait UI to create all nodes
and then, sort items.

Signed-off-by: Ramon Medeiros <ramonn at linux.vnet.ibm.com>
---
 ui/js/src/kimchi.guest_edit_main.js | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/ui/js/src/kimchi.guest_edit_main.js b/ui/js/src/kimchi.guest_edit_main.js
index 7671e43..f71ba3b 100644
--- a/ui/js/src/kimchi.guest_edit_main.js
+++ b/ui/js/src/kimchi.guest_edit_main.js
@@ -375,23 +375,23 @@ kimchi.guest_edit_main = function() {
             for(var i=0; i<availUsers.length; i++){
                 initNode(availUsers[i], true);
                 $("#permission-avail-users").append(userNodes[availUsers[i]]);
-                sortNodes($("#permission-avail-users"), true);
             }
+            sortNodes($("#permission-avail-users"), true);
             for(var i=0; i<selUsers.length; i++){
                 initNode(selUsers[i], true);
                 $("#permission-sel-users").append(userNodes[selUsers[i]]);
-                sortNodes($("#permission-sel-users"), true);
             }
+            sortNodes($("#permission-sel-users"), true);
             for(var i=0; i<availGroups.length; i++){
                 initNode(availGroups[i], false);
                 $("#permission-avail-groups").append(groupNodes[availGroups[i]]);
-                sortNodes($("#permission-avail-groups"), false);
             }
+            sortNodes($("#permission-avail-groups"), false);
             for(var i=0; i<selGroups.length; i++){
                 initNode(selGroups[i], false);
                 $("#permission-sel-groups").append(groupNodes[selGroups[i]]);
-                sortNodes($("#permission-sel-groups"), false);
             }
+            sortNodes($("#permission-sel-groups"), false);
         };
         var filterNodes = function(key, container){
             container.children().each(function(){
-- 
2.1.0




More information about the Kimchi-devel mailing list