1 import { Component, Input, OnChanges, SimpleChanges } from '@angular/core';
2 import { DimlessBinaryPipe } from '~/app/shared/pipes/dimless-binary.pipe';
5 selector: 'cd-rgw-user-accounts-details',
6 templateUrl: './rgw-user-accounts-details.component.html',
7 styleUrls: ['./rgw-user-accounts-details.component.scss']
9 export class RgwUserAccountsDetailsComponent implements OnChanges {
15 constructor(private dimlessBinary: DimlessBinaryPipe) {}
17 ngOnChanges(changes: SimpleChanges): void {
18 if (changes.selection && changes.selection.currentValue) {
19 this.quota = this.createDisplayValues('quota');
20 this.bucket_quota = this.createDisplayValues('bucket_quota');
24 createDisplayValues(quota_type: string) {
26 Enabled: this.selection[quota_type].enabled ? 'Yes' : 'No',
27 'Maximum size': this.selection[quota_type].enabled
28 ? this.selection[quota_type].max_size <= -1
30 : this.dimlessBinary.transform(this.selection[quota_type].max_size)
32 'Maximum objects': this.selection[quota_type].enabled
33 ? this.selection[quota_type].max_objects <= -1
35 : this.selection[quota_type].max_objects