Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const parts = _.partition(devices, (row) => {
// use getter from ngx-datatable for props like 'sys_api.size'
const valueGetter = getterForProp(filter.prop);
return `${valueGetter(row, filter.prop)}` === filter.value;
});
devices = parts[0];
templateUrl: './silence-list.component.html',
styleUrls: ['./silence-list.component.scss']
})
export class SilenceListComponent implements OnInit {
silences: AlertmanagerSilence[] = [];
columns: CdTableColumn[];
tableActions: CdTableAction[];
permission: Permission;
selection = new CdTableSelection();
modalRef: BsModalRef;
customCss = {
'label label-danger': 'active',
'label label-warning': 'pending',
'label label-default': 'expired'
};
sorts: SortPropDir[] = [{ prop: 'endsAt', dir: SortDirection.desc }];
constructor(
private authStorageService: AuthStorageService,
private i18n: I18n,
private cdDatePipe: CdDatePipe,
private prometheusService: PrometheusService,
private modalService: BsModalService,
private notificationService: NotificationService,
private urlBuilder: URLBuilderService,
private actionLabels: ActionLabelsI18n,
private succeededLabels: SucceededActionLabelsI18n
) {
this.permission = this.authStorageService.getPermissions().prometheus;
}
ngOnInit() {
const columnValues = devices.map((device: InventoryDevice) => {
const valueGetter = getterForProp(filter.prop);
const value = valueGetter(device, filter.prop);
const formatValue = filter.pipe ? filter.pipe.transform(value) : value;
return `${formatValue}`;
});
const expectedOptionsSet = new Set(['*', ...columnValues]);
createSortingDefinition(prop: TableColumnProp): SortPropDir[] {
return [
{
prop: prop,
dir: SortDirection.asc
}
];
}