mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
PanelEdit: Add data source label to data source picker dropdown (#34605)
* PanelEdit: Add data source label to data source picker dropdown * Updated based on ux feedback
This commit is contained in:
@@ -2,10 +2,11 @@
|
|||||||
import React, { PureComponent } from 'react';
|
import React, { PureComponent } from 'react';
|
||||||
|
|
||||||
// Components
|
// Components
|
||||||
import { HorizontalGroup, PluginSignatureBadge, Select } from '@grafana/ui';
|
import { HorizontalGroup, PluginSignatureBadge, Select, stylesFactory } from '@grafana/ui';
|
||||||
import { DataSourceInstanceSettings, isUnsignedPluginSignature, SelectableValue } from '@grafana/data';
|
import { DataSourceInstanceSettings, isUnsignedPluginSignature, SelectableValue } from '@grafana/data';
|
||||||
import { selectors } from '@grafana/e2e-selectors';
|
import { selectors } from '@grafana/e2e-selectors';
|
||||||
import { getDataSourceSrv } from '../services/dataSourceSrv';
|
import { getDataSourceSrv } from '../services/dataSourceSrv';
|
||||||
|
import { css, cx } from '@emotion/css';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component props description for the {@link DataSourcePicker}
|
* Component props description for the {@link DataSourcePicker}
|
||||||
@@ -138,11 +139,12 @@ export class DataSourcePicker extends PureComponent<DataSourcePickerProps, DataS
|
|||||||
const { error } = this.state;
|
const { error } = this.state;
|
||||||
const options = this.getDataSourceOptions();
|
const options = this.getDataSourceOptions();
|
||||||
const value = this.getCurrentValue();
|
const value = this.getCurrentValue();
|
||||||
|
const styles = getStyles();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div aria-label={selectors.components.DataSourcePicker.container}>
|
<div aria-label={selectors.components.DataSourcePicker.container}>
|
||||||
<Select
|
<Select
|
||||||
className="ds-picker select-container"
|
className={styles.select}
|
||||||
isMulti={false}
|
isMulti={false}
|
||||||
isClearable={false}
|
isClearable={false}
|
||||||
backspaceRemovesValue={false}
|
backspaceRemovesValue={false}
|
||||||
@@ -172,3 +174,13 @@ export class DataSourcePicker extends PureComponent<DataSourcePickerProps, DataS
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getStyles = stylesFactory(() => ({
|
||||||
|
select: cx(
|
||||||
|
css({
|
||||||
|
minWidth: 200,
|
||||||
|
}),
|
||||||
|
'ds-picker',
|
||||||
|
'select-container'
|
||||||
|
),
|
||||||
|
}));
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import {
|
|||||||
CustomScrollbar,
|
CustomScrollbar,
|
||||||
HorizontalGroup,
|
HorizontalGroup,
|
||||||
Icon,
|
Icon,
|
||||||
|
InlineFormLabel,
|
||||||
Modal,
|
Modal,
|
||||||
ScrollbarPosition,
|
ScrollbarPosition,
|
||||||
stylesFactory,
|
stylesFactory,
|
||||||
@@ -201,6 +202,7 @@ export class QueryGroup extends PureComponent<Props, State> {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div className={styles.dataSourceRow}>
|
<div className={styles.dataSourceRow}>
|
||||||
|
<InlineFormLabel width={'auto'}>Data source</InlineFormLabel>
|
||||||
<div className={styles.dataSourceRowItem}>
|
<div className={styles.dataSourceRowItem}>
|
||||||
<DataSourcePicker
|
<DataSourcePicker
|
||||||
onChange={this.onChangeDataSource}
|
onChange={this.onChangeDataSource}
|
||||||
|
|||||||
Reference in New Issue
Block a user