Dashboard Library: Display datasource plugin dashboards in empty page (#111279)
This commit is contained in:
@@ -34,7 +34,7 @@ func ProvideService(routeRegister routing.RouteRegister,
|
||||
features: features,
|
||||
}
|
||||
|
||||
dashboardImportAPI := api.New(s, quotaService, pluginStore, ac)
|
||||
dashboardImportAPI := api.New(s, quotaService, pluginStore, ac, features)
|
||||
dashboardImportAPI.RegisterAPIEndpoints(routeRegister)
|
||||
|
||||
return s
|
||||
@@ -48,7 +48,7 @@ type ImportDashboardService struct {
|
||||
features featuremgmt.FeatureToggles
|
||||
}
|
||||
|
||||
func (s *ImportDashboardService) ImportDashboard(ctx context.Context, req *dashboardimport.ImportDashboardRequest) (*dashboardimport.ImportDashboardResponse, error) {
|
||||
func (s *ImportDashboardService) InterpolateDashboard(ctx context.Context, req *dashboardimport.ImportDashboardRequest) (*simplejson.Json, error) {
|
||||
var draftDashboard *dashboards.Dashboard
|
||||
if req.PluginId != "" {
|
||||
loadReq := &plugindashboards.LoadPluginDashboardRequest{
|
||||
@@ -70,6 +70,15 @@ func (s *ImportDashboardService) ImportDashboard(ctx context.Context, req *dashb
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return generatedDash, nil
|
||||
}
|
||||
|
||||
func (s *ImportDashboardService) ImportDashboard(ctx context.Context, req *dashboardimport.ImportDashboardRequest) (*dashboardimport.ImportDashboardResponse, error) {
|
||||
generatedDash, err := s.InterpolateDashboard(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Maintain backwards compatibility by transforming array of library elements to map
|
||||
libraryElements := generatedDash.Get("__elements")
|
||||
libElementsArr, err := libraryElements.Array()
|
||||
|
||||
Reference in New Issue
Block a user