mirror of
https://github.com/grafana/grafana.git
synced 2025-02-15 01:53:33 -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) => {
|
||||
onUpdate({
|
||||
...annotation,
|
||||
datasource: getDataSourceRef(ds),
|
||||
});
|
||||
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({
|
||||
...annotation,
|
||||
datasource: dsRef,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const onChange = (ev: React.FocusEvent<HTMLInputElement>) => {
|
||||
|
Loading…
Reference in New Issue
Block a user