]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/blob
689330f3cc49e83e7ce55fed0e5aad98bf4b788b
[ceph.git] /
1 import { Component, Input, OnChanges } from '@angular/core';
2 import { rgwEncryptionConfigKeys } from '~/app/shared/models/rgw-encryption-config-keys';
3
4 @Component({
5   selector: 'cd-rgw-config-details',
6   templateUrl: './rgw-config-details.component.html',
7   styleUrls: ['./rgw-config-details.component.scss']
8 })
9 export class RgwConfigDetailsComponent implements OnChanges {
10   transformedData: {};
11   @Input()
12   selection: any;
13
14   @Input()
15   excludeProps: any[] = [];
16   filteredEncryptionConfigValues: {};
17
18   ngOnChanges(): void {
19     if (this.selection) {
20       this.filteredEncryptionConfigValues = Object.keys(this.selection)
21         .filter((key) => !this.excludeProps.includes(key))
22         .reduce((obj, key) => {
23           obj[key] = this.selection[key];
24           return obj;
25         }, {});
26       const transformedData = {};
27       for (const key in this.filteredEncryptionConfigValues) {
28         if (rgwEncryptionConfigKeys[key]) {
29           transformedData[rgwEncryptionConfigKeys[key]] = this.filteredEncryptionConfigValues[key];
30         } else {
31           transformedData[key] = this.filteredEncryptionConfigValues[key];
32         }
33       }
34       this.transformedData = transformedData;
35     }
36   }
37 }