1 import { Component, Input, OnChanges, OnInit, TemplateRef, ViewChild } from '@angular/core';
3 import { I18n } from '@ngx-translate/i18n-polyfill';
4 import { TableComponent } from '../../../shared/datatable/table/table.component';
5 import { CdTableColumn } from '../../../shared/models/cd-table-column';
8 RbdConfigurationSourceField,
10 } from '../../../shared/models/configuration';
11 import { RbdConfigurationSourcePipe } from '../../../shared/pipes/rbd-configuration-source.pipe';
12 import { FormatterService } from '../../../shared/services/formatter.service';
13 import { RbdConfigurationService } from '../../../shared/services/rbd-configuration.service';
16 selector: 'cd-rbd-configuration-table',
17 templateUrl: './rbd-configuration-list.component.html',
18 styleUrls: ['./rbd-configuration-list.component.scss']
20 export class RbdConfigurationListComponent implements OnInit, OnChanges {
22 data: RbdConfigurationEntry[];
23 poolConfigurationColumns: CdTableColumn[];
24 @ViewChild('configurationSourceTpl')
25 configurationSourceTpl: TemplateRef<any>;
26 @ViewChild('configurationValueTpl')
27 configurationValueTpl: TemplateRef<any>;
28 @ViewChild('poolConfTable')
29 poolConfTable: TableComponent;
31 readonly sourceField = RbdConfigurationSourceField;
32 readonly typeField = RbdConfigurationType;
35 public formatterService: FormatterService,
36 private rbdConfigurationService: RbdConfigurationService,
41 this.poolConfigurationColumns = [
42 { prop: 'displayName', name: this.i18n('Name') },
43 { prop: 'description', name: this.i18n('Description') },
44 { prop: 'name', name: this.i18n('Key') },
47 name: this.i18n('Source'),
48 cellTemplate: this.configurationSourceTpl,
49 pipe: new RbdConfigurationSourcePipe()
51 { prop: 'value', name: this.i18n('Value'), cellTemplate: this.configurationValueTpl }
59 // Filter settings out which are not listed in RbdConfigurationService
60 this.data = this.data.filter((row) =>
61 this.rbdConfigurationService