mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Annotations settings: Do not preserve query properties when changing data source (#77422)
* Annotations settings: Do not preserve query props when changing data source * Handle changing data source type
This commit is contained in:
parent
d7c50eb650
commit
2f88d02ebc
@ -72,10 +72,26 @@ export const AnnotationSettingsEdit = ({ editIdx, dashboard }: Props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onDataSourceChange = (ds: DataSourceInstanceSettings) => {
|
const onDataSourceChange = (ds: DataSourceInstanceSettings) => {
|
||||||
|
const dsRef = getDataSourceRef(ds);
|
||||||
|
|
||||||
|
if (annotation.datasource?.type !== dsRef.type) {
|
||||||
|
onUpdate({
|
||||||
|
datasource: dsRef,
|
||||||
|
builtIn: annotation.builtIn,
|
||||||
|
enable: annotation.enable,
|
||||||
|
iconColor: annotation.iconColor,
|
||||||
|
name: annotation.name,
|
||||||
|
hide: annotation.hide,
|
||||||
|
filter: annotation.filter,
|
||||||
|
mappings: annotation.mappings,
|
||||||
|
type: annotation.type,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
onUpdate({
|
onUpdate({
|
||||||
...annotation,
|
...annotation,
|
||||||
datasource: getDataSourceRef(ds),
|
datasource: dsRef,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const onChange = (ev: React.FocusEvent<HTMLInputElement>) => {
|
const onChange = (ev: React.FocusEvent<HTMLInputElement>) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user