mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
make it easier for dashboards to generate ur;
This commit is contained in:
parent
74ca6f6dbf
commit
fcd86fb24f
@ -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 {
|
|||||||
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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user