Yevhen Shevchenko 61a1d04252
feat(builder): add aggregator filter (#2516)
Co-authored-by: Chintan Sudani <46838508+techchintan@users.noreply.github.com>
Co-authored-by: Palash Gupta <palashgdev@gmail.com>
2023-04-01 11:29:35 +05:30

34 lines
857 B
TypeScript

import { Select } from 'antd';
import React from 'react';
import { DataSource } from 'types/common/queryBuilder';
import { SelectOption } from 'types/common/select';
// ** Helpers
import { transformToUpperCase } from 'utils/transformToUpperCase';
// ** Types
import { QueryLabelProps } from './DataSourceDropdown.interfaces';
const dataSourceMap = [DataSource.LOGS, DataSource.METRICS, DataSource.TRACES];
export function DataSourceDropdown(props: QueryLabelProps): JSX.Element {
const { onChange, value, style } = props;
const dataSourceOptions: SelectOption<
DataSource,
string
>[] = dataSourceMap.map((source) => ({
label: transformToUpperCase(source),
value: source,
}));
return (
<Select
defaultValue={dataSourceOptions[0].value}
options={dataSourceOptions}
onChange={onChange}
value={value}
style={style}
/>
);
}