]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Fix for datatable item not showing details after getting selected 38813/head
authorNizamudeen A <nia@redhat.com>
Fri, 8 Jan 2021 07:37:27 +0000 (13:07 +0530)
committerNizamudeen A <nia@redhat.com>
Tue, 12 Jan 2021 07:52:53 +0000 (13:22 +0530)
**Regression in nautilus**

Datatable items are not showing the details even if an item in the list is selected. This is happening because of this backport (https://github.com/ceph/ceph/pull/37756/files) which backports the line this.selection.selected = $event['selected']; but this feature was not implemented in the nautilus branch originally.

Fixes: https://tracker.ceph.com/issues/48796
Signed-off-by: Nizamudeen A <nia@redhat.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 40f85b7d61ecd894060542cb750eda0c8ae80391..682a9386fc693c63fb148b7ff3f365f2fd80a3c0 100644 (file)
@@ -295,6 +295,21 @@ describe('TableComponent', () => {
     });
   });
 
+  describe('select row', () => {
+    beforeEach(() => {
+      component.ngOnInit();
+      component.data = [];
+    });
+
+    it('should select the row item', () => {
+      spyOn(component, 'onSelect').and.callThrough();
+      component.data = createFakeData(3);
+      component.selection.selected = [_.clone(component.data[1])];
+      component.onSelect(new Event('click'));
+      expect(component.selection.hasSelection).toBeTruthy();
+    });
+  });
+
   describe('reload data', () => {
     beforeEach(() => {
       component.ngOnInit();
index 57fa7aad76801503ce79dd5f83b3eecf4a489bd6..b3e5eb41a56a74bb910cda02e5cc8edf9e4c9a7d 100644 (file)
@@ -460,6 +460,7 @@ export class TableComponent implements AfterContentChecked, OnInit, OnChanges, O
     if (_.has($event, 'selected')) {
       this.selection.selected = $event['selected'];
     }
+    this.selection.update();
     this.updateSelection.emit(_.clone(this.selection));
   }