]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Datatable catches select events from other datatables
authorVolker Theile <vtheile@suse.com>
Wed, 12 Aug 2020 14:25:05 +0000 (16:25 +0200)
committerLaura Paduano <lpaduano@suse.com>
Mon, 31 Aug 2020 08:43:01 +0000 (10:43 +0200)
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 <vtheile@suse.com>
(cherry picked from commit 31e9bbb9b308277d2f89390d5ff62f13457d69cb)

src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts

index 9efb7c91915951901b31d1c887291347cd1c19c2..c2fe650da769592aa411152c96c019de68ce4703 100644 (file)
@@ -681,8 +681,12 @@ export class TableComponent implements AfterContentChecked, OnInit, OnChanges, O
   }
 
   onSelect($event: any) {
-    this.selection.selected = $event['selected'];
-    this.updateSelection.emit(_.clone(this.selection));
+    // 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) {