mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -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 (
|
return (
|
||||||
<div className={styles.wrapper}>
|
<div className={styles.wrapper}>
|
||||||
<QueryEditorRow<DataQuery>
|
<QueryEditorRow<DataQuery>
|
||||||
|
alerting
|
||||||
dataSource={dsSettings}
|
dataSource={dsSettings}
|
||||||
onChangeDataSource={!isExpression ? (settings) => onChangeDataSource(settings, index) : undefined}
|
onChangeDataSource={!isExpression ? (settings) => onChangeDataSource(settings, index) : undefined}
|
||||||
id={query.refId}
|
id={query.refId}
|
||||||
|
@ -51,6 +51,7 @@ interface Props<TQuery extends DataQuery> {
|
|||||||
app?: CoreApp;
|
app?: CoreApp;
|
||||||
history?: Array<HistoryItem<TQuery>>;
|
history?: Array<HistoryItem<TQuery>>;
|
||||||
eventBus?: EventBusExtended;
|
eventBus?: EventBusExtended;
|
||||||
|
alerting?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface State<TQuery extends DataQuery> {
|
interface State<TQuery extends DataQuery> {
|
||||||
@ -361,7 +362,7 @@ export class QueryEditorRow<TQuery extends DataQuery> extends PureComponent<Prop
|
|||||||
};
|
};
|
||||||
|
|
||||||
renderHeader = (props: QueryOperationRowRenderProps) => {
|
renderHeader = (props: QueryOperationRowRenderProps) => {
|
||||||
const { query, dataSource, onChangeDataSource, onChange, queries, renderHeaderExtras } = this.props;
|
const { alerting, query, dataSource, onChangeDataSource, onChange, queries, renderHeaderExtras } = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<QueryEditorRowHeader
|
<QueryEditorRowHeader
|
||||||
@ -374,6 +375,7 @@ export class QueryEditorRow<TQuery extends DataQuery> extends PureComponent<Prop
|
|||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
collapsedText={!props.isOpen ? this.renderCollapsedText() : null}
|
collapsedText={!props.isOpen ? this.renderCollapsedText() : null}
|
||||||
renderExtras={renderHeaderExtras}
|
renderExtras={renderHeaderExtras}
|
||||||
|
alerting={alerting}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -15,6 +15,7 @@ export interface Props<TQuery extends DataQuery = DataQuery> {
|
|||||||
onChange: (query: TQuery) => void;
|
onChange: (query: TQuery) => void;
|
||||||
onClick: (e: React.MouseEvent) => void;
|
onClick: (e: React.MouseEvent) => void;
|
||||||
collapsedText: string | null;
|
collapsedText: string | null;
|
||||||
|
alerting?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const QueryEditorRowHeader = <TQuery extends DataQuery>(props: Props<TQuery>) => {
|
export const QueryEditorRowHeader = <TQuery extends DataQuery>(props: Props<TQuery>) => {
|
||||||
@ -130,7 +131,7 @@ const renderDataSource = <TQuery extends DataQuery>(
|
|||||||
props: Props<TQuery>,
|
props: Props<TQuery>,
|
||||||
styles: ReturnType<typeof getStyles>
|
styles: ReturnType<typeof getStyles>
|
||||||
): ReactNode => {
|
): ReactNode => {
|
||||||
const { dataSource, onChangeDataSource } = props;
|
const { alerting, dataSource, onChangeDataSource } = props;
|
||||||
|
|
||||||
if (!onChangeDataSource) {
|
if (!onChangeDataSource) {
|
||||||
return <em className={styles.contextInfo}>({dataSource.name})</em>;
|
return <em className={styles.contextInfo}>({dataSource.name})</em>;
|
||||||
@ -138,7 +139,7 @@ const renderDataSource = <TQuery extends DataQuery>(
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.itemWrapper}>
|
<div className={styles.itemWrapper}>
|
||||||
<DataSourcePicker current={dataSource.name} onChange={onChangeDataSource} />
|
<DataSourcePicker alerting={alerting} current={dataSource.name} onChange={onChangeDataSource} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user