File

src/app/ceph/cephfs/cephfs-list/cephfs-list.component.ts

Implements

OnInit

Metadata

selector cd-cephfs-list
styleUrls ./cephfs-list.component.scss
templateUrl ./cephfs-list.component.html

Index

Properties
Methods

Constructor

constructor(cephfsService: CephfsService, i18n: I18n)
Parameters :
Name Type Optional
cephfsService CephfsService No
i18n I18n No

Methods

loadFilesystems
loadFilesystems(context: CdTableFetchDataContext)
Parameters :
Name Type Optional
context CdTableFetchDataContext No
Returns : void
ngOnInit
ngOnInit()
Returns : void
updateSelection
updateSelection(selection: CdTableSelection)
Parameters :
Name Type Optional
selection CdTableSelection No
Returns : void

Properties

columns
Type : CdTableColumn[]
filesystems
Type : any
Default value : []
selection
Default value : new CdTableSelection()
import { Component, OnInit } from '@angular/core';

import { I18n } from '@ngx-translate/i18n-polyfill';

import { CephfsService } from '../../../shared/api/cephfs.service';
import { CdTableColumn } from '../../../shared/models/cd-table-column';
import { CdTableFetchDataContext } from '../../../shared/models/cd-table-fetch-data-context';
import { CdTableSelection } from '../../../shared/models/cd-table-selection';

@Component({
  selector: 'cd-cephfs-list',
  templateUrl: './cephfs-list.component.html',
  styleUrls: ['./cephfs-list.component.scss']
})
export class CephfsListComponent implements OnInit {
  columns: CdTableColumn[];
  filesystems: any = [];
  selection = new CdTableSelection();

  constructor(private cephfsService: CephfsService, private i18n: I18n) {}

  ngOnInit() {
    this.columns = [
      {
        name: this.i18n('Name'),
        prop: 'mdsmap.fs_name',
        flexGrow: 2
      },
      {
        name: this.i18n('Created'),
        prop: 'mdsmap.created',
        flexGrow: 2
      },
      {
        name: this.i18n('Enabled'),
        prop: 'mdsmap.enabled',
        flexGrow: 1
      }
    ];
  }

  loadFilesystems(context: CdTableFetchDataContext) {
    this.cephfsService.list().subscribe(
      (resp: any[]) => {
        this.filesystems = resp;
      },
      () => {
        context.error();
      }
    );
  }

  updateSelection(selection: CdTableSelection) {
    this.selection = selection;
  }
}
<cd-table [data]="filesystems"
          columnMode="flex"
          [columns]="columns"
          (fetchData)="loadFilesystems($event)"
          identifier="id"
          forceIdentifier="true"
          selectionType="single"
          (updateSelection)="updateSelection($event)">
  <cd-cephfs-detail cdTableDetail
                    [selection]="selection">
  </cd-cephfs-detail>
</cd-table>

./cephfs-list.component.scss

Legend
Html element
Component
Html element with directive

result-matching ""

    No results matching ""