mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Plugins: Added hook to make it easier to track interactions in plugins (#56126)
* first stab at context away plugin tracking. * adding a plugin context and a hook to get hold of a tracker that always appends the plugin context information. * wip * improved the code a bit. * wip * Fixed type errors. * added datasource_uid to data sources. * fixed error message when trying to use hook outside of context. * small refactoring according to feedback. * using the correct provider for data source context. * check not needed. * enforcing the interaction name to start with grafana_plugin_ * exposing guards for the other context type. * added structure for writing reporter hook tests. * added some more tests. * added tests. * reverted back to inheritance between context types. * adding mock for getDataSourceSrv
This commit is contained in:
@@ -27,6 +27,8 @@ export const AnnotationSettingsEdit = ({ editIdx, dashboard }: Props) => {
|
||||
return getDataSourceSrv().get(annotation.datasource);
|
||||
}, [annotation.datasource]);
|
||||
|
||||
const dsi = getDataSourceSrv().getInstanceSettings(annotation.datasource);
|
||||
|
||||
const onUpdate = (annotation: AnnotationQuery) => {
|
||||
const list = [...dashboard.annotations.list];
|
||||
list.splice(editIdx, 1, annotation);
|
||||
@@ -115,8 +117,13 @@ export const AnnotationSettingsEdit = ({ editIdx, dashboard }: Props) => {
|
||||
</HorizontalGroup>
|
||||
</Field>
|
||||
<h3 className="page-heading">Query</h3>
|
||||
{ds?.annotations && (
|
||||
<StandardAnnotationQueryEditor datasource={ds} annotation={annotation} onChange={onUpdate} />
|
||||
{ds?.annotations && dsi && (
|
||||
<StandardAnnotationQueryEditor
|
||||
datasource={ds}
|
||||
datasourceInstanceSettings={dsi}
|
||||
annotation={annotation}
|
||||
onChange={onUpdate}
|
||||
/>
|
||||
)}
|
||||
{ds && !ds.annotations && <AngularEditorLoader datasource={ds} annotation={annotation} onChange={onUpdate} />}
|
||||
</FieldSet>
|
||||
|
||||
Reference in New Issue
Block a user