From c2e9c1ebb01fd95cdbcb21388fa8ec69a4f14c6b Mon Sep 17 00:00:00 2001 From: Aashish Sharma Date: Tue, 25 Mar 2025 11:21:59 +0530 Subject: [PATCH] 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 --- .../mgr/dashboard/frontend/cypress/e2e/rgw/buckets.po.ts | 1 + .../frontend/cypress/e2e/rgw/configuration.e2e-spec.ts | 6 ++++++ .../frontend/cypress/e2e/rgw/configuration.po.ts | 8 ++++++++ .../ceph/rgw/rgw-bucket-form/rgw-bucket-form.component.ts | 8 ++------ 4 files changed, 17 insertions(+), 6 deletions(-) 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 ade9158ca8463..a5a8982cf6418 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 3cb1224fb0409..711d64299a1da 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 cc49804d9fa3e..1403e47460cdc 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 6aac20881e83c..c9c6954d23026 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(''); -- 2.39.5