Slugify: Replace gosimple/slug with a simple function (#59517)
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/grafana/grafana/pkg/infra/log"
|
||||
"github.com/grafana/grafana/pkg/infra/slugify"
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
"github.com/grafana/grafana/pkg/services/dashboards"
|
||||
alert_models "github.com/grafana/grafana/pkg/services/ngalert/models"
|
||||
@@ -99,7 +100,7 @@ func (prov *defaultAlertRuleProvisioner) provisionRule(
|
||||
func (prov *defaultAlertRuleProvisioner) getOrCreateFolderUID(
|
||||
ctx context.Context, folderName string, orgID int64) (string, error) {
|
||||
cmd := &models.GetDashboardQuery{
|
||||
Slug: models.SlugifyTitle(folderName),
|
||||
Slug: slugify.Slugify(folderName),
|
||||
OrgId: orgID,
|
||||
}
|
||||
err := prov.dashboardService.GetDashboard(ctx, cmd)
|
||||
|
||||
@@ -13,6 +13,7 @@ import (
|
||||
|
||||
"github.com/grafana/grafana/pkg/components/simplejson"
|
||||
"github.com/grafana/grafana/pkg/infra/log"
|
||||
"github.com/grafana/grafana/pkg/infra/slugify"
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
"github.com/grafana/grafana/pkg/services/accesscontrol"
|
||||
"github.com/grafana/grafana/pkg/services/dashboards"
|
||||
@@ -299,7 +300,7 @@ func (fr *FileReader) getOrCreateFolderID(ctx context.Context, cfg *config, serv
|
||||
return 0, ErrFolderNameMissing
|
||||
}
|
||||
|
||||
cmd := &models.GetDashboardQuery{Slug: models.SlugifyTitle(folderName), OrgId: cfg.OrgID}
|
||||
cmd := &models.GetDashboardQuery{Slug: slugify.Slugify(folderName), OrgId: cfg.OrgID}
|
||||
err := fr.dashboardStore.GetDashboard(ctx, cmd)
|
||||
|
||||
if err != nil && !errors.Is(err, dashboards.ErrDashboardNotFound) {
|
||||
|
||||
Reference in New Issue
Block a user