mirror of
https://github.com/grafana/grafana.git
synced 2025-02-11 08:05:43 -06:00
fix: multiple queries in alerting regression (#44585)
This commit is contained in:
parent
45a435ad78
commit
26ddeaf3d7
@ -17,6 +17,7 @@ import { queriesWithUpdatedReferences } from './util';
|
||||
import { Button, Card, Icon } from '@grafana/ui';
|
||||
import { QueryOperationRow } from 'app/core/components/QueryOperationRow/QueryOperationRow';
|
||||
import { getDatasourceSrv } from 'app/features/plugins/datasource_srv';
|
||||
import { omit } from 'lodash';
|
||||
|
||||
interface Props {
|
||||
// The query configuration
|
||||
@ -108,19 +109,7 @@ export class QueryRows extends PureComponent<Props, State> {
|
||||
return item;
|
||||
}
|
||||
|
||||
const previous = getDataSourceSrv().getInstanceSettings(item.datasourceUid);
|
||||
|
||||
if (previous?.type === settings.uid) {
|
||||
return {
|
||||
...item,
|
||||
datasourceUid: settings.uid,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
...item,
|
||||
datasourceUid: settings.uid,
|
||||
};
|
||||
return copyModel(item, settings.uid);
|
||||
});
|
||||
onQueriesChange(updatedQueries);
|
||||
};
|
||||
@ -291,6 +280,14 @@ export class QueryRows extends PureComponent<Props, State> {
|
||||
}
|
||||
}
|
||||
|
||||
function copyModel(item: AlertQuery, uid: string): Omit<AlertQuery, 'datasource'> {
|
||||
return {
|
||||
...item,
|
||||
model: omit(item.model, 'datasource'),
|
||||
datasourceUid: uid,
|
||||
};
|
||||
}
|
||||
|
||||
interface DatasourceNotFoundProps {
|
||||
index: number;
|
||||
model: AlertDataQuery;
|
||||
|
Loading…
Reference in New Issue
Block a user