]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/dashboard: Fix rgw user key modal not shown
authorAashish Sharma <Aashish.Sharma1@ibm.com>
Thu, 13 Mar 2025 12:03:54 +0000 (17:33 +0530)
committerAashish Sharma <Aashish.Sharma1@ibm.com>
Tue, 18 Mar 2025 11:53:29 +0000 (17:23 +0530)
Fixes: https://tracker.ceph.com/issues/70450
Signed-off-by: Aashish Sharma <aasharma@redhat.com>
src/pybind/mgr/dashboard/frontend/cypress/e2e/rgw/users.e2e-spec.ts
src/pybind/mgr/dashboard/frontend/cypress/e2e/rgw/users.po.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-details/rgw-user-details.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-details/rgw-user-details.component.ts

index 396231b52b52efd0adb38cabb62384b6517e49fd..62060c958cad552ba38c5038995e5f70ee36262d 100644 (file)
@@ -24,6 +24,10 @@ describe('RGW users page', () => {
       users.getFirstTableCell(user_id).should('exist');
     });
 
+    it('should show user key details', () => {
+      users.checkUserKeys(user_name);
+    });
+
     it('should edit users full name, email and max buckets', () => {
       users.edit(user_name, 'Another Identity', 'changed@othersite.com', '1969');
     });
index c2bc0bf5ff804018435bf56e61be9e198fa6b5f5..6a931faf17bd9e6a8dc0192bd885bf89f122a7ee 100644 (file)
@@ -155,4 +155,15 @@ export class UsersPageHelper extends PageHelper {
     this.navigateTo();
     this.delete(tenant + '$' + uname, null, null, true, false, false, true);
   }
+
+  checkUserKeys(user_name: string) {
+    this.getExpandCollapseElement(user_name).should('be.visible').click();
+    cy.get('cd-table').contains('td', user_name).click();
+    cy.get('cd-rgw-user-details cd-table').eq(0).first().click();
+    cy.get("[aria-label='Show']").should('exist').click();
+    cy.get('input#user').should('exist');
+    cy.get('input#access_key').should('exist');
+    cy.get('input#secret_key').should('exist');
+    cy.get('cds-modal').should('exist');
+  }
 }
index 01b28dc3481d5d91f8655629d859ffe6c6d96cc3..c308bc6d94b161011dc42be3790c14aef05dc6f6 100644 (file)
@@ -82,12 +82,10 @@ describe('RgwUserDetailsComponent', () => {
     component.keysSelection.first = () => {
       return { type: 'S3', ref: { user: '', access_key: '', secret_key: '' } };
     };
-    const modalShowSpy = spyOn(component['modalService'], 'show').and.callFake(() => {
+    const modalShowSpy = spyOn(component['cdsModalService'], 'show').and.callFake(() => {
       modalRef = {
-        componentInstance: {
-          setValues: jest.fn(),
-          setViewing: jest.fn()
-        }
+        setValues: jest.fn(),
+        setViewing: jest.fn()
       };
       return modalRef;
     });
@@ -99,12 +97,10 @@ describe('RgwUserDetailsComponent', () => {
     component.keysSelection.first = () => {
       return { type: 'Swift', ref: { user: '', access_key: '', secret_key: '' } };
     };
-    const modalShowSpy = spyOn(component['modalService'], 'show').and.callFake(() => {
+    const modalShowSpy = spyOn(component['cdsModalService'], 'show').and.callFake(() => {
       modalRef = {
-        componentInstance: {
-          setValues: jest.fn(),
-          setViewing: jest.fn()
-        }
+        setValues: jest.fn(),
+        setViewing: jest.fn()
       };
       return modalRef;
     });
index 0accf141c78530a42fad85752183788c076ea88d..dd2f6d35e20962d2787e458a7905202eb0b55222 100644 (file)
@@ -6,7 +6,6 @@ import { RgwUserService } from '~/app/shared/api/rgw-user.service';
 import { Icons } from '~/app/shared/enum/icons.enum';
 import { CdTableColumn } from '~/app/shared/models/cd-table-column';
 import { CdTableSelection } from '~/app/shared/models/cd-table-selection';
-import { ModalService } from '~/app/shared/services/modal.service';
 import { RgwUserS3Key } from '../models/rgw-user-s3-key';
 import { RgwUserSwiftKey } from '../models/rgw-user-swift-key';
 import { RgwUserS3KeyModalComponent } from '../rgw-user-s3-key-modal/rgw-user-s3-key-modal.component';
@@ -14,6 +13,7 @@ import { RgwUserSwiftKeyModalComponent } from '../rgw-user-swift-key-modal/rgw-u
 import { CdTableAction } from '~/app/shared/models/cd-table-action';
 import { Permissions } from '~/app/shared/models/permissions';
 import { RgwRateLimitConfig } from '../models/rgw-rate-limit';
+import { ModalCdsService } from '~/app/shared/services/modal-cds.service';
 
 @Component({
   selector: 'cd-rgw-user-details',
@@ -42,7 +42,7 @@ export class RgwUserDetailsComponent implements OnChanges, OnInit {
 
   icons = Icons;
 
-  constructor(private rgwUserService: RgwUserService, private modalService: ModalService) {}
+  constructor(private rgwUserService: RgwUserService, private cdsModalService: ModalCdsService) {}
 
   ngOnInit() {
     this.keysColumns = [
@@ -123,16 +123,16 @@ export class RgwUserDetailsComponent implements OnChanges, OnInit {
 
   showKeyModal() {
     const key = this.keysSelection.first();
-    const modalRef = this.modalService.show(
+    const modalRef = this.cdsModalService.show(
       key.type === 'S3' ? RgwUserS3KeyModalComponent : RgwUserSwiftKeyModalComponent
     );
     switch (key.type) {
       case 'S3':
-        modalRef.componentInstance.setViewing();
-        modalRef.componentInstance.setValues(key.ref.user, key.ref.access_key, key.ref.secret_key);
+        modalRef.setViewing();
+        modalRef.setValues(key.ref.user, key.ref.access_key, key.ref.secret_key);
         break;
       case 'Swift':
-        modalRef.componentInstance.setValues(key.ref.user, key.ref.secret_key);
+        modalRef.setValues(key.ref.user, key.ref.secret_key);
         break;
     }
   }