1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
import { Component, OnInit } from '@angular/core';
import { CephfsService } from '~/app/shared/api/cephfs.service';
import { ListWithDetails } from '~/app/shared/classes/list-with-details.class';
import { CellTemplate } from '~/app/shared/enum/cell-template.enum';
import { CdTableColumn } from '~/app/shared/models/cd-table-column';
import { CdTableFetchDataContext } from '~/app/shared/models/cd-table-fetch-data-context';
import { CdTableSelection } from '~/app/shared/models/cd-table-selection';
import { CdDatePipe } from '~/app/shared/pipes/cd-date.pipe';
@Component({
selector: 'cd-cephfs-list',
templateUrl: './cephfs-list.component.html',
styleUrls: ['./cephfs-list.component.scss']
})
export class CephfsListComponent extends ListWithDetails implements OnInit {
columns: CdTableColumn[];
filesystems: any = [];
selection = new CdTableSelection();
constructor(private cephfsService: CephfsService, private cdDatePipe: CdDatePipe) {
super();
}
ngOnInit() {
this.columns = [
{
name: $localize`Name`,
prop: 'mdsmap.fs_name',
flexGrow: 2
},
{
name: $localize`Created`,
prop: 'mdsmap.created',
flexGrow: 2,
pipe: this.cdDatePipe
},
{
name: $localize`Enabled`,
prop: 'mdsmap.enabled',
flexGrow: 1,
cellTransformation: CellTemplate.checkIcon
}
];
}
loadFilesystems(context: CdTableFetchDataContext) {
this.cephfsService.list().subscribe(
(resp: any[]) => {
this.filesystems = resp;
},
() => {
context.error();
}
);
}
updateSelection(selection: CdTableSelection) {
this.selection = selection;
}
}
|