Commit fcd86fb2 by bergquist

make it easier for dashboards to generate ur;

parent 74ca6f6d
...@@ -105,7 +105,7 @@ func transformToDTOs(alerts []*models.Alert, c *middleware.Context) ([]*dtos.Ale ...@@ -105,7 +105,7 @@ func transformToDTOs(alerts []*models.Alert, c *middleware.Context) ([]*dtos.Ale
for _, alert := range alertDTOs { for _, alert := range alertDTOs {
for _, dash := range dashboardsQuery.Result { for _, dash := range dashboardsQuery.Result {
if alert.DashboardId == dash.Id { if alert.DashboardId == dash.Id {
alert.DashbboardUri = models.GetDashboardUrl(dash.Uid, dash.Slug) alert.DashbboardUri = dash.GenerateUrl()
break break
} }
} }
......
...@@ -162,6 +162,11 @@ func (dash *Dashboard) GetUrl() string { ...@@ -162,6 +162,11 @@ func (dash *Dashboard) GetUrl() string {
return GetDashboardFolderUrl(dash.IsFolder, dash.Uid, dash.Slug) 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 // 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 { func GetDashboardFolderUrl(isFolder bool, uid string, slug string) string {
if isFolder { if isFolder {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment