diff --git a/pkg/api/alerting.go b/pkg/api/alerting.go index dee1b7451f6..1fc3d893681 100644 --- a/pkg/api/alerting.go +++ b/pkg/api/alerting.go @@ -105,7 +105,7 @@ func transformToDTOs(alerts []*models.Alert, c *middleware.Context) ([]*dtos.Ale for _, alert := range alertDTOs { for _, dash := range dashboardsQuery.Result { if alert.DashboardId == dash.Id { - alert.DashbboardUri = models.GetDashboardUrl(dash.Uid, dash.Slug) + alert.DashbboardUri = dash.GenerateUrl() break } } diff --git a/pkg/models/dashboards.go b/pkg/models/dashboards.go index 5675f494411..089a98c4f00 100644 --- a/pkg/models/dashboards.go +++ b/pkg/models/dashboards.go @@ -162,6 +162,11 @@ func (dash *Dashboard) GetUrl() string { return GetDashboardFolderUrl(dash.IsFolder, dash.Uid, dash.Slug) } +// Return the html url for a dashboard +func (dash *Dashboard) GenerateUrl() string { + return GetDashboardUrl(dash.Uid, dash.Slug) +} + // GetDashboardFolderUrl return the html url for a folder if it's folder, otherwise for a dashboard func GetDashboardFolderUrl(isFolder bool, uid string, slug string) string { if isFolder {