]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Revert "mgr/dashboard: unselect rows in datatables" 48432/head
authorNizamudeen A <nia@redhat.com>
Thu, 6 Oct 2022 09:49:09 +0000 (15:19 +0530)
committerNizamudeen A <nia@redhat.com>
Tue, 11 Oct 2022 05:24:48 +0000 (10:54 +0530)
This reverts commit b79e2a6c6a9368a4fc167b05970db463cd60edab.

Signed-off-by: Nizamudeen A <nia@redhat.com>
(cherry picked from commit 82d2ac1abacd19405fdfbf9a8626570231559dba)

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 e24a3ebc037abbc8b1b2fd619fe89e57e86d3f54..8450763d301a50f320a183ddbf5036c6d7bc1d71 100644 (file)
@@ -13,7 +13,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
@@ -28,8 +28,5 @@ 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();
   }
 }
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 f0f649780afed5270d91d24d2e183ab16b58937c..98ed0bf63a164652309f770e289fc3e22344a2f1 100644 (file)
@@ -568,33 +568,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 4f8ca7133036707b8bc905566ad45509c89f86db..57c9e4862d01ea97c80f668ce43a3b7bcb0f24a0 100644 (file)
@@ -331,10 +331,6 @@ export class TableComponent implements AfterContentChecked, OnInit, OnChanges, O
     } else {
       this.useData();
     }
-
-    if (this.selectionType === 'single') {
-      this.table.selectCheck = this.singleSelectCheck.bind(this);
-    }
   }
 
   initUserConfig() {
@@ -769,10 +765,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;