1 import { ChangeDetectionStrategy, Component, Input, OnChanges } from '@angular/core';
3 import _ from 'lodash';
5 import { PoolService } from '~/app/shared/api/pool.service';
6 import { CdHelperClass } from '~/app/shared/classes/cd-helper.class';
7 import { CdTableColumn } from '~/app/shared/models/cd-table-column';
8 import { RbdConfigurationEntry } from '~/app/shared/models/configuration';
9 import { Permissions } from '~/app/shared/models/permissions';
12 selector: 'cd-pool-details',
13 templateUrl: './pool-details.component.html',
14 styleUrls: ['./pool-details.component.scss'],
15 changeDetection: ChangeDetectionStrategy.OnPush
17 export class PoolDetailsComponent implements OnChanges {
21 permissions: Permissions;
25 cacheTierColumns: Array<CdTableColumn> = [];
26 // 'stats' won't be shown as the pure stat numbers won't tell the user much,
27 // if they are not converted or used in a chart (like the ones available in the pool listing)
28 omittedPoolAttributes = ['cdExecuting', 'cdIsBinary', 'stats'];
31 selectedPoolConfiguration: RbdConfigurationEntry[];
33 constructor(private poolService: PoolService) {
34 this.cacheTierColumns = [
37 name: $localize`Name`,
42 name: $localize`Cache Mode`,
46 prop: 'cache_min_evict_age',
47 name: $localize`Min Evict Age`,
51 prop: 'cache_min_flush_age',
52 name: $localize`Min Flush Age`,
56 prop: 'target_max_bytes',
57 name: $localize`Target Max Bytes`,
61 prop: 'target_max_objects',
62 name: $localize`Target Max Objects`,
71 .getConfiguration(this.selection.pool_name)
72 .subscribe((poolConf: RbdConfigurationEntry[]) => {
73 CdHelperClass.updateChanged(this, { selectedPoolConfiguration: poolConf });
75 CdHelperClass.updateChanged(this, {
76 poolDetails: _.omit(this.selection, this.omittedPoolAttributes)