Ver código fonte

HUE-5229 [filebrowser] Improve select all performance

Enrico Berti 9 anos atrás
pai
commit
d8df800

+ 11 - 8
apps/filebrowser/src/filebrowser/templates/listdir_components.mako

@@ -883,11 +883,15 @@ from django.utils.translation import ugettext as _
         if (val > 0) {
           if ($('#uploadFileModal').data('modal')) {
             $('#uploadFileModal').data('modal').$element.off('keyup.dismiss.modal');
-            $('#uploadFileModal').data('modal').$backdrop.off('click');
+            if ($('#uploadFileModal').data('modal').$backdrop){
+              $('#uploadFileModal').data('modal').$backdrop.off('click');
+            }
           }
           if ($('#uploadArchiveModal').data('modal')) {
             $('#uploadArchiveModal').data('modal').$element.off('keyup.dismiss.modal');
-            $('#uploadArchiveModal').data('modal').$backdrop.off('click');
+            if ($('#uploadArchiveModal').data('modal').$backdrop) {
+              $('#uploadArchiveModal').data('modal').$backdrop.off('click');
+            }
           }
         }
       });
@@ -962,23 +966,23 @@ from django.utils.translation import ugettext as _
         return ko.utils.arrayFilter(self.files(), function (file) {
           return file.selected();
         });
-      }, self);
+      }, self).extend({ rateLimit: { timeout: 500, method: "notifyWhenChangesStop" } });
 
       self.selectedSentryFiles = ko.computed(function () {
         return ko.utils.arrayFilter(self.files(), function (file) {
           return file.selected() && file.isSentryManaged;
         });
-      }, self);
+      }, self).extend({ rateLimit: { timeout: 500, method: "notifyWhenChangesStop" } });
 
       self.isCurrentDirSelected = ko.computed(function () {
         return ko.utils.arrayFilter(self.files(), function (file) {
           return file.name == "." && file.selected();
         });
-      }, self);
+      }, self).extend({ rateLimit: { timeout: 500, method: "notifyWhenChangesStop" } });
 
       self.selectedFile = ko.computed(function () {
         return self.selectedFiles()[0];
-      }, self);
+      }, self).extend({ rateLimit: { timeout: 500, method: "notifyWhenChangesStop" } });
 
       self.currentPath = ko.observable(currentDirPath);
       self.currentPath.subscribe(function (path) {
@@ -1143,8 +1147,7 @@ from django.utils.translation import ugettext as _
       };
 
       self.selectAll = function () {
-        self.allSelected(! self.allSelected());
-
+        self.allSelected(!self.allSelected());
         ko.utils.arrayForEach(self.files(), function (file) {
           if (file.name != "." && file.name != "..") {
             file.selected(self.allSelected());