Publicdasboards: Add annotations support (#56413)

adds annotations support for public dashboards
This commit is contained in:
owensmallwood
2022-10-18 19:48:20 -06:00
committed by GitHub
parent cc6245df8e
commit b2408dd7c5
21 changed files with 872 additions and 47 deletions
+8 -1
View File
@@ -84,6 +84,13 @@ seqs: [
///////////////////////////////////////
// Definitions (referenced above) are declared below
#AnnotationTarget: {
limit: int64
matchAny: bool
tags: [...string]
type: string
}
// TODO docs
// FROM: AnnotationQuery in grafana-data/src/types/annotations.ts
#AnnotationQuery: {
@@ -106,7 +113,7 @@ seqs: [
// Query for annotation data.
rawQuery?: string @grafanamaturity(NeedsExpertReview)
showIn: uint8 | *0 @grafanamaturity(NeedsExpertReview)
target?: #Target @grafanamaturity(NeedsExpertReview) // TODO currently a generic in AnnotationQuery
target?: #AnnotationTarget @grafanamaturity(NeedsExpertReview)
} @cuetsy(kind="interface")
// FROM: packages/grafana-data/src/types/templateVars.ts
+14 -11
View File
@@ -343,18 +343,21 @@ type AnnotationQuery struct {
Name *string `json:"name,omitempty"`
// Query for annotation data.
RawQuery *string `json:"rawQuery,omitempty"`
ShowIn int `json:"showIn"`
RawQuery *string `json:"rawQuery,omitempty"`
ShowIn int `json:"showIn"`
Target *AnnotationTarget `json:"target,omitempty"`
Type string `json:"type"`
}
// Schema for panel targets is specified by datasource
// plugins. We use a placeholder definition, which the Go
// schema loader either left open/as-is with the Base
// variant of the Model and Panel families, or filled
// with types derived from plugins in the Instance variant.
// When working directly from CUE, importers can extend this
// type directly to achieve the same effect.
Target *Target `json:"target,omitempty"`
Type string `json:"type"`
// AnnotationTarget is the Go representation of a dashboard.AnnotationTarget.
//
// THIS TYPE IS INTENDED FOR INTERNAL USE BY THE GRAFANA BACKEND, AND IS SUBJECT TO BREAKING CHANGES.
// Equivalent Go types at stable import paths are provided in https://github.com/grafana/grok.
type AnnotationTarget struct {
Limit int64 `json:"limit"`
MatchAny bool `json:"matchAny"`
Tags []string `json:"tags"`
Type string `json:"type"`
}
// 0 for no shared crosshair or tooltip (default).