From ddb59419ba34e96353973eae55fe6df642856413 Mon Sep 17 00:00:00 2001 From: Volker Theile Date: Wed, 12 Aug 2020 16:25:05 +0200 Subject: [PATCH] mgr/dashboard: Datatable catches select events from other datatables Ensure we do not process DOM 'select' events, see https://github.com/swimlane/ngx-datatable/issues/899. Fixes: https://tracker.ceph.com/issues/46903 Signed-off-by: Volker Theile (cherry picked from commit 31e9bbb9b308277d2f89390d5ff62f13457d69cb) Conflicts: src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts conflict caused by new methods that don't exist in nautilus, fixed by removing them from being cherry-picked. --- .../src/app/shared/datatable/table/table.component.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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 548d4749590de..d85593c937c0a 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 @@ -454,9 +454,13 @@ export class TableComponent implements AfterContentChecked, OnInit, OnChanges, O this.onSelect(); } - onSelect() { - this.selection.update(); - this.updateSelection.emit(_.clone(this.selection)); + onSelect($event: any) { + // Ensure we do not process DOM 'select' events. + // https://github.com/swimlane/ngx-datatable/issues/899 + if (_.has($event, 'selected')) { + this.selection.selected = $event['selected']; + this.updateSelection.emit(_.clone(this.selection)); + } } toggleColumn($event: any) { -- 2.39.5