1 import { Component, Input, OnInit, ViewChild } from '@angular/core';
2 import { Observable, of } from 'rxjs';
3 import { catchError } from 'rxjs/operators';
5 import { CephfsSubvolumeGroupService } from '~/app/shared/api/cephfs-subvolume-group.service';
6 import { CellTemplate } from '~/app/shared/enum/cell-template.enum';
7 import { CdTableColumn } from '~/app/shared/models/cd-table-column';
8 import { CdTableFetchDataContext } from '~/app/shared/models/cd-table-fetch-data-context';
9 import { CdTableSelection } from '~/app/shared/models/cd-table-selection';
10 import { CephfsSubvolumeGroup } from '~/app/shared/models/cephfs-subvolume-group.model';
13 selector: 'cd-cephfs-subvolume-group',
14 templateUrl: './cephfs-subvolume-group.component.html',
15 styleUrls: ['./cephfs-subvolume-group.component.scss']
17 export class CephfsSubvolumeGroupComponent implements OnInit {
18 @ViewChild('quotaUsageTpl', { static: true })
21 @ViewChild('typeTpl', { static: true })
24 @ViewChild('modeToHumanReadableTpl', { static: true })
25 modeToHumanReadableTpl: any;
27 @ViewChild('nameTpl', { static: true })
30 @ViewChild('quotaSizeTpl', { static: true })
36 columns: CdTableColumn[];
37 context: CdTableFetchDataContext;
38 selection = new CdTableSelection();
40 subvolumeGroup$: Observable<CephfsSubvolumeGroup[]>;
42 constructor(private cephfsSubvolumeGroup: CephfsSubvolumeGroupService) {}
47 name: $localize`Name`,
50 cellTransformation: CellTemplate.bold
53 name: $localize`Data Pool`,
54 prop: 'info.data_pool',
56 cellTransformation: CellTemplate.badge,
57 customTemplateConfig: {
58 class: 'badge-background-primary'
62 name: $localize`Usage`,
63 prop: 'info.bytes_pcent',
65 cellTemplate: this.quotaUsageTpl,
66 cellClass: 'text-right'
69 name: $localize`Mode`,
72 cellTemplate: this.modeToHumanReadableTpl
75 name: $localize`Created`,
76 prop: 'info.created_at',
78 cellTransformation: CellTemplate.timeAgo
84 this.subvolumeGroup$ = this.cephfsSubvolumeGroup.get(this.fsName).pipe(
92 updateSelection(selection: CdTableSelection) {
93 this.selection = selection;