From 2a527796725ac787cf96ff2a35de05dd3feefc76 Mon Sep 17 00:00:00 2001 From: Volker Theile Date: Tue, 30 Jun 2020 11:26:22 +0200 Subject: [PATCH] mgr/dashboard: stay on active tab * Remember the selected tab and restore the state on tabset init. * Remove tab headers where only one tab is shown. Fixes: https://tracker.ceph.com/issues/43120 Signed-off-by: Volker Theile --- .../cluster/configuration.e2e-spec.ts | 5 +- .../cypress/integration/page-helper.po.ts | 8 +- .../image-list/image-list.component.html | 9 +- .../rbd-details/rbd-details.component.html | 9 +- .../cephfs-tabs/cephfs-tabs.component.html | 11 +- .../configuration-details.component.html | 218 +++++++------- .../configuration-details.component.spec.ts | 4 +- .../host-details/host-details.component.html | 13 +- .../app/ceph/cluster/logs/logs.component.html | 7 +- .../mgr-module-details.component.html | 16 +- .../mgr-module-details.component.spec.ts | 4 +- .../osd-details/osd-details.component.html | 17 +- .../service-details.component.html | 16 +- .../service-details.component.spec.ts | 23 +- .../nfs-details/nfs-details.component.html | 7 +- .../pool-details/pool-details.component.html | 11 +- .../rgw-bucket-details.component.html | 268 +++++++++--------- .../rgw-bucket-details.component.spec.ts | 4 +- .../rgw-daemon-details.component.html | 9 +- .../rgw-user-details.component.html | 7 +- .../role-details/role-details.component.html | 30 +- .../shared/directives/directives.module.ts | 7 +- .../directives/stateful-tab.directive.spec.ts | 29 ++ .../directives/stateful-tab.directive.ts | 31 ++ 24 files changed, 376 insertions(+), 387 deletions(-) create mode 100644 src/pybind/mgr/dashboard/frontend/src/app/shared/directives/stateful-tab.directive.spec.ts create mode 100644 src/pybind/mgr/dashboard/frontend/src/app/shared/directives/stateful-tab.directive.ts diff --git a/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/configuration.e2e-spec.ts b/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/configuration.e2e-spec.ts index fda568206752..33b3e357a68d 100644 --- a/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/configuration.e2e-spec.ts +++ b/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/configuration.e2e-spec.ts @@ -23,10 +23,9 @@ describe('Configuration page', () => { configuration.getTableSelectedCount().should('eq', 1); }); - it('should check that details table opens and tab is correct', () => { + it('should check that details table opens (w/o tab header)', () => { configuration.getStatusTables().should('be.visible'); - configuration.getTabsCount().should('eq', 1); - configuration.getTabText(0).should('eq', 'Details'); + configuration.getTabs().should('not.exist'); }); }); diff --git a/src/pybind/mgr/dashboard/frontend/cypress/integration/page-helper.po.ts b/src/pybind/mgr/dashboard/frontend/cypress/integration/page-helper.po.ts index 44532b666781..b1a2fdfda377 100644 --- a/src/pybind/mgr/dashboard/frontend/cypress/integration/page-helper.po.ts +++ b/src/pybind/mgr/dashboard/frontend/cypress/integration/page-helper.po.ts @@ -69,12 +69,16 @@ export abstract class PageHelper { cy.get('.breadcrumb-item.active').should('have.text', text); } + getTabs() { + return cy.get('.nav.nav-tabs li'); + } + getTabText(index: number) { - return cy.get('.nav.nav-tabs li').its(index).text(); + return this.getTabs().its(index).text(); } getTabsCount(): any { - return cy.get('.nav.nav-tabs li').its('length'); + return this.getTabs().its('length'); } /** diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/image-list/image-list.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/image-list/image-list.component.html index 584a09a9ad71..ee2f3d0421b3 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/image-list/image-list.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/image-list/image-list.component.html @@ -1,7 +1,8 @@