From: Aashish Sharma Date: Tue, 25 Mar 2025 05:51:59 +0000 (+0530) Subject: mgr/dashboard: fix bucket form encryption checkbox X-Git-Tag: v20.3.0~243^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F62476%2Fhead;p=ceph.git mgr/dashboard: fix bucket form encryption checkbox The condition to disable/enable encryption checkbox on bucket form is broken because of the new structure of the get encryption config API response. Fixes: https://tracker.ceph.com/issues/70646 Signed-off-by: Aashish Sharma --- diff --git a/src/pybind/mgr/dashboard/frontend/cypress/e2e/rgw/buckets.po.ts b/src/pybind/mgr/dashboard/frontend/cypress/e2e/rgw/buckets.po.ts index ade9158ca846..a5a8982cf641 100644 --- a/src/pybind/mgr/dashboard/frontend/cypress/e2e/rgw/buckets.po.ts +++ b/src/pybind/mgr/dashboard/frontend/cypress/e2e/rgw/buckets.po.ts @@ -35,6 +35,7 @@ export class BucketsPageHelper extends PageHelper { // Select bucket owner this.selectOwner(owner); cy.get('#owner').should('have.class', 'ng-valid'); + cy.get('input[name=encryption_enabled]').should('be.disabled'); if (isLocking) { cy.get('#lock_enabled_input').click({ force: true }); diff --git a/src/pybind/mgr/dashboard/frontend/cypress/e2e/rgw/configuration.e2e-spec.ts b/src/pybind/mgr/dashboard/frontend/cypress/e2e/rgw/configuration.e2e-spec.ts index 3cb1224fb040..711d64299a1d 100644 --- a/src/pybind/mgr/dashboard/frontend/cypress/e2e/rgw/configuration.e2e-spec.ts +++ b/src/pybind/mgr/dashboard/frontend/cypress/e2e/rgw/configuration.e2e-spec.ts @@ -33,4 +33,10 @@ describe('RGW configuration page', () => { configurations.getDataTables().should('contain.text', 'https://localhost:9090'); }); }); + + describe('check bucket encryption checkbox', () => { + it('should ensure encryption checkbox to be enabled in bucket form', () => { + configurations.checkBucketEncryption(); + }); + }); }); diff --git a/src/pybind/mgr/dashboard/frontend/cypress/e2e/rgw/configuration.po.ts b/src/pybind/mgr/dashboard/frontend/cypress/e2e/rgw/configuration.po.ts index cc49804d9fa3..1403e47460cd 100644 --- a/src/pybind/mgr/dashboard/frontend/cypress/e2e/rgw/configuration.po.ts +++ b/src/pybind/mgr/dashboard/frontend/cypress/e2e/rgw/configuration.po.ts @@ -1,4 +1,7 @@ import { PageHelper } from '../page-helper.po'; +import { BucketsPageHelper } from './buckets.po'; + +const buckets = new BucketsPageHelper(); export class ConfigurationPageHelper extends PageHelper { pages = { @@ -46,4 +49,9 @@ export class ConfigurationPageHelper extends PageHelper { private selectSecretEngine(secret_engine: string) { return this.selectOption('secret_engine', secret_engine); } + + checkBucketEncryption() { + buckets.navigateTo('create'); + cy.get('input[name=encryption_enabled]').should('be.enabled'); + } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-form/rgw-bucket-form.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-form/rgw-bucket-form.component.ts index 6aac20881e83..c9c6954d2302 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-form/rgw-bucket-form.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-form/rgw-bucket-form.component.ts @@ -190,12 +190,8 @@ export class RgwBucketFormComponent extends CdForm implements OnInit, AfterViewC this.kmsProviders = rgwBucketEncryptionModel.kmsProviders; this.rgwBucketService.getEncryptionConfig().subscribe((data) => { - if (data['SSE_KMS']?.length > 0) { - this.kmsConfigured = true; - } - if (data['SSE_S3']?.length > 0) { - this.s3Configured = true; - } + this.s3Configured = data.s3 && Object.keys(data.s3).length > 0; + this.kmsConfigured = data.kms && Object.keys(data.kms).length > 0; // Set the encryption type based on the configurations if (this.kmsConfigured && this.s3Configured) { this.bucketForm.get('encryption_type').setValue('');