]> git.proxmox.com Git - ceph.git/blame - 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
CommitLineData
11fdf7f2
TL
1import { Component, OnInit } from '@angular/core';
2
3import { I18n } from '@ngx-translate/i18n-polyfill';
4
5import { CephfsService } from '../../../shared/api/cephfs.service';
9f95a23c 6import { CellTemplate } from '../../../shared/enum/cell-template.enum';
11fdf7f2
TL
7import { CdTableColumn } from '../../../shared/models/cd-table-column';
8import { CdTableFetchDataContext } from '../../../shared/models/cd-table-fetch-data-context';
9import { CdTableSelection } from '../../../shared/models/cd-table-selection';
9f95a23c 10import { CdDatePipe } from '../../../shared/pipes/cd-date.pipe';
11fdf7f2
TL
11
12@Component({
13 selector: 'cd-cephfs-list',
14 templateUrl: './cephfs-list.component.html',
15 styleUrls: ['./cephfs-list.component.scss']
16})
17export class CephfsListComponent implements OnInit {
18 columns: CdTableColumn[];
19 filesystems: any = [];
20 selection = new CdTableSelection();
21
9f95a23c
TL
22 constructor(
23 private cephfsService: CephfsService,
24 private cdDatePipe: CdDatePipe,
25 private i18n: I18n
26 ) {}
11fdf7f2
TL
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',
9f95a23c
TL
38 flexGrow: 2,
39 pipe: this.cdDatePipe
11fdf7f2
TL
40 },
41 {
42 name: this.i18n('Enabled'),
43 prop: 'mdsmap.enabled',
9f95a23c
TL
44 flexGrow: 1,
45 cellTransformation: CellTemplate.checkIcon
11fdf7f2
TL
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}