Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
208cbd11
Unverified
Commit
208cbd11
authored
Mar 28, 2018
by
Daniel Lee
Committed by
GitHub
Mar 28, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11405 from bergquist/alert_link
alert: fixes broken link back to grafana
parents
36adce17
55967075
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
3 deletions
+16
-3
pkg/models/dashboards.go
+3
-3
pkg/models/dashboards_test.go
+13
-0
No files found.
pkg/models/dashboards.go
View file @
208cbd11
...
...
@@ -209,14 +209,14 @@ func GetDashboardFolderUrl(isFolder bool, uid string, slug string) string {
return
GetDashboardUrl
(
uid
,
slug
)
}
//
R
eturn the html url for a dashboard
//
GetDashboardUrl r
eturn the html url for a dashboard
func
GetDashboardUrl
(
uid
string
,
slug
string
)
string
{
return
fmt
.
Sprintf
(
"%s/d/%s/%s"
,
setting
.
AppSubUrl
,
uid
,
slug
)
}
//
R
eturn the full url for a dashboard
//
GetFullDashboardUrl r
eturn the full url for a dashboard
func
GetFullDashboardUrl
(
uid
string
,
slug
string
)
string
{
return
fmt
.
Sprintf
(
"%s
%s"
,
setting
.
AppUrl
,
GetDashboardUrl
(
uid
,
slug
)
)
return
fmt
.
Sprintf
(
"%s
d/%s/%s"
,
setting
.
AppUrl
,
uid
,
slug
)
}
// GetFolderUrl return the html url for a folder
...
...
pkg/models/dashboards_test.go
View file @
208cbd11
...
...
@@ -4,11 +4,24 @@ import (
"testing"
"github.com/grafana/grafana/pkg/components/simplejson"
"github.com/grafana/grafana/pkg/setting"
.
"github.com/smartystreets/goconvey/convey"
)
func
TestDashboardModel
(
t
*
testing
.
T
)
{
Convey
(
"Generate full dashboard url"
,
t
,
func
()
{
setting
.
AppUrl
=
"http://grafana.local/"
fullUrl
:=
GetFullDashboardUrl
(
"uid"
,
"my-dashboard"
)
So
(
fullUrl
,
ShouldEqual
,
"http://grafana.local/d/uid/my-dashboard"
)
})
Convey
(
"Generate relative dashboard url"
,
t
,
func
()
{
setting
.
AppUrl
=
""
fullUrl
:=
GetDashboardUrl
(
"uid"
,
"my-dashboard"
)
So
(
fullUrl
,
ShouldEqual
,
"/d/uid/my-dashboard"
)
})
Convey
(
"When generating slug"
,
t
,
func
()
{
dashboard
:=
NewDashboard
(
"Grafana Play Home"
)
dashboard
.
UpdateSlug
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment