From: Nizamudeen A Date: Thu, 6 Oct 2022 09:49:09 +0000 (+0530) Subject: Revert "mgr/dashboard: unselect rows in datatables" X-Git-Tag: v18.1.0~1031^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F48163%2Fhead;p=ceph.git Revert "mgr/dashboard: unselect rows in datatables" This reverts commit b79e2a6c6a9368a4fc167b05970db463cd60edab. Signed-off-by: Nizamudeen A --- diff --git a/src/pybind/mgr/dashboard/frontend/cypress/integration/block/mirroring.po.ts b/src/pybind/mgr/dashboard/frontend/cypress/integration/block/mirroring.po.ts index 456223a873ec..c4adca8b72fe 100644 --- a/src/pybind/mgr/dashboard/frontend/cypress/integration/block/mirroring.po.ts +++ b/src/pybind/mgr/dashboard/frontend/cypress/integration/block/mirroring.po.ts @@ -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) diff --git a/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/hosts.po.ts b/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/hosts.po.ts index 848f99501ac9..9511142ed43d 100644 --- a/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/hosts.po.ts +++ b/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/hosts.po.ts @@ -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) diff --git a/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/services.po.ts b/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/services.po.ts index f2c123f874df..c464a3f6cf81 100644 --- a/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/services.po.ts +++ b/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/services.po.ts @@ -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(); }); } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.spec.ts index f8178be26d8a..53c246d6e0bc 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.spec.ts @@ -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(); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts index c83cda24e8e1..c6c9369acfc6 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts @@ -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;