File

src/app/ceph/rgw/rgw-daemon-list/rgw-daemon-list.component.ts

Metadata

selector cd-rgw-daemon-list
styleUrls ./rgw-daemon-list.component.scss
templateUrl ./rgw-daemon-list.component.html

Index

Properties
Methods

Constructor

constructor(rgwDaemonService: RgwDaemonService, authStorageService: AuthStorageService, cephShortVersionPipe: CephShortVersionPipe, i18n: I18n)
Parameters :
Name Type Optional
rgwDaemonService RgwDaemonService No
authStorageService AuthStorageService No
cephShortVersionPipe CephShortVersionPipe No
i18n I18n No

Methods

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

Properties

columns
Type : CdTableColumn[]
Default value : []
daemons
Type : object[]
Default value : []
grafanaPermission
Type : Permission
selection
Type : CdTableSelection
Default value : new CdTableSelection()
import { Component } from '@angular/core';

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

import { RgwDaemonService } from '../../../shared/api/rgw-daemon.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';
import { Permission } from '../../../shared/models/permissions';
import { CephShortVersionPipe } from '../../../shared/pipes/ceph-short-version.pipe';
import { AuthStorageService } from '../../../shared/services/auth-storage.service';

@Component({
  selector: 'cd-rgw-daemon-list',
  templateUrl: './rgw-daemon-list.component.html',
  styleUrls: ['./rgw-daemon-list.component.scss']
})
export class RgwDaemonListComponent {
  columns: CdTableColumn[] = [];
  daemons: object[] = [];
  selection: CdTableSelection = new CdTableSelection();
  grafanaPermission: Permission;

  constructor(
    private rgwDaemonService: RgwDaemonService,
    private authStorageService: AuthStorageService,
    cephShortVersionPipe: CephShortVersionPipe,
    private i18n: I18n
  ) {
    this.grafanaPermission = this.authStorageService.getPermissions().grafana;
    this.columns = [
      {
        name: this.i18n('ID'),
        prop: 'id',
        flexGrow: 2
      },
      {
        name: this.i18n('Hostname'),
        prop: 'server_hostname',
        flexGrow: 2
      },
      {
        name: this.i18n('Version'),
        prop: 'version',
        flexGrow: 1,
        pipe: cephShortVersionPipe
      }
    ];
  }

  getDaemonList(context: CdTableFetchDataContext) {
    this.rgwDaemonService.list().subscribe(
      (resp: object[]) => {
        this.daemons = resp;
      },
      () => {
        context.error();
      }
    );
  }

  updateSelection(selection: CdTableSelection) {
    this.selection = selection;
  }
}
<tabset>
  <tab i18n-heading heading="Daemons List">
    <cd-table [data]="daemons"
              [columns]="columns"
              columnMode="flex"
              selectionType="single"
              (updateSelection)="updateSelection($event)"
              (fetchData)="getDaemonList($event)">
      <cd-rgw-daemon-details cdTableDetail [selection]="selection">
      </cd-rgw-daemon-details>
    </cd-table>
  </tab>

  <tab i18n-heading
       *ngIf="grafanaPermission.read"
       heading="Overall Performance">
    <cd-grafana [grafanaPath]="'rgw-overview?'"
                uid="WAkugZpiz"
                grafanaStyle="two">
    </cd-grafana>
  </tab>
</tabset>

./rgw-daemon-list.component.scss

Legend
Html element
Component
Html element with directive

result-matching ""

    No results matching ""