From: Yuri Weinstein Date: Thu, 26 Mar 2020 17:21:12 +0000 (-0700) Subject: Merge pull request #33665 from rhcs-dashboard/wip-44375-nautilus X-Git-Tag: v14.2.10~164 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d74fe1aa2b1f6cb9baeb122fa907d0c30ce23db0;p=ceph.git Merge pull request #33665 from rhcs-dashboard/wip-44375-nautilus nautilus: mgr/dashboard: do not show RGW API keys if only read-only privileges Reviewed-by: Lenz Grimmer Reviewed-by: Laura Paduano Reviewed-by: Ernesto Puerta Reviewed-by: Volker Theile --- d74fe1aa2b1f6cb9baeb122fa907d0c30ce23db0 diff --cc src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-details/rgw-user-details.component.spec.ts index cafbf63d5f0b,2dc8b286a6b8..dc5aa35a5828 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-details/rgw-user-details.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-details/rgw-user-details.component.spec.ts @@@ -28,27 -29,35 +29,57 @@@ describe('RgwUserDetailsComponent', () it('should create', () => { expect(component).toBeTruthy(); + + const detailsTab = fixture.debugElement.nativeElement.querySelector('tab[heading="Details"]'); + expect(detailsTab).toBeFalsy(); + const keysTab = fixture.debugElement.nativeElement.querySelector('tab[heading="Keys"]'); + expect(keysTab).toBeFalsy(); + }); + + it('should show "Details" tab', () => { + component.selection.selected = [{ uid: 'myUsername' }]; + component.selection.hasSingleSelection = true; + fixture.detectChanges(); + + const detailsTab = fixture.debugElement.nativeElement.querySelector('tab[heading="Details"]'); + expect(detailsTab).toBeTruthy(); + const keysTab = fixture.debugElement.nativeElement.querySelector('tab[heading="Keys"]'); + expect(keysTab).toBeFalsy(); + }); + + it('should show "Keys" tab', () => { + const s3Key = new RgwUserS3Key(); + component.selection.selected = [{ keys: [s3Key] }]; + component.selection.hasSingleSelection = true; + component.selection.hasSelection = true; + component.ngOnChanges(); + fixture.detectChanges(); + + const detailsTab = fixture.debugElement.nativeElement.querySelector('tab[heading="Details"]'); + expect(detailsTab).toBeTruthy(); + const keysTab = fixture.debugElement.nativeElement.querySelector('tab[heading="Keys"]'); + expect(keysTab).toBeTruthy(); }); + + it('should show correct "System" info', () => { + component.selection.selected = [ + { uid: '', email: '', system: 'true', keys: [], swift_keys: [] } + ]; + component.selection.hasSelection = true; + component.selection.hasSingleSelection = true; + component.ngOnChanges(); + fixture.detectChanges(); + + const detailsTab = fixture.debugElement.nativeElement.querySelectorAll( + '.table.table-striped.table-bordered tr td' + ); + expect(detailsTab[6].textContent).toEqual('System'); + expect(detailsTab[7].textContent).toEqual('Yes'); + + component.selection.selected[0].system = 'false'; + component.ngOnChanges(); + fixture.detectChanges(); + + expect(detailsTab[7].textContent).toEqual('No'); + }); });