]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Firefox ngx-datatable performance issue 30316/head
authorPatrick Seidensal <pseidensal@suse.com>
Fri, 13 Sep 2019 15:02:18 +0000 (17:02 +0200)
committerPatrick Seidensal <pseidensal@suse.com>
Mon, 16 Sep 2019 10:54:20 +0000 (12:54 +0200)
Fixes: https://tracker.ceph.com/issues/41667
Signed-off-by: Patrick Seidensal <pseidensal@suse.com>
src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts

index 0e5fd417a4f185dc00889cc2243903b4ae5d70a5..3d5a8101f9f89f8c7cad6358a734d1f69ecff9df 100644 (file)
@@ -92,7 +92,7 @@ describe('TableComponent', () => {
     mouseEvent.stopPropagation = () => {
       wasCalled = true;
     };
-    spyOn(window, 'addEventListener').and.callFake((eventName, fn) => {
+    spyOn(component.table.element, 'addEventListener').and.callFake((eventName, fn) => {
       fn(mouseEvent);
       expect(eventName).toBe('mouseenter');
       expect(wasCalled).toBe(true);
index 1d025c6a6ef94904dcab6658d79252a3fe6257ab..d03bee3889a7c10ec786a109d452a3e1b7d56448 100644 (file)
@@ -179,7 +179,7 @@ export class TableComponent implements AfterContentChecked, OnInit, OnChanges, O
   ngOnInit() {
     // ngx-datatable triggers calculations each time mouse enters a row,
     // this will prevent that.
-    window.addEventListener('mouseenter', (event) => event.stopPropagation(), true);
+    this.table.element.addEventListener('mouseenter', (e) => e.stopPropagation(), true);
     this._addTemplates();
     if (!this.sorts) {
       // Check whether the specified identifier exists.