소스 검색

make it easier for dashboards to generate ur;

bergquist 8 년 전
부모
커밋
fcd86fb24f
2개의 변경된 파일6개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      pkg/api/alerting.go
  2. 5 0
      pkg/models/dashboards.go

+ 1 - 1
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
 			}
 		}

+ 5 - 0
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 {