]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: remove bucket policy 55241/head
authorPedro Gonzalez Gomez <pegonzal@redhat.com>
Fri, 19 Jan 2024 05:40:05 +0000 (06:40 +0100)
committerPedro Gonzalez Gomez <pegonzal@redhat.com>
Mon, 29 Jan 2024 18:06:24 +0000 (19:06 +0100)
add a button on the bucket form to clear the bucket policy

Fixes: https://tracker.ceph.com/issues/64096
Signed-off-by: Pedro Gonzalez Gomez <pegonzal@redhat.com>
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-form/rgw-bucket-form.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-form/rgw-bucket-form.component.ts

index eef66a6da60b429e66288c1872234ec6b080fdaf..77cd69934dc24a3188bee9626220055762753c7e 100644 (file)
                 <span class="invalid-feedback"
                       *ngIf="bucketForm.showError('bucket_policy', frm, 'invalidJson')"
                       i18n>Invalid json text</span>
+                <button type="button"
+                        id="clear-bucket-policy"
+                        class="btn btn-light my-3"
+                        (click)="clearBucketPolicy()"
+                        i18n>
+                  <i [ngClass]="[icons.destroy]"></i>
+                  Clear
+                </button>
                 <div class="btn-group float-end"
                      role="group"
                      aria-label="bucket-policy-helpers">
index f7015f609f68b38e5c293f0d6350f3f4ff91b373..e5267e357c1cd0b66725ca9d38554a6ba2770862 100644 (file)
@@ -385,6 +385,12 @@ export class RgwBucketFormComponent extends CdForm implements OnInit, AfterViewC
     window.open(url, '_blank');
   }
 
+  clearBucketPolicy() {
+    this.bucketForm.get('bucket_policy').setValue('{}');
+    this.bucketForm.markAsDirty();
+    this.bucketForm.updateValueAndValidity();
+  }
+
   openConfigModal() {
     const modalRef = this.modalService.show(RgwConfigModalComponent, null, { size: 'lg' });
     modalRef.componentInstance.configForm