Schema: Add schema for library panels (#62169)
This commit is contained in:
@@ -13,6 +13,7 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/grafana/grafana/pkg/kinds/dashboard"
|
||||
"github.com/grafana/grafana/pkg/kinds/librarypanel"
|
||||
"github.com/grafana/grafana/pkg/kinds/playlist"
|
||||
"github.com/grafana/grafana/pkg/kinds/preferences"
|
||||
"github.com/grafana/grafana/pkg/kinds/publicdashboard"
|
||||
@@ -35,6 +36,7 @@ import (
|
||||
type Base struct {
|
||||
all []kindsys.Core
|
||||
dashboard *dashboard.Kind
|
||||
librarypanel *librarypanel.Kind
|
||||
playlist *playlist.Kind
|
||||
preferences *preferences.Kind
|
||||
publicdashboard *publicdashboard.Kind
|
||||
@@ -45,6 +47,7 @@ type Base struct {
|
||||
// type guards
|
||||
var (
|
||||
_ kindsys.Core = &dashboard.Kind{}
|
||||
_ kindsys.Core = &librarypanel.Kind{}
|
||||
_ kindsys.Core = &playlist.Kind{}
|
||||
_ kindsys.Core = &preferences.Kind{}
|
||||
_ kindsys.Core = &publicdashboard.Kind{}
|
||||
@@ -57,6 +60,11 @@ func (b *Base) Dashboard() *dashboard.Kind {
|
||||
return b.dashboard
|
||||
}
|
||||
|
||||
// LibraryPanel returns the [kindsys.Interface] implementation for the librarypanel kind.
|
||||
func (b *Base) LibraryPanel() *librarypanel.Kind {
|
||||
return b.librarypanel
|
||||
}
|
||||
|
||||
// Playlist returns the [kindsys.Interface] implementation for the playlist kind.
|
||||
func (b *Base) Playlist() *playlist.Kind {
|
||||
return b.playlist
|
||||
@@ -92,6 +100,12 @@ func doNewBase(rt *thema.Runtime) *Base {
|
||||
}
|
||||
reg.all = append(reg.all, reg.dashboard)
|
||||
|
||||
reg.librarypanel, err = librarypanel.NewKind(rt)
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("error while initializing the librarypanel Kind: %s", err))
|
||||
}
|
||||
reg.all = append(reg.all, reg.librarypanel)
|
||||
|
||||
reg.playlist, err = playlist.NewKind(rt)
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("error while initializing the playlist Kind: %s", err))
|
||||
|
||||
Reference in New Issue
Block a user