Bootdata: Expose grafanaBootData under /bootdata URL (#104258)
This commit is contained in:
@@ -294,8 +294,6 @@ var _ resource.ListObject = &DashboardList{}
|
||||
|
||||
// Copy methods for all subresource types
|
||||
|
||||
|
||||
|
||||
// DeepCopy creates a full deep copy of DashboardStatus
|
||||
func (s *DashboardStatus) DeepCopy() *DashboardStatus {
|
||||
cpy := &DashboardStatus{}
|
||||
|
||||
@@ -294,8 +294,6 @@ var _ resource.ListObject = &DashboardList{}
|
||||
|
||||
// Copy methods for all subresource types
|
||||
|
||||
|
||||
|
||||
// DeepCopy creates a full deep copy of DashboardStatus
|
||||
func (s *DashboardStatus) DeepCopy() *DashboardStatus {
|
||||
cpy := &DashboardStatus{}
|
||||
|
||||
@@ -11,8 +11,6 @@ import (
|
||||
"github.com/grafana/grafana-app-sdk/app"
|
||||
)
|
||||
|
||||
var ()
|
||||
|
||||
var appManifestData = app.ManifestData{
|
||||
AppName: "dashboard",
|
||||
Group: "dashboard.grafana.app",
|
||||
|
||||
@@ -92,6 +92,9 @@ func (hs *HTTPServer) registerRoutes() {
|
||||
panic(err) // ???
|
||||
}
|
||||
r.Get("/mtfe", index.HandleRequest)
|
||||
|
||||
// Temporarily expose the full bootdata via API
|
||||
r.Get("/bootdata", reqNoAuth, hs.GetBootdata)
|
||||
}
|
||||
|
||||
// authed views
|
||||
|
||||
+26
-26
@@ -7,33 +7,33 @@ import (
|
||||
)
|
||||
|
||||
type IndexViewData struct {
|
||||
User *CurrentUser
|
||||
Settings *FrontendSettingsDTO
|
||||
AppUrl string
|
||||
AppSubUrl string
|
||||
GoogleAnalyticsId string
|
||||
GoogleAnalytics4Id string
|
||||
GoogleAnalytics4SendManualPageViews bool
|
||||
GoogleTagManagerId string
|
||||
NavTree *navtree.NavTreeRoot
|
||||
BuildVersion string
|
||||
BuildCommit string
|
||||
ThemeType string
|
||||
NewGrafanaVersionExists bool
|
||||
NewGrafanaVersion string
|
||||
AppName string
|
||||
AppNameBodyClass string
|
||||
FavIcon template.URL
|
||||
AppleTouchIcon template.URL
|
||||
AppTitle string
|
||||
LoadingLogo template.URL
|
||||
CSPContent string
|
||||
CSPEnabled bool
|
||||
IsDevelopmentEnv bool
|
||||
User *CurrentUser `json:"user"`
|
||||
Settings *FrontendSettingsDTO `json:"settings"`
|
||||
AppUrl string `json:"-"`
|
||||
AppSubUrl string `json:"-"`
|
||||
GoogleAnalyticsId string `json:"-"`
|
||||
GoogleAnalytics4Id string `json:"-"`
|
||||
GoogleAnalytics4SendManualPageViews bool `json:"-"`
|
||||
GoogleTagManagerId string `json:"-"`
|
||||
NavTree *navtree.NavTreeRoot `json:"navtree"`
|
||||
BuildVersion string `json:"-"`
|
||||
BuildCommit string `json:"-"`
|
||||
ThemeType string `json:"-"`
|
||||
NewGrafanaVersionExists bool `json:"-"`
|
||||
NewGrafanaVersion string `json:"-"`
|
||||
AppName string `json:"-"`
|
||||
AppNameBodyClass string `json:"-"`
|
||||
FavIcon template.URL `json:"-"`
|
||||
AppleTouchIcon template.URL `json:"-"`
|
||||
AppTitle string `json:"-"`
|
||||
LoadingLogo template.URL `json:"-"`
|
||||
CSPContent string `json:"-"`
|
||||
CSPEnabled bool `json:"-"`
|
||||
IsDevelopmentEnv bool `json:"-"`
|
||||
// Nonce is a cryptographic identifier for use with Content Security Policy.
|
||||
Nonce string
|
||||
NewsFeedEnabled bool
|
||||
Assets *EntryPointAssets // Includes CDN info
|
||||
Nonce string `json:"-"`
|
||||
NewsFeedEnabled bool `json:"-"`
|
||||
Assets *EntryPointAssets `json:"assets"` // Includes CDN info
|
||||
}
|
||||
|
||||
type EntryPointAssets struct {
|
||||
|
||||
@@ -28,6 +28,18 @@ import (
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
)
|
||||
|
||||
// GetBootdataAPI returns the same data we currently have rendered into index.html
|
||||
// NOTE: this should not be added to the public API docs, and is useful for a transition
|
||||
// towards a fully static index.html -- this will likely be replaced with multiple calls
|
||||
func (hs *HTTPServer) GetBootdata(c *contextmodel.ReqContext) {
|
||||
data, err := hs.setIndexViewData(c)
|
||||
if err != nil {
|
||||
c.Handle(hs.Cfg, http.StatusInternalServerError, "Failed to get settings", err)
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, data)
|
||||
}
|
||||
|
||||
// Returns a file that is easy to check for changes
|
||||
// Any changes to the file means we should refresh the frontend
|
||||
func (hs *HTTPServer) GetFrontendAssets(c *contextmodel.ReqContext) {
|
||||
|
||||
Reference in New Issue
Block a user