dashboards: add url property to dashboard meta and search api responses

#7883
This commit is contained in:
Marcus Efraimsson
2018-01-30 23:18:34 +01:00
parent 7ee691dc48
commit 9fb7b887db
7 changed files with 33 additions and 0 deletions
+12
View File
@@ -2,11 +2,13 @@ package models
import (
"errors"
"fmt"
"strings"
"time"
"github.com/gosimple/slug"
"github.com/grafana/grafana/pkg/components/simplejson"
"github.com/grafana/grafana/pkg/setting"
"github.com/grafana/grafana/pkg/util"
)
@@ -156,6 +158,16 @@ func SlugifyTitle(title string) string {
return slug.Make(strings.ToLower(title))
}
// GetDashboardUrl return the html url for a dashboard
func GetDashboardUrl(uid string, slug string) string {
return fmt.Sprintf("%s/d/%s/%s", setting.AppSubUrl, uid, slug)
}
// GetFolderUrl return the html url for a folder
func GetFolderUrl(folderUid string, slug string) string {
return fmt.Sprintf("%s/f/%v/%s", setting.AppSubUrl, folderUid, slug)
}
//
// COMMANDS
//