]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Revert "mgr/dashboard: unselect rows in datatables" 48163/head
authorNizamudeen A <nia@redhat.com>
Thu, 6 Oct 2022 09:49:09 +0000 (15:19 +0530)
committerNizamudeen A <nia@redhat.com>
Mon, 10 Oct 2022 08:39:29 +0000 (14:09 +0530)
This reverts commit b79e2a6c6a9368a4fc167b05970db463cd60edab.

Signed-off-by: Nizamudeen A <nia@redhat.com>
src/pybind/mgr/dashboard/frontend/cypress/integration/block/mirroring.po.ts
src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/hosts.po.ts
src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/services.po.ts
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 456223a873ec138243a38fd6dc8e7d4f81872aaf..c4adca8b72fe91cc847f9ac4d46e43637009ba2b 100644 (file)
@@ -18,7 +18,7 @@ export class MirroringPageHelper extends PageHelper {
    */
   @PageHelper.restrictTo(pages.index.url)
   editMirror(name: string, option: string) {
-    // Select the pool in the table
+    // Clicks the pool in the table
     this.getFirstTableCell(name).click();
 
     // Clicks the Edit Mode button
@@ -33,9 +33,6 @@ export class MirroringPageHelper extends PageHelper {
     cy.contains('.modal-dialog', 'Edit pool mirror mode').should('not.exist');
     const val = option.toLowerCase(); // used since entries in table are lower case
     this.getFirstTableCell(val).should('be.visible');
-
-    // unselect the pool in the table
-    this.getFirstTableCell(name).click();
   }
 
   @PageHelper.restrictTo(pages.index.url)
index 848f99501ac9f0b1ed4ef3ddfa7f0c85034406a1..9511142ed43d9c9d829222995e7ad087271f10ad 100644 (file)
@@ -106,8 +106,8 @@ export class HostsPageHelper extends PageHelper {
   @PageHelper.restrictTo(pages.index.url)
   maintenance(hostname: string, exit = false, force = false) {
     this.clearTableSearchInput();
-    this.getTableCell(this.columnIndex.hostname, hostname).click();
     if (force) {
+      this.getTableCell(this.columnIndex.hostname, hostname).click();
       this.clickActionButton('enter-maintenance');
 
       cy.get('cd-modal').within(() => {
@@ -124,6 +124,7 @@ export class HostsPageHelper extends PageHelper {
     }
     if (exit) {
       this.getTableCell(this.columnIndex.hostname, hostname)
+        .click()
         .parent()
         .find(`datatable-body-cell:nth-child(${this.columnIndex.status})`)
         .then(($ele) => {
@@ -141,6 +142,7 @@ export class HostsPageHelper extends PageHelper {
           expect(status).to.not.include('maintenance');
         });
     } else {
+      this.getTableCell(this.columnIndex.hostname, hostname).click();
       this.clickActionButton('enter-maintenance');
 
       this.getTableCell(this.columnIndex.hostname, hostname)
index f2c123f874df6290222abf32410bbaa1d1cbfdd7..c464a3f6cf817d00390aafd96e4666632a97850f 100644 (file)
@@ -195,10 +195,6 @@ export class ServicesPageHelper extends PageHelper {
     cy.get('cd-service-daemon-list').within(() => {
       this.getTableRow(daemon).click();
       this.clickActionButton(action);
-
-      // unselect it to avoid colliding with any other selection
-      // in different steps
-      this.getTableRow(daemon).click();
     });
   }
 }
index f8178be26d8a8e0053a37ad0d9704cb03c5f285c..53c246d6e0bc66a42843d6cfabda3da323ad3f6a 100644 (file)
@@ -569,33 +569,15 @@ describe('TableComponent', () => {
       expect(executingElement.nativeElement.textContent.trim()).toBe(`(${state})`);
     };
 
-    it('should display executing template', () => {
+    it.only('should display executing template', () => {
       testExecutingTemplate();
     });
 
-    it('should display executing template with custom classes', () => {
+    it.only('should display executing template with custom classes', () => {
       testExecutingTemplate({ valueClass: 'a b', executingClass: 'c d' });
     });
   });
 
-  describe('test unselect functionality of rows', () => {
-    beforeEach(() => {
-      component.autoReload = -1;
-      component.selectionType = 'single';
-      fixture.detectChanges();
-    });
-
-    it('should unselect row on clicking on it again', () => {
-      const rowCellDebugElement = fixture.debugElement.query(By.css('datatable-body-cell'));
-
-      rowCellDebugElement.triggerEventHandler('click', null);
-      expect(component.selection.selected.length).toEqual(1);
-
-      rowCellDebugElement.triggerEventHandler('click', null);
-      expect(component.selection.selected.length).toEqual(0);
-    });
-  });
-
   describe('reload data', () => {
     beforeEach(() => {
       component.ngOnInit();
index c83cda24e8e1ef4c2d1c4806675e09ad4efcda48..c6c9369acfc637dd0c3bdb7235704ec220602acf 100644 (file)
@@ -333,10 +333,6 @@ export class TableComponent implements AfterContentChecked, OnInit, OnChanges, O
     } else {
       this.useData();
     }
-
-    if (this.selectionType === 'single') {
-      this.table.selectCheck = this.singleSelectCheck.bind(this);
-    }
   }
 
   initUserConfig() {
@@ -772,10 +768,6 @@ export class TableComponent implements AfterContentChecked, OnInit, OnChanges, O
     this.updateSelection.emit(_.clone(this.selection));
   }
 
-  private singleSelectCheck(row: any) {
-    return this.selection.selected.indexOf(row) === -1;
-  }
-
   toggleColumn(column: CdTableColumn) {
     const prop: TableColumnProp = column.prop;
     const hide = !column.isHidden;