]> git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-list/rgw-daemon-list.component.ts
7f689615527821602682b6fbd7eaf99a6a4338ad
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / ceph / rgw / rgw-daemon-list / rgw-daemon-list.component.ts
1 import { Component } from '@angular/core';
2
3 import { I18n } from '@ngx-translate/i18n-polyfill';
4
5 import { RgwDaemonService } from '../../../shared/api/rgw-daemon.service';
6 import { CdTableColumn } from '../../../shared/models/cd-table-column';
7 import { CdTableFetchDataContext } from '../../../shared/models/cd-table-fetch-data-context';
8 import { CdTableSelection } from '../../../shared/models/cd-table-selection';
9 import { Permission } from '../../../shared/models/permissions';
10 import { CephShortVersionPipe } from '../../../shared/pipes/ceph-short-version.pipe';
11 import { AuthStorageService } from '../../../shared/services/auth-storage.service';
12
13 @Component({
14 selector: 'cd-rgw-daemon-list',
15 templateUrl: './rgw-daemon-list.component.html',
16 styleUrls: ['./rgw-daemon-list.component.scss']
17 })
18 export class RgwDaemonListComponent {
19 columns: CdTableColumn[] = [];
20 daemons: object[] = [];
21 selection: CdTableSelection = new CdTableSelection();
22 grafanaPermission: Permission;
23
24 constructor(
25 private rgwDaemonService: RgwDaemonService,
26 private authStorageService: AuthStorageService,
27 cephShortVersionPipe: CephShortVersionPipe,
28 private i18n: I18n
29 ) {
30 this.grafanaPermission = this.authStorageService.getPermissions().grafana;
31 this.columns = [
32 {
33 name: this.i18n('ID'),
34 prop: 'id',
35 flexGrow: 2
36 },
37 {
38 name: this.i18n('Hostname'),
39 prop: 'server_hostname',
40 flexGrow: 2
41 },
42 {
43 name: this.i18n('Version'),
44 prop: 'version',
45 flexGrow: 1,
46 pipe: cephShortVersionPipe
47 }
48 ];
49 }
50
51 getDaemonList(context: CdTableFetchDataContext) {
52 this.rgwDaemonService.list().subscribe(
53 (resp: object[]) => {
54 this.daemons = resp;
55 },
56 () => {
57 context.error();
58 }
59 );
60 }
61
62 updateSelection(selection: CdTableSelection) {
63 this.selection = selection;
64 }
65 }