mirror of
https://github.com/grafana/grafana.git
synced 2025-01-17 04:02:50 -06:00
only show datasources that support alerting in query editor (#43776)
This commit is contained in:
parent
8cf63a9d44
commit
0dd88d9480
@ -71,6 +71,7 @@ export const QueryWrapper: FC<Props> = ({
|
||||
return (
|
||||
<div className={styles.wrapper}>
|
||||
<QueryEditorRow<DataQuery>
|
||||
alerting
|
||||
dataSource={dsSettings}
|
||||
onChangeDataSource={!isExpression ? (settings) => onChangeDataSource(settings, index) : undefined}
|
||||
id={query.refId}
|
||||
|
@ -51,6 +51,7 @@ interface Props<TQuery extends DataQuery> {
|
||||
app?: CoreApp;
|
||||
history?: Array<HistoryItem<TQuery>>;
|
||||
eventBus?: EventBusExtended;
|
||||
alerting?: boolean;
|
||||
}
|
||||
|
||||
interface State<TQuery extends DataQuery> {
|
||||
@ -361,7 +362,7 @@ export class QueryEditorRow<TQuery extends DataQuery> extends PureComponent<Prop
|
||||
};
|
||||
|
||||
renderHeader = (props: QueryOperationRowRenderProps) => {
|
||||
const { query, dataSource, onChangeDataSource, onChange, queries, renderHeaderExtras } = this.props;
|
||||
const { alerting, query, dataSource, onChangeDataSource, onChange, queries, renderHeaderExtras } = this.props;
|
||||
|
||||
return (
|
||||
<QueryEditorRowHeader
|
||||
@ -374,6 +375,7 @@ export class QueryEditorRow<TQuery extends DataQuery> extends PureComponent<Prop
|
||||
onChange={onChange}
|
||||
collapsedText={!props.isOpen ? this.renderCollapsedText() : null}
|
||||
renderExtras={renderHeaderExtras}
|
||||
alerting={alerting}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
@ -15,6 +15,7 @@ export interface Props<TQuery extends DataQuery = DataQuery> {
|
||||
onChange: (query: TQuery) => void;
|
||||
onClick: (e: React.MouseEvent) => void;
|
||||
collapsedText: string | null;
|
||||
alerting?: boolean;
|
||||
}
|
||||
|
||||
export const QueryEditorRowHeader = <TQuery extends DataQuery>(props: Props<TQuery>) => {
|
||||
@ -130,7 +131,7 @@ const renderDataSource = <TQuery extends DataQuery>(
|
||||
props: Props<TQuery>,
|
||||
styles: ReturnType<typeof getStyles>
|
||||
): ReactNode => {
|
||||
const { dataSource, onChangeDataSource } = props;
|
||||
const { alerting, dataSource, onChangeDataSource } = props;
|
||||
|
||||
if (!onChangeDataSource) {
|
||||
return <em className={styles.contextInfo}>({dataSource.name})</em>;
|
||||
@ -138,7 +139,7 @@ const renderDataSource = <TQuery extends DataQuery>(
|
||||
|
||||
return (
|
||||
<div className={styles.itemWrapper}>
|
||||
<DataSourcePicker current={dataSource.name} onChange={onChangeDataSource} />
|
||||
<DataSourcePicker alerting={alerting} current={dataSource.name} onChange={onChangeDataSource} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user