From 2158dee7ca46b5667846efc210752ece0459e312 Mon Sep 17 00:00:00 2001 From: Pedro Gonzalez Gomez Date: Thu, 14 Mar 2024 07:58:36 +0100 Subject: [PATCH] mgr/dashboard: fix empty tags Fixes: https://tracker.ceph.com/issues/64911 Signed-off-by: Pedro Gonzalez Gomez (cherry picked from commit a60f82566551e731987b4a02d1bb2bf4cfb9a9ce) --- .../app/ceph/rgw/rgw-bucket-form/rgw-bucket-form.component.ts | 4 ++++ 1 file changed, 4 insertions(+) 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 3b3a50e88f820..a50545714d11f 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 @@ -61,6 +61,7 @@ export class RgwBucketFormComponent extends CdForm implements OnInit, AfterViewC kmsVaultConfig = false; s3VaultConfig = false; tags: Record[] = []; + dirtyTags = false; tagConfig = [ { attribute: 'key' @@ -437,6 +438,7 @@ export class RgwBucketFormComponent extends CdForm implements OnInit, AfterViewC deleteTag(index: number) { this.tags.splice(index, 1); + this.dirtyTags = true; this.bucketForm.markAsDirty(); this.bucketForm.updateValueAndValidity(); } @@ -447,11 +449,13 @@ export class RgwBucketFormComponent extends CdForm implements OnInit, AfterViewC } else { this.tags.push(tag); } + this.dirtyTags = true; this.bucketForm.markAsDirty(); this.bucketForm.updateValueAndValidity(); } private tagsToXML(tags: Record[]): string { + if (!this.dirtyTags && tags.length === 0) return ''; let xml = ''; for (const tag of tags) { xml += ''; -- 2.39.5