File

src/app/ceph/block/iscsi/iscsi.component.ts

Metadata

selector cd-iscsi
styleUrls ./iscsi.component.scss
templateUrl ./iscsi.component.html

Index

Properties
Methods

Constructor

constructor(tcmuIscsiService: TcmuIscsiService, cephShortVersionPipe: CephShortVersionPipe, dimlessPipe: DimlessPipe, relativeDatePipe: RelativeDatePipe, listPipe: ListPipe, i18n: I18n)
Parameters :
Name Type Optional
tcmuIscsiService TcmuIscsiService No
cephShortVersionPipe CephShortVersionPipe No
dimlessPipe DimlessPipe No
relativeDatePipe RelativeDatePipe No
listPipe ListPipe No
i18n I18n No

Methods

refresh
refresh()
Returns : void

Properties

daemons
Type : []
Default value : []
daemonsColumns
Type : any
images
Type : []
Default value : []
imagesColumns
Type : any
import { Component } from '@angular/core';

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

import { TcmuIscsiService } from '../../../shared/api/tcmu-iscsi.service';
import { CellTemplate } from '../../../shared/enum/cell-template.enum';
import { CephShortVersionPipe } from '../../../shared/pipes/ceph-short-version.pipe';
import { DimlessPipe } from '../../../shared/pipes/dimless.pipe';
import { ListPipe } from '../../../shared/pipes/list.pipe';
import { RelativeDatePipe } from '../../../shared/pipes/relative-date.pipe';

@Component({
  selector: 'cd-iscsi',
  templateUrl: './iscsi.component.html',
  styleUrls: ['./iscsi.component.scss']
})
export class IscsiComponent {
  daemons = [];
  daemonsColumns: any;
  images = [];
  imagesColumns: any;

  constructor(
    private tcmuIscsiService: TcmuIscsiService,
    cephShortVersionPipe: CephShortVersionPipe,
    dimlessPipe: DimlessPipe,
    relativeDatePipe: RelativeDatePipe,
    listPipe: ListPipe,
    private i18n: I18n
  ) {
    this.daemonsColumns = [
      {
        name: this.i18n('Hostname'),
        prop: 'server_hostname'
      },
      {
        name: this.i18n('# Active/Optimized'),
        prop: 'optimized_paths'
      },
      {
        name: this.i18n('# Active/Non-Optimized'),
        prop: 'non_optimized_paths'
      },
      {
        name: this.i18n('Version'),
        prop: 'version',
        pipe: cephShortVersionPipe
      }
    ];
    this.imagesColumns = [
      {
        name: this.i18n('Pool'),
        prop: 'pool_name'
      },
      {
        name: this.i18n('Image'),
        prop: 'name'
      },
      {
        name: this.i18n('Active/Optimized'),
        prop: 'optimized_paths',
        pipe: listPipe
      },
      {
        name: this.i18n('Active/Non-Optimized'),
        prop: 'non_optimized_paths',
        pipe: listPipe
      },
      {
        name: this.i18n('Read Bytes'),
        prop: 'stats_history.rd_bytes',
        cellTransformation: CellTemplate.sparkline
      },
      {
        name: this.i18n('Write Bytes'),
        prop: 'stats_history.wr_bytes',
        cellTransformation: CellTemplate.sparkline
      },
      {
        name: this.i18n('Read Ops'),
        prop: 'stats.rd',
        pipe: dimlessPipe,
        cellTransformation: CellTemplate.perSecond
      },
      {
        name: this.i18n('Write Ops'),
        prop: 'stats.wr',
        pipe: dimlessPipe,
        cellTransformation: CellTemplate.perSecond
      },
      {
        name: this.i18n('A/O Since'),
        prop: 'optimized_since',
        pipe: relativeDatePipe
      }
    ];
  }

  refresh() {
    this.tcmuIscsiService.tcmuiscsi().subscribe((resp: any) => {
      this.daemons = resp.daemons;
      this.images = resp.images;
      this.images.map((image) => {
        if (image.stats_history) {
          image.stats_history.rd_bytes = image.stats_history.rd_bytes.map((i) => i[1]);
          image.stats_history.wr_bytes = image.stats_history.wr_bytes.map((i) => i[1]);
        }
        image.cdIsBinary = true;
        return image;
      });
    });
  }
}
<cd-iscsi-tabs></cd-iscsi-tabs>

<legend i18n>Daemons</legend>
<cd-table [data]="daemons"
          (fetchData)="refresh()"
          [columns]="daemonsColumns">
</cd-table>

<legend i18n>Images</legend>
<cd-table [data]="images"
          [columns]="imagesColumns">
</cd-table>

./iscsi.component.scss

Legend
Html element
Component
Html element with directive

result-matching ""

    No results matching ""