]> git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-list/cephfs-list.component.ts
import 15.2.0 Octopus source
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / ceph / cephfs / cephfs-list / cephfs-list.component.ts
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';
6 import { CellTemplate } from '../../../shared/enum/cell-template.enum';
7 import { CdTableColumn } from '../../../shared/models/cd-table-column';
8 import { CdTableFetchDataContext } from '../../../shared/models/cd-table-fetch-data-context';
9 import { CdTableSelection } from '../../../shared/models/cd-table-selection';
10 import { CdDatePipe } from '../../../shared/pipes/cd-date.pipe';
11
12 @Component({
13 selector: 'cd-cephfs-list',
14 templateUrl: './cephfs-list.component.html',
15 styleUrls: ['./cephfs-list.component.scss']
16 })
17 export class CephfsListComponent implements OnInit {
18 columns: CdTableColumn[];
19 filesystems: any = [];
20 selection = new CdTableSelection();
21
22 constructor(
23 private cephfsService: CephfsService,
24 private cdDatePipe: CdDatePipe,
25 private i18n: I18n
26 ) {}
27
28 ngOnInit() {
29 this.columns = [
30 {
31 name: this.i18n('Name'),
32 prop: 'mdsmap.fs_name',
33 flexGrow: 2
34 },
35 {
36 name: this.i18n('Created'),
37 prop: 'mdsmap.created',
38 flexGrow: 2,
39 pipe: this.cdDatePipe
40 },
41 {
42 name: this.i18n('Enabled'),
43 prop: 'mdsmap.enabled',
44 flexGrow: 1,
45 cellTransformation: CellTemplate.checkIcon
46 }
47 ];
48 }
49
50 loadFilesystems(context: CdTableFetchDataContext) {
51 this.cephfsService.list().subscribe(
52 (resp: any[]) => {
53 this.filesystems = resp;
54 },
55 () => {
56 context.error();
57 }
58 );
59 }
60
61 updateSelection(selection: CdTableSelection) {
62 this.selection = selection;
63 }
64 }