From d639d7ec93ec8cbd6bbef3d8705579a57c302f76 Mon Sep 17 00:00:00 2001 From: Patrick Seidensal Date: Fri, 13 Sep 2019 17:02:18 +0200 Subject: [PATCH] mgr/dashboard: Firefox ngx-datatable performance issue Fixes: https://tracker.ceph.com/issues/41667 Signed-off-by: Patrick Seidensal --- .../src/app/shared/datatable/table/table.component.spec.ts | 2 +- .../frontend/src/app/shared/datatable/table/table.component.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.spec.ts index 0e5fd417a4f..3d5a8101f9f 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.spec.ts @@ -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); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts index 1d025c6a6ef..d03bee3889a 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts @@ -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. -- 2.39.5