Disable edit default quota button when not editable

Signed-off-by: Henning Poettker <Henning.Poettker@c24.de>
This commit is contained in:
Henning Poettker 2024-08-05 20:52:22 +02:00
parent ad8c5df52e
commit 4aa1ffa2d0
No known key found for this signature in database
GPG Key ID: A2765B22EF50B852
2 changed files with 10 additions and 0 deletions

View File

@ -25,6 +25,7 @@
<button
id="open-edit"
class="btn btn-link btn-sm default-quota-edit-button"
[disabled]="!allConfig.storage_per_project.editable"
(click)="editDefaultQuota(quotaHardLimitValue)">
{{ 'QUOTA.EDIT' | translate }}
</button>

View File

@ -111,6 +111,7 @@ describe('ProjectQuotasComponent', () => {
await fixture.whenStable();
const openEditButton: HTMLButtonElement =
fixture.nativeElement.querySelector('#open-edit');
expect(openEditButton.disabled).toBeFalse();
openEditButton.dispatchEvent(new Event('click'));
fixture.detectChanges();
await fixture.whenStable();
@ -118,6 +119,14 @@ describe('ProjectQuotasComponent', () => {
fixture.nativeElement.querySelector('clr-modal');
expect(modal).toBeTruthy();
});
it('edit quota should be disabled when storage per project not editable', async () => {
component.config.storage_per_project.editable = false;
fixture.detectChanges();
await fixture.whenStable();
const openEditButton: HTMLButtonElement =
fixture.nativeElement.querySelector('#open-edit');
expect(openEditButton.disabled).toBeTrue();
});
it('should call navigate function', async () => {
// wait getting list and rendering
await timeout(10);