2023-04-19 21:08:09 +08:00
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
|
|
import {
|
|
|
|
|
DataSourcePicker as DeprecatedDataSourcePicker,
|
|
|
|
|
DataSourcePickerProps as DeprecatedDataSourcePickerProps,
|
|
|
|
|
} from '@grafana/runtime';
|
|
|
|
|
import { config } from 'app/core/config';
|
|
|
|
|
|
2023-06-23 16:26:18 +08:00
|
|
|
import { DataSourceDropdown, DataSourceDropdownProps } from './DataSourceDropdown';
|
2023-04-19 21:08:09 +08:00
|
|
|
|
2023-04-20 18:11:13 +08:00
|
|
|
type DataSourcePickerProps = DeprecatedDataSourcePickerProps | DataSourceDropdownProps;
|
2023-04-19 21:08:09 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* DataSourcePicker is a wrapper around the old DataSourcePicker and the new one.
|
|
|
|
|
* Depending on the feature toggle, it will render the old or the new one.
|
|
|
|
|
* Feature toggle: advancedDataSourcePicker
|
|
|
|
|
*/
|
|
|
|
|
export function DataSourcePicker(props: DataSourcePickerProps) {
|
|
|
|
|
return !config.featureToggles.advancedDataSourcePicker ? (
|
|
|
|
|
<DeprecatedDataSourcePicker {...props} />
|
|
|
|
|
) : (
|
2023-04-20 18:11:13 +08:00
|
|
|
<DataSourceDropdown {...props} />
|
2023-04-19 21:08:09 +08:00
|
|
|
);
|
|
|
|
|
}
|