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
5b35a21d
Commit
5b35a21d
authored
Jun 16, 2017
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dashboard_folders' of github.com:grafana/grafana into dashboard_folders
parents
0ad4a0fa
dd02bf7c
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
0 deletions
+25
-0
pkg/api/dashboard.go
+4
-0
pkg/api/dashboard_test.go
+20
-0
pkg/models/dashboards.go
+1
-0
No files found.
pkg/api/dashboard.go
View file @
5b35a21d
...
@@ -194,6 +194,10 @@ func PostDashboard(c *middleware.Context, cmd m.SaveDashboardCommand) Response {
...
@@ -194,6 +194,10 @@ func PostDashboard(c *middleware.Context, cmd m.SaveDashboardCommand) Response {
return
ApiError
(
403
,
"Does not have permission to save this dashboard"
,
nil
)
return
ApiError
(
403
,
"Does not have permission to save this dashboard"
,
nil
)
}
}
if
dash
.
IsFolder
&&
dash
.
ParentId
>
0
{
return
ApiError
(
400
,
m
.
ErrDashboardFolderCannotHaveParent
.
Error
(),
nil
)
}
// Check if Title is empty
// Check if Title is empty
if
dash
.
Title
==
""
{
if
dash
.
Title
==
""
{
return
ApiError
(
400
,
m
.
ErrDashboardTitleEmpty
.
Error
(),
nil
)
return
ApiError
(
400
,
m
.
ErrDashboardTitleEmpty
.
Error
(),
nil
)
...
...
pkg/api/dashboard_test.go
View file @
5b35a21d
...
@@ -132,6 +132,26 @@ func TestDashboardApiEndpoint(t *testing.T) {
...
@@ -132,6 +132,26 @@ func TestDashboardApiEndpoint(t *testing.T) {
CallPostDashboard
(
sc
)
CallPostDashboard
(
sc
)
So
(
sc
.
resp
.
Code
,
ShouldEqual
,
200
)
So
(
sc
.
resp
.
Code
,
ShouldEqual
,
200
)
})
})
Convey
(
"When saving a dashboard folder in another folder"
,
func
()
{
bus
.
AddHandler
(
"test"
,
func
(
query
*
models
.
GetDashboardQuery
)
error
{
query
.
Result
=
fakeDash
query
.
Result
.
IsFolder
=
true
return
nil
})
invalidCmd
:=
models
.
SaveDashboardCommand
{
Dashboard
:
simplejson
.
NewFromAny
(
map
[
string
]
interface
{}{
"parentId"
:
fakeDash
.
ParentId
,
"title"
:
fakeDash
.
Title
,
}),
}
Convey
(
"Should return an error"
,
func
()
{
postDashboardScenario
(
"When calling POST on"
,
"/api/dashboards"
,
"/api/dashboards"
,
role
,
invalidCmd
,
func
(
sc
*
scenarioContext
)
{
CallPostDashboard
(
sc
)
So
(
sc
.
resp
.
Code
,
ShouldEqual
,
400
)
})
})
})
})
})
})
})
...
...
pkg/models/dashboards.go
View file @
5b35a21d
...
@@ -16,6 +16,7 @@ var (
...
@@ -16,6 +16,7 @@ var (
ErrDashboardWithSameNameExists
=
errors
.
New
(
"A dashboard with the same name already exists"
)
ErrDashboardWithSameNameExists
=
errors
.
New
(
"A dashboard with the same name already exists"
)
ErrDashboardVersionMismatch
=
errors
.
New
(
"The dashboard has been changed by someone else"
)
ErrDashboardVersionMismatch
=
errors
.
New
(
"The dashboard has been changed by someone else"
)
ErrDashboardTitleEmpty
=
errors
.
New
(
"Dashboard title cannot be empty"
)
ErrDashboardTitleEmpty
=
errors
.
New
(
"Dashboard title cannot be empty"
)
ErrDashboardFolderCannotHaveParent
=
errors
.
New
(
"A Dashboard Folder cannot be added to another folder"
)
)
)
type
UpdatePluginDashboardError
struct
{
type
UpdatePluginDashboardError
struct
{
...
...
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