mirror of
https://github.com/grafana/grafana.git
synced 2024-11-29 04:04:00 -06:00
DS Picker: Built-in datasources are not marked as selected (#70020)
This commit is contained in:
parent
f41651ad68
commit
908b248e10
@ -6,6 +6,7 @@ import { DataSourceRef } from '@grafana/schema';
|
||||
import { useDatasources } from '../../hooks';
|
||||
|
||||
import { DataSourceCard } from './DataSourceCard';
|
||||
import { isDataSourceMatch } from './utils';
|
||||
|
||||
const CUSTOM_DESCRIPTIONS_BY_UID: Record<string, string> = {
|
||||
grafana: 'Discover visualizations using mock data',
|
||||
@ -30,7 +31,7 @@ export function BuiltInDataSourceList({ className, current, onChange }: BuiltInD
|
||||
key={ds.uid}
|
||||
ds={ds}
|
||||
description={CUSTOM_DESCRIPTIONS_BY_UID[ds.uid]}
|
||||
selected={current === ds.id}
|
||||
selected={isDataSourceMatch(ds, current)}
|
||||
onClick={() => onChange(ds)}
|
||||
/>
|
||||
);
|
||||
|
@ -86,7 +86,7 @@ export function DataSourceList(props: DataSourceListProps) {
|
||||
pushRecentlyUsedDataSource(ds);
|
||||
onChange(ds);
|
||||
}}
|
||||
selected={!!isDataSourceMatch(ds, current)}
|
||||
selected={isDataSourceMatch(ds, current)}
|
||||
{...(enableKeyboardNavigation ? navigatableProps : {})}
|
||||
/>
|
||||
))}
|
||||
|
@ -3,7 +3,7 @@ import { DataSourceInstanceSettings, DataSourceJsonData, DataSourceRef } from '@
|
||||
export function isDataSourceMatch(
|
||||
ds: DataSourceInstanceSettings | undefined,
|
||||
current: string | DataSourceInstanceSettings | DataSourceRef | null | undefined
|
||||
): boolean | undefined {
|
||||
): boolean {
|
||||
if (!ds) {
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user