]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/dashboard: Action button is not reset after switching tabs
authorVolker Theile <vtheile@suse.com>
Wed, 24 Jun 2020 13:19:43 +0000 (15:19 +0200)
committerVolker Theile <vtheile@suse.com>
Thu, 25 Jun 2020 10:28:05 +0000 (12:28 +0200)
Fixes: https://tracker.ceph.com/issues/46145
Signed-off-by: Volker Theile <vtheile@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 bfb53a6cb2fd2cebc06c84f6d6014962641f8319..e27be89ed31ddb9e862db69c429a45c54098371d 100644 (file)
@@ -11,6 +11,7 @@ import { configureTestBed } from '../../../../testing/unit-test-helper';
 import { ComponentsModule } from '../../components/components.module';
 import { CdTableColumnFilter } from '../../models/cd-table-column-filter';
 import { CdTableFetchDataContext } from '../../models/cd-table-fetch-data-context';
+import { CdTableSelection } from '../../models/cd-table-selection';
 import { PipesModule } from '../../pipes/pipes.module';
 import { TableComponent } from './table.component';
 
@@ -106,6 +107,16 @@ describe('TableComponent', () => {
     component.ngOnInit();
   });
 
+  it('should call updateSelection on init', () => {
+    component.updateSelection.subscribe((selection: CdTableSelection) => {
+      expect(selection.hasSelection).toBeFalsy();
+      expect(selection.hasSingleSelection).toBeFalsy();
+      expect(selection.hasMultiSelection).toBeFalsy();
+      expect(selection.selected.length).toBe(0);
+    });
+    component.ngOnInit();
+  });
+
   describe('test column filtering', () => {
     let filterIndex: CdTableColumnFilter;
     let filterOdd: CdTableColumnFilter;
index 6c4d171e23b32833d0a0a3d2a7e49b7ebd7825f1..c177cc994fcad61e8e312a5ac2e4aae82a4f0162 100644 (file)
@@ -282,6 +282,8 @@ export class TableComponent implements AfterContentChecked, OnInit, OnChanges, O
     this.filterHiddenColumns();
     this.initColumnFilters();
     this.updateColumnFilterOptions();
+    // Notify all subscribers to reset their current selection.
+    this.updateSelection.emit(new CdTableSelection());
     // Load the data table content every N ms or at least once.
     // Force showing the loading indicator if there are subscribers to the fetchData
     // event. This is necessary because it has been set to False in useData() when