]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: fix bucket form encryption checkbox 62476/head
authorAashish Sharma <Aashish.Sharma1@ibm.com>
Tue, 25 Mar 2025 05:51:59 +0000 (11:21 +0530)
committerAashish Sharma <Aashish.Sharma1@ibm.com>
Thu, 27 Mar 2025 10:40:15 +0000 (16:10 +0530)
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 <aasharma@redhat.com>
src/pybind/mgr/dashboard/frontend/cypress/e2e/rgw/buckets.po.ts
src/pybind/mgr/dashboard/frontend/cypress/e2e/rgw/configuration.e2e-spec.ts
src/pybind/mgr/dashboard/frontend/cypress/e2e/rgw/configuration.po.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-form/rgw-bucket-form.component.ts

index ade9158ca8463ee30c1a7fb23a4ac85faede61d5..a5a8982cf6418dd52e39c2241089afb58beb89aa 100644 (file)
@@ -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 });
index 3cb1224fb04093d446954c08c8e014e3739c2dd2..711d64299a1da1f3c04a8b9755bb4c7be780b5c8 100644 (file)
@@ -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();
+    });
+  });
 });
index cc49804d9fa3ec81a5f873d2c16c3081552eac1d..1403e47460cdcd7e242d19ec804d77383d89530a 100644 (file)
@@ -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');
+  }
 }
index 6aac20881e83c59c93a5e4cd09ab5198792cb505..c9c6954d2302693b3d54c30c00bf2960f7ceca43 100644 (file)
@@ -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('');