mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
PublicDashboards: Modal warns when using unsupported datasources (#58926)
Adds warning to pubdash modal when dashboard uses datasources not supported by pubdash
This commit is contained in:
@@ -10,30 +10,27 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/publicdashboards/commands/generate_datasources"
|
||||
)
|
||||
|
||||
var goTemplate = `
|
||||
var tsDatasourcesTemplate = `
|
||||
// Code generated by go generate; DO NOT EDIT.
|
||||
|
||||
package publicdashboards
|
||||
|
||||
var SupportedDatasources = map[string]bool{
|
||||
export const supportedDatasources = new Set<string>([
|
||||
{{- range . }}
|
||||
"{{ printf "%s" . }}": true,
|
||||
'{{ printf "%s" . }}',
|
||||
{{- end }}
|
||||
}
|
||||
])
|
||||
`
|
||||
|
||||
func main() {
|
||||
baseUrl := "https://grafana.com"
|
||||
slugs, err := generate_datasources.GetCompatibleDatasources(baseUrl)
|
||||
tsTemplate := template.Must(template.New("").Parse(tsDatasourcesTemplate))
|
||||
|
||||
myTemplate := template.Must(template.New("").Parse(goTemplate))
|
||||
|
||||
file, err := os.Create("supported_datasources_gen.go")
|
||||
// Generate supported datasources for Typescript
|
||||
tsFile, err := os.Create("./../../../public/app/features/dashboard/components/ShareModal/SharePublicDashboard/SupportedPubdashDatasources.ts")
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
||||
err = myTemplate.Execute(file, slugs)
|
||||
err = tsTemplate.Execute(tsFile, slugs)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user