Annotations: Support filtering the target panels (#66325)

Co-authored-by: Adela Almasan <adela.almasan@grafana.com>
Co-authored-by: nmarrs <nathanielmarrs@gmail.com>
This commit is contained in:
Ryan McKinley
2023-04-18 13:39:30 -07:00
committed by GitHub
parent a384194e15
commit 9452c0d718
32 changed files with 1042 additions and 235 deletions

View File

@@ -85,10 +85,18 @@ lineage: seqs: [
templating?: {
list?: [...#VariableModel] @grafanamaturity(NeedsExpertReview)
}
// TODO docs
annotations?: {
// TODO -- should not be a public interface on its own, but required for Veneer
#AnnotationContainer: {
// annoying... but required so that the list is defined using the nested Veneer
@grafana(TSVeneer="type")
list?: [...#AnnotationQuery] @grafanamaturity(NeedsExpertReview)
}
} @cuetsy(kind="interface")
// TODO docs
annotations?: #AnnotationContainer
// TODO docs
links?: [...#DashboardLink] @grafanamaturity(NeedsExpertReview)
@@ -97,39 +105,72 @@ lineage: seqs: [
///////////////////////////////////////
// Definitions (referenced above) are declared below
// TODO docs
// TODO: this should be a regular DataQuery that depends on the selected dashboard
// these match the properties of the "grafana" datasouce that is default in most dashboards
#AnnotationTarget: {
limit: int64
// Only required/valid for the grafana datasource...
// but code+tests is already depending on it so hard to change
limit: int64
// Only required/valid for the grafana datasource...
// but code+tests is already depending on it so hard to change
matchAny: bool
// Only required/valid for the grafana datasource...
// but code+tests is already depending on it so hard to change
tags: [...string]
// Only required/valid for the grafana datasource...
// but code+tests is already depending on it so hard to change
type: string
... // datasource will stick their raw DataQuery here
} @cuetsy(kind="interface") @grafanamaturity(NeedsExpertReview)
#AnnotationPanelFilter: {
// Should the specified panels be included or excluded
exclude?: bool | *false
// Panel IDs that should be included or excluded
ids: [...uint8]
} @cuetsy(kind="interface")
// TODO docs
// FROM: AnnotationQuery in grafana-data/src/types/annotations.ts
#AnnotationQuery: {
// Datasource to use for annotation.
@grafana(TSVeneer="type")
// Name of annotation.
name: string
// TODO: Should be DataSourceRef
datasource: {
type?: string
uid?: string
} @grafanamaturity(NeedsExpertReview)
// Whether annotation is enabled.
enable: bool | *true @grafanamaturity(NeedsExpertReview)
// Name of annotation.
name?: string @grafanamaturity(NeedsExpertReview)
builtIn: uint8 | *0 @grafanamaturity(NeedsExpertReview) // TODO should this be persisted at all?
// Whether to hide annotation.
hide?: bool | *false @grafanamaturity(NeedsExpertReview)
// Annotation icon color.
iconColor?: string @grafanamaturity(NeedsExpertReview)
type: string | *"dashboard" @grafanamaturity(NeedsExpertReview)
// Query for annotation data.
rawQuery?: string @grafanamaturity(NeedsExpertReview)
showIn: uint8 | *0 @grafanamaturity(NeedsExpertReview)
target?: #AnnotationTarget @grafanamaturity(NeedsExpertReview)
// When enabled the annotation query is issued with every dashboard refresh
enable: bool | *true
// Annotation queries can be toggled on or off at the top of the dashboard.
// When hide is true, the toggle is not shown in the dashboard.
hide?: bool | *false
// Color to use for the annotation event markers
iconColor: string
// Optionally
filter?: #AnnotationPanelFilter
// TODO.. this should just be a normal query target
target?: #AnnotationTarget
// TODO -- this should not exist here, it is based on the --grafana-- datasource
type?: string @grafanamaturity(NeedsExpertReview)
// unless datasources have migrated to the target+mapping,
// they just spread their query into the base object :(
...
} @cuetsy(kind="interface")
#LoadingState: "NotStarted" | "Loading" | "Streaming" | "Done" | "Error" @cuetsy(kind="enum") @grafanamaturity(NeedsExpertReview)
// FROM: packages/grafana-data/src/types/templateVars.ts
// TODO docs
// TODO what about what's in public/app/features/types.ts?