mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Move dashboard models to dashboard pkg (#61458)
* Copy dashboard models to dashboard pkg * Use some models from current pkg instead of models * Adjust api pkg * Adjust pkg services * Fix lint
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
package validation
|
||||
|
||||
import (
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
"github.com/grafana/grafana/pkg/services/dashboards"
|
||||
. "github.com/grafana/grafana/pkg/services/publicdashboards/models"
|
||||
"github.com/grafana/grafana/pkg/tsdb/legacydata"
|
||||
)
|
||||
|
||||
func ValidatePublicDashboard(dto *SavePublicDashboardDTO, dashboard *models.Dashboard) error {
|
||||
func ValidatePublicDashboard(dto *SavePublicDashboardDTO, dashboard *dashboards.Dashboard) error {
|
||||
if hasTemplateVariables(dashboard) {
|
||||
return ErrPublicDashboardHasTemplateVariables.Errorf("ValidateSavePublicDashboard: public dashboard has template variables")
|
||||
}
|
||||
@@ -14,7 +14,7 @@ func ValidatePublicDashboard(dto *SavePublicDashboardDTO, dashboard *models.Dash
|
||||
return nil
|
||||
}
|
||||
|
||||
func hasTemplateVariables(dashboard *models.Dashboard) bool {
|
||||
func hasTemplateVariables(dashboard *dashboards.Dashboard) bool {
|
||||
templateVariables := dashboard.Data.Get("templating").Get("list").MustArray()
|
||||
|
||||
return len(templateVariables) > 0
|
||||
|
||||
Reference in New Issue
Block a user