diff --git a/pkg/services/publicdashboards/models/models.go b/pkg/services/publicdashboards/models/models.go index 5051599df82..f773e763f83 100644 --- a/pkg/services/publicdashboards/models/models.go +++ b/pkg/services/publicdashboards/models/models.go @@ -61,6 +61,10 @@ var ( Reason: "bad Request", StatusCode: 400, } + ErrNoPanelQueriesFound = PublicDashboardErr{ + Reason: "failed to extract queries from panel", + StatusCode: 400, + } ) type PublicDashboard struct { diff --git a/pkg/services/publicdashboards/service/query.go b/pkg/services/publicdashboards/service/query.go index 0ab3ac969b9..46fd6589cb7 100644 --- a/pkg/services/publicdashboards/service/query.go +++ b/pkg/services/publicdashboards/service/query.go @@ -131,7 +131,7 @@ func (pd *PublicDashboardServiceImpl) GetQueryDataResponse(ctx context.Context, } if len(metricReq.Queries) == 0 { - return nil, nil + return nil, models.ErrNoPanelQueriesFound } anonymousUser := buildAnonymousUser(ctx, dashboard) diff --git a/public/app/features/dashboard/services/PublicDashboardDataSource.ts b/public/app/features/dashboard/services/PublicDashboardDataSource.ts index 7d299bba9b0..c57d8b7effe 100644 --- a/public/app/features/dashboard/services/PublicDashboardDataSource.ts +++ b/public/app/features/dashboard/services/PublicDashboardDataSource.ts @@ -59,7 +59,7 @@ export class PublicDashboardDataSource extends DataSourceApi