]> git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-details/pool-details.component.ts
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / ceph / pool / pool-details / pool-details.component.ts
1 import { ChangeDetectionStrategy, Component, Input, OnChanges } from '@angular/core';
2
3 import _ from 'lodash';
4
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';
10
11 @Component({
12 selector: 'cd-pool-details',
13 templateUrl: './pool-details.component.html',
14 styleUrls: ['./pool-details.component.scss'],
15 changeDetection: ChangeDetectionStrategy.OnPush
16 })
17 export class PoolDetailsComponent implements OnChanges {
18 @Input()
19 cacheTiers: any[];
20 @Input()
21 permissions: Permissions;
22 @Input()
23 selection: any;
24
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'];
29
30 poolDetails: object;
31 selectedPoolConfiguration: RbdConfigurationEntry[];
32
33 constructor(private poolService: PoolService) {
34 this.cacheTierColumns = [
35 {
36 prop: 'pool_name',
37 name: $localize`Name`,
38 flexGrow: 3
39 },
40 {
41 prop: 'cache_mode',
42 name: $localize`Cache Mode`,
43 flexGrow: 2
44 },
45 {
46 prop: 'cache_min_evict_age',
47 name: $localize`Min Evict Age`,
48 flexGrow: 2
49 },
50 {
51 prop: 'cache_min_flush_age',
52 name: $localize`Min Flush Age`,
53 flexGrow: 2
54 },
55 {
56 prop: 'target_max_bytes',
57 name: $localize`Target Max Bytes`,
58 flexGrow: 2
59 },
60 {
61 prop: 'target_max_objects',
62 name: $localize`Target Max Objects`,
63 flexGrow: 2
64 }
65 ];
66 }
67
68 ngOnChanges() {
69 if (this.selection) {
70 this.poolService
71 .getConfiguration(this.selection.pool_name)
72 .subscribe((poolConf: RbdConfigurationEntry[]) => {
73 CdHelperClass.updateChanged(this, { selectedPoolConfiguration: poolConf });
74 });
75 CdHelperClass.updateChanged(this, {
76 poolDetails: _.omit(this.selection, this.omittedPoolAttributes)
77 });
78 }
79 }
80 }