]> git.proxmox.com Git - ceph.git/blame - ceph/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-details/pool-details.component.ts
import ceph 14.2.5
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / ceph / pool / pool-details / pool-details.component.ts
CommitLineData
11fdf7f2
TL
1import { Component, Input, OnChanges, ViewChild } from '@angular/core';
2
3import { I18n } from '@ngx-translate/i18n-polyfill';
eafe8130 4import * as _ from 'lodash';
11fdf7f2
TL
5import { TabsetComponent } from 'ngx-bootstrap/tabs';
6
7import { PoolService } from '../../../shared/api/pool.service';
8import { CdTableColumn } from '../../../shared/models/cd-table-column';
9import { CdTableSelection } from '../../../shared/models/cd-table-selection';
10import { RbdConfigurationEntry } from '../../../shared/models/configuration';
11import { Permissions } from '../../../shared/models/permissions';
12
13@Component({
14 selector: 'cd-pool-details',
15 templateUrl: './pool-details.component.html',
16 styleUrls: ['./pool-details.component.scss']
17})
18export class PoolDetailsComponent implements OnChanges {
19 cacheTierColumns: Array<CdTableColumn> = [];
20
21 @Input()
22 selection: CdTableSelection;
23 @Input()
24 permissions: Permissions;
25 @Input()
26 cacheTiers: any[];
27 @ViewChild(TabsetComponent)
28 tabsetChild: TabsetComponent;
29 selectedPoolConfiguration: RbdConfigurationEntry[];
30
31 constructor(private i18n: I18n, private poolService: PoolService) {
32 this.cacheTierColumns = [
33 {
34 prop: 'pool_name',
35 name: this.i18n('Name'),
36 flexGrow: 3
37 },
38 {
39 prop: 'cache_mode',
40 name: this.i18n('Cache Mode'),
41 flexGrow: 2
42 },
43 {
44 prop: 'cache_min_evict_age',
45 name: this.i18n('Min Evict Age'),
46 flexGrow: 2
47 },
48 {
49 prop: 'cache_min_flush_age',
50 name: this.i18n('Min Flush Age'),
51 flexGrow: 2
52 },
53 {
54 prop: 'target_max_bytes',
55 name: this.i18n('Target Max Bytes'),
56 flexGrow: 2
57 },
58 {
59 prop: 'target_max_objects',
60 name: this.i18n('Target Max Objects'),
61 flexGrow: 2
62 }
63 ];
64 }
65
66 ngOnChanges() {
67 if (this.selection.hasSingleSelection) {
68 this.poolService.getConfiguration(this.selection.first().pool_name).subscribe((poolConf) => {
69 this.selectedPoolConfiguration = poolConf;
70 });
71 }
72 }
eafe8130
TL
73
74 filterNonPoolData(pool: object): object {
75 return _.omit(pool, ['cdExecuting', 'cdIsBinary']);
76 }
11fdf7f2 77}