From e0ff884a2fcec2c5b924d2673008353b3ded8bc1 Mon Sep 17 00:00:00 2001 From: Nizamudeen A Date: Thu, 1 Feb 2024 22:10:21 +0530 Subject: [PATCH] pacifc: Revert "mgr/dashboard: unselect rows in datatables" This is already reverted in reef and quincy. Since its not needed reverting it in pacific as well Fixes: https://tracker.ceph.com/issues/57829 This reverts commit 3bdb929bab8f3eda32dcf9e46bb54a221ea54d3b. Signed-off-by: Nizamudeen A --- .../cypress/integration/block/mirroring.po.ts | 5 +---- .../cypress/integration/cluster/hosts.po.ts | 4 +++- .../integration/cluster/services.po.ts | 4 ---- .../datatable/table/table.component.spec.ts | 22 ++----------------- .../shared/datatable/table/table.component.ts | 8 ------- 5 files changed, 6 insertions(+), 37 deletions(-) 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 e24a3ebc037ab..8450763d301a5 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 @@ -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(); } } 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 33fe756ff8577..0c5da93316c46 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 481d6bc9b4d3a..b3918572f3df6 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 f0f649780afed..98ed0bf63a164 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 @@ -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(); 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 6a37468c27222..873b0de0bdd62 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 @@ -329,10 +329,6 @@ export class TableComponent implements AfterContentChecked, OnInit, OnChanges, O } else { this.useData(); } - - if (this.selectionType === 'single') { - this.table.selectCheck = this.singleSelectCheck.bind(this); - } } initUserConfig() { @@ -766,10 +762,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; -- 2.39.5