Skip to content

Commit eb4c3bf

Browse files
authored
Merge pull request ceph#62275 from rhcs-dashboard/fix-70450-main
mgr/dashboard: Fix rgw user key modal not shown Reviewed-by: Nizamudeen A <[email protected]>
2 parents 6e4da22 + 78a988f commit eb4c3bf

File tree

4 files changed

+27
-16
lines changed

4 files changed

+27
-16
lines changed

src/pybind/mgr/dashboard/frontend/cypress/e2e/rgw/users.e2e-spec.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ describe('RGW users page', () => {
2424
users.getFirstTableCell(user_id).should('exist');
2525
});
2626

27+
it('should show user key details', () => {
28+
users.checkUserKeys(user_name);
29+
});
30+
2731
it('should edit users full name, email and max buckets', () => {
2832
users.edit(user_name, 'Another Identity', '[email protected]', '1969');
2933
});

src/pybind/mgr/dashboard/frontend/cypress/e2e/rgw/users.po.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,4 +155,15 @@ export class UsersPageHelper extends PageHelper {
155155
this.navigateTo();
156156
this.delete(tenant + '$' + uname, null, null, true, false, false, true);
157157
}
158+
159+
checkUserKeys(user_name: string) {
160+
this.getExpandCollapseElement(user_name).should('be.visible').click();
161+
cy.get('cd-table').contains('td', user_name).click();
162+
cy.get('cd-rgw-user-details cd-table').eq(0).first().click();
163+
cy.get("[aria-label='Show']").should('exist').click();
164+
cy.get('input#user').should('exist');
165+
cy.get('input#access_key').should('exist');
166+
cy.get('input#secret_key').should('exist');
167+
cy.get('cds-modal').should('exist');
168+
}
158169
}

src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-details/rgw-user-details.component.spec.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,10 @@ describe('RgwUserDetailsComponent', () => {
8282
component.keysSelection.first = () => {
8383
return { type: 'S3', ref: { user: '', access_key: '', secret_key: '' } };
8484
};
85-
const modalShowSpy = spyOn(component['modalService'], 'show').and.callFake(() => {
85+
const modalShowSpy = spyOn(component['cdsModalService'], 'show').and.callFake(() => {
8686
modalRef = {
87-
componentInstance: {
88-
setValues: jest.fn(),
89-
setViewing: jest.fn()
90-
}
87+
setValues: jest.fn(),
88+
setViewing: jest.fn()
9189
};
9290
return modalRef;
9391
});
@@ -99,12 +97,10 @@ describe('RgwUserDetailsComponent', () => {
9997
component.keysSelection.first = () => {
10098
return { type: 'Swift', ref: { user: '', access_key: '', secret_key: '' } };
10199
};
102-
const modalShowSpy = spyOn(component['modalService'], 'show').and.callFake(() => {
100+
const modalShowSpy = spyOn(component['cdsModalService'], 'show').and.callFake(() => {
103101
modalRef = {
104-
componentInstance: {
105-
setValues: jest.fn(),
106-
setViewing: jest.fn()
107-
}
102+
setValues: jest.fn(),
103+
setViewing: jest.fn()
108104
};
109105
return modalRef;
110106
});

src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-details/rgw-user-details.component.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ import { RgwUserService } from '~/app/shared/api/rgw-user.service';
66
import { Icons } from '~/app/shared/enum/icons.enum';
77
import { CdTableColumn } from '~/app/shared/models/cd-table-column';
88
import { CdTableSelection } from '~/app/shared/models/cd-table-selection';
9-
import { ModalService } from '~/app/shared/services/modal.service';
109
import { RgwUserS3Key } from '../models/rgw-user-s3-key';
1110
import { RgwUserSwiftKey } from '../models/rgw-user-swift-key';
1211
import { RgwUserS3KeyModalComponent } from '../rgw-user-s3-key-modal/rgw-user-s3-key-modal.component';
1312
import { RgwUserSwiftKeyModalComponent } from '../rgw-user-swift-key-modal/rgw-user-swift-key-modal.component';
1413
import { CdTableAction } from '~/app/shared/models/cd-table-action';
1514
import { Permissions } from '~/app/shared/models/permissions';
1615
import { RgwRateLimitConfig } from '../models/rgw-rate-limit';
16+
import { ModalCdsService } from '~/app/shared/services/modal-cds.service';
1717

1818
@Component({
1919
selector: 'cd-rgw-user-details',
@@ -42,7 +42,7 @@ export class RgwUserDetailsComponent implements OnChanges, OnInit {
4242

4343
icons = Icons;
4444

45-
constructor(private rgwUserService: RgwUserService, private modalService: ModalService) {}
45+
constructor(private rgwUserService: RgwUserService, private cdsModalService: ModalCdsService) {}
4646

4747
ngOnInit() {
4848
this.keysColumns = [
@@ -123,16 +123,16 @@ export class RgwUserDetailsComponent implements OnChanges, OnInit {
123123

124124
showKeyModal() {
125125
const key = this.keysSelection.first();
126-
const modalRef = this.modalService.show(
126+
const modalRef = this.cdsModalService.show(
127127
key.type === 'S3' ? RgwUserS3KeyModalComponent : RgwUserSwiftKeyModalComponent
128128
);
129129
switch (key.type) {
130130
case 'S3':
131-
modalRef.componentInstance.setViewing();
132-
modalRef.componentInstance.setValues(key.ref.user, key.ref.access_key, key.ref.secret_key);
131+
modalRef.setViewing();
132+
modalRef.setValues(key.ref.user, key.ref.access_key, key.ref.secret_key);
133133
break;
134134
case 'Swift':
135-
modalRef.componentInstance.setValues(key.ref.user, key.ref.secret_key);
135+
modalRef.setValues(key.ref.user, key.ref.secret_key);
136136
break;
137137
}
138138
}

0 commit comments

Comments
 (0)