Merge pull request #56183 from rhcs-dashboard/fix-tags-null

mgr/dashboard: fix empty tags 

Reviewed-by: afreen23 <NOT@FOUND>
Reviewed-by: Ankush Behl <cloudbehl@gmail.com>
Reviewed-by: Nizamudeen A <nia@redhat.com>
This commit is contained in:
Nizamudeen A 2024-03-21 00:47:04 +05:30 committed by GitHub
commit cab8141bf1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -61,6 +61,7 @@ export class RgwBucketFormComponent extends CdForm implements OnInit, AfterViewC
kmsVaultConfig = false;
s3VaultConfig = false;
tags: Record<string, string>[] = [];
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, string>[]): string {
if (!this.dirtyTags && tags.length === 0) return '';
let xml = '<Tagging><TagSet>';
for (const tag of tags) {
xml += '<Tag>';