Alerting: Fix changing datasource and creating new query not using defaults. (#63092)
* Set default query when changing data source or adding new alert query * Set default query when creating new alert rule * Set fefault query for cloud and recording rules * Create hook for getting defaults in AlertRuleForm * fixing tests * Use conditionals with 'if' for more clarity and rename lazy to async * Add loading indicator for default queries * Fix tests * Make newModel a sync method and fix tests error * Use useAsync instead of useEffect for an async call
This commit is contained in:
@@ -19,5 +19,12 @@ export function getDataSourceSrv() {
|
||||
return {
|
||||
getList: () => [ds1],
|
||||
getInstanceSettings: () => ds1,
|
||||
get: () =>
|
||||
Promise.resolve({
|
||||
filterQuery: () => true,
|
||||
getDefaultQuery: () => ({
|
||||
expr: 'vector(1)',
|
||||
}),
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user