1 import { Component, Input, OnChanges, OnInit, TemplateRef, ViewChild } from '@angular/core';
3 import { TableComponent } from '~/app/shared/datatable/table/table.component';
4 import { CdTableColumn } from '~/app/shared/models/cd-table-column';
7 RbdConfigurationSourceField,
9 } from '~/app/shared/models/configuration';
10 import { RbdConfigurationSourcePipe } from '~/app/shared/pipes/rbd-configuration-source.pipe';
11 import { FormatterService } from '~/app/shared/services/formatter.service';
12 import { RbdConfigurationService } from '~/app/shared/services/rbd-configuration.service';
15 selector: 'cd-rbd-configuration-table',
16 templateUrl: './rbd-configuration-list.component.html',
17 styleUrls: ['./rbd-configuration-list.component.scss']
19 export class RbdConfigurationListComponent implements OnInit, OnChanges {
21 data: RbdConfigurationEntry[];
22 poolConfigurationColumns: CdTableColumn[];
23 @ViewChild('configurationSourceTpl', { static: true })
24 configurationSourceTpl: TemplateRef<any>;
25 @ViewChild('configurationValueTpl', { static: true })
26 configurationValueTpl: TemplateRef<any>;
27 @ViewChild('poolConfTable', { static: true })
28 poolConfTable: TableComponent;
30 readonly sourceField = RbdConfigurationSourceField;
31 readonly typeField = RbdConfigurationType;
34 public formatterService: FormatterService,
35 private rbdConfigurationService: RbdConfigurationService
39 this.poolConfigurationColumns = [
40 { prop: 'displayName', name: $localize`Name` },
41 { prop: 'description', name: $localize`Description` },
42 { prop: 'name', name: $localize`Key` },
45 name: $localize`Source`,
46 cellTemplate: this.configurationSourceTpl,
47 pipe: new RbdConfigurationSourcePipe()
49 { prop: 'value', name: $localize`Value`, cellTemplate: this.configurationValueTpl }
57 // Filter settings out which are not listed in RbdConfigurationService
58 this.data = this.data.filter((row) =>
59 this.rbdConfigurationService