1 import { Component, Input, OnChanges, OnInit, TemplateRef, ViewChild } from '@angular/core';
3 import { I18n } from '@ngx-translate/i18n-polyfill';
4 import { CdTableColumn } from '../../../shared/models/cd-table-column';
7 RbdConfigurationSourceField,
9 } from '../../../shared/models/configuration';
10 import { FormatterService } from '../../../shared/services/formatter.service';
11 import { RbdConfigurationService } from '../../../shared/services/rbd-configuration.service';
14 selector: 'cd-rbd-configuration-table',
15 templateUrl: './rbd-configuration-list.component.html',
16 styleUrls: ['./rbd-configuration-list.component.scss']
18 export class RbdConfigurationListComponent implements OnInit, OnChanges {
20 data: RbdConfigurationEntry[];
21 poolConfigurationColumns: CdTableColumn[];
22 @ViewChild('configurationSourceTpl')
23 configurationSourceTpl: TemplateRef<any>;
24 @ViewChild('configurationValueTpl')
25 configurationValueTpl: TemplateRef<any>;
27 readonly sourceField = RbdConfigurationSourceField;
28 readonly typeField = RbdConfigurationType;
31 public formatterService: FormatterService,
32 private rbdConfigurationService: RbdConfigurationService,
37 this.poolConfigurationColumns = [
38 { prop: 'displayName', name: this.i18n('Name') },
39 { prop: 'description', name: this.i18n('Description') },
40 { prop: 'name', name: this.i18n('Key') },
41 { prop: 'source', name: this.i18n('Source'), cellTemplate: this.configurationSourceTpl },
42 { prop: 'value', name: this.i18n('Value'), cellTemplate: this.configurationValueTpl }
50 // Filter settings out which are not listed in RbdConfigurationService
51 this.data = this.data.filter((row) =>
52 this.rbdConfigurationService