mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-06-21 22:14:33 +08:00

Co-authored-by: Chintan Sudani <46838508+techchintan@users.noreply.github.com> Co-authored-by: Palash Gupta <palashgdev@gmail.com>
34 lines
857 B
TypeScript
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}
|
|
/>
|
|
);
|
|
}
|