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