summaryrefslogtreecommitdiffstats
path: root/src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-details/nfs-details.component.ts
blob: 5a84bd52e9da96f90da70cd8f48484edea83840f (plain)
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
62
63
64
65
66
67
68
import { Component, Input, OnChanges } from '@angular/core';

import { CdTableColumn } from '~/app/shared/models/cd-table-column';

@Component({
  selector: 'cd-nfs-details',
  templateUrl: './nfs-details.component.html',
  styleUrls: ['./nfs-details.component.scss']
})
export class NfsDetailsComponent implements OnChanges {
  @Input()
  selection: any;

  selectedItem: any;
  data: any;

  clientsColumns: CdTableColumn[];
  clients: any[] = [];

  constructor() {
    this.clientsColumns = [
      {
        name: $localize`Addresses`,
        prop: 'addresses',
        flexGrow: 2
      },
      {
        name: $localize`Access Type`,
        prop: 'access_type',
        flexGrow: 1
      },
      {
        name: $localize`Squash`,
        prop: 'squash',
        flexGrow: 1
      }
    ];
  }

  ngOnChanges() {
    if (this.selection) {
      this.selectedItem = this.selection;

      this.clients = this.selectedItem.clients;

      this.data = {};
      this.data[$localize`Cluster`] = this.selectedItem.cluster_id;
      this.data[$localize`NFS Protocol`] = this.selectedItem.protocols.map(
        (protocol: string) => 'NFSv' + protocol
      );
      this.data[$localize`Pseudo`] = this.selectedItem.pseudo;
      this.data[$localize`Access Type`] = this.selectedItem.access_type;
      this.data[$localize`Squash`] = this.selectedItem.squash;
      this.data[$localize`Transport`] = this.selectedItem.transports;
      this.data[$localize`Path`] = this.selectedItem.path;

      if (this.selectedItem.fsal.name === 'CEPH') {
        this.data[$localize`Storage Backend`] = $localize`CephFS`;
        this.data[$localize`CephFS User`] = this.selectedItem.fsal.user_id;
        this.data[$localize`CephFS Filesystem`] = this.selectedItem.fsal.fs_name;
        this.data[$localize`Security Label`] = this.selectedItem.fsal.sec_label_xattr;
      } else {
        this.data[$localize`Storage Backend`] = $localize`Object Gateway`;
        this.data[$localize`Object Gateway User`] = this.selectedItem.fsal.user_id;
      }
    }
  }
}