]>
Commit | Line | Data |
---|---|---|
11fdf7f2 TL |
1 | import { Component, Input, OnChanges } from '@angular/core'; |
2 | ||
3 | import { I18n } from '@ngx-translate/i18n-polyfill'; | |
11fdf7f2 | 4 | |
81eedcae | 5 | import { CdTableColumn } from '../../../shared/models/cd-table-column'; |
11fdf7f2 TL |
6 | |
7 | @Component({ | |
8 | selector: 'cd-nfs-details', | |
9 | templateUrl: './nfs-details.component.html', | |
10 | styleUrls: ['./nfs-details.component.scss'] | |
11 | }) | |
12 | export class NfsDetailsComponent implements OnChanges { | |
13 | @Input() | |
e306af50 | 14 | selection: any; |
11fdf7f2 TL |
15 | |
16 | selectedItem: any; | |
17 | data: any; | |
18 | ||
81eedcae | 19 | clientsColumns: CdTableColumn[]; |
9f95a23c | 20 | clients: any[] = []; |
81eedcae TL |
21 | |
22 | constructor(private i18n: I18n) { | |
23 | this.clientsColumns = [ | |
24 | { | |
25 | name: this.i18n('Addresses'), | |
26 | prop: 'addresses', | |
27 | flexGrow: 2 | |
28 | }, | |
29 | { | |
30 | name: this.i18n('Access Type'), | |
31 | prop: 'access_type', | |
32 | flexGrow: 1 | |
33 | }, | |
34 | { | |
35 | name: this.i18n('Squash'), | |
36 | prop: 'squash', | |
37 | flexGrow: 1 | |
38 | } | |
39 | ]; | |
40 | } | |
11fdf7f2 TL |
41 | |
42 | ngOnChanges() { | |
e306af50 TL |
43 | if (this.selection) { |
44 | this.selectedItem = this.selection; | |
81eedcae TL |
45 | |
46 | this.clients = this.selectedItem.clients; | |
47 | ||
11fdf7f2 TL |
48 | this.data = {}; |
49 | this.data[this.i18n('Cluster')] = this.selectedItem.cluster_id; | |
50 | this.data[this.i18n('Daemons')] = this.selectedItem.daemons; | |
51 | this.data[this.i18n('NFS Protocol')] = this.selectedItem.protocols.map( | |
9f95a23c | 52 | (protocol: string) => 'NFSv' + protocol |
11fdf7f2 TL |
53 | ); |
54 | this.data[this.i18n('Pseudo')] = this.selectedItem.pseudo; | |
55 | this.data[this.i18n('Access Type')] = this.selectedItem.access_type; | |
56 | this.data[this.i18n('Squash')] = this.selectedItem.squash; | |
57 | this.data[this.i18n('Transport')] = this.selectedItem.transports; | |
58 | this.data[this.i18n('Path')] = this.selectedItem.path; | |
59 | ||
60 | if (this.selectedItem.fsal.name === 'CEPH') { | |
61 | this.data[this.i18n('Storage Backend')] = this.i18n('CephFS'); | |
62 | this.data[this.i18n('CephFS User')] = this.selectedItem.fsal.user_id; | |
63 | this.data[this.i18n('CephFS Filesystem')] = this.selectedItem.fsal.fs_name; | |
64 | this.data[this.i18n('Security Label')] = this.selectedItem.fsal.sec_label_xattr; | |
65 | } else { | |
66 | this.data[this.i18n('Storage Backend')] = this.i18n('Object Gateway'); | |
67 | this.data[this.i18n('Object Gateway User')] = this.selectedItem.fsal.rgw_user_id; | |
68 | } | |
69 | } | |
70 | } | |
71 | } |