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
5c89c4b2
Commit
5c89c4b2
authored
Jun 02, 2017
by
Daniel Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP: dashlist in template for new folder
parent
533f2d3d
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
62 additions
and
7 deletions
+62
-7
pkg/api/dashboard.go
+1
-1
pkg/models/dashboards_test.go
+23
-0
public/app/core/services/backend_srv.ts
+36
-3
public/app/features/dashboard/folder_modal/folder.ts
+1
-1
public/app/plugins/panel/dashlist/editor.html
+1
-1
public/app/plugins/panel/dashlist/module.ts
+0
-1
No files found.
pkg/api/dashboard.go
View file @
5c89c4b2
...
...
@@ -185,7 +185,7 @@ func PostDashboard(c *middleware.Context, cmd m.SaveDashboardCommand) Response {
}
c
.
TimeRequest
(
metrics
.
M_Api_Dashboard_Save
)
return
Json
(
200
,
util
.
DynMap
{
"status"
:
"success"
,
"slug"
:
cmd
.
Result
.
Slug
,
"version"
:
cmd
.
Result
.
Version
})
return
Json
(
200
,
util
.
DynMap
{
"status"
:
"success"
,
"slug"
:
cmd
.
Result
.
Slug
,
"version"
:
cmd
.
Result
.
Version
,
"id"
:
cmd
.
Result
.
Id
})
}
func
canEditDashboard
(
role
m
.
RoleType
)
bool
{
...
...
pkg/models/dashboards_test.go
View file @
5c89c4b2
...
...
@@ -28,4 +28,27 @@ func TestDashboardModel(t *testing.T) {
})
})
Convey
(
"Given a new dashboard folder"
,
t
,
func
()
{
json
:=
simplejson
.
New
()
json
.
Set
(
"title"
,
"test dash"
)
cmd
:=
&
SaveDashboardCommand
{
Dashboard
:
json
,
IsFolder
:
true
}
dash
:=
cmd
.
GetDashboardModel
()
Convey
(
"Should set IsFolder to true"
,
func
()
{
So
(
dash
.
IsFolder
,
ShouldBeTrue
)
})
})
Convey
(
"Given a child dashboard"
,
t
,
func
()
{
json
:=
simplejson
.
New
()
json
.
Set
(
"title"
,
"test dash"
)
cmd
:=
&
SaveDashboardCommand
{
Dashboard
:
json
,
ParentId
:
1
}
dash
:=
cmd
.
GetDashboardModel
()
Convey
(
"Should set ParentId"
,
func
()
{
So
(
dash
.
ParentId
,
ShouldEqual
,
1
)
})
})
}
public/app/core/services/backend_srv.ts
View file @
5c89c4b2
...
...
@@ -211,12 +211,45 @@ export class BackendSrv {
});
}
sav
eDashboardFolder
(
name
)
{
creat
eDashboardFolder
(
name
)
{
const
dash
=
{
title
:
name
title
:
name
,
editable
:
false
,
hideControls
:
true
,
rows
:
[
{
panels
:
[
{
folderId
:
0
,
headings
:
false
,
id
:
1
,
limit
:
1000
,
links
:
[],
query
:
''
,
recent
:
false
,
search
:
true
,
span
:
12
,
starred
:
false
,
tags
:
[],
title
:
'Dashboards'
,
type
:
'dashlist'
}
],
showTitle
:
false
,
title
:
'Dashboard List'
,
titleSize
:
'h6'
}
]
};
return
this
.
post
(
'/api/dashboards/db/'
,
{
dashboard
:
dash
,
isFolder
:
true
,
overwrite
:
false
});
return
this
.
post
(
'/api/dashboards/db/'
,
{
dashboard
:
dash
,
isFolder
:
true
,
overwrite
:
false
})
.
then
(
res
=>
{
return
this
.
getDashboard
(
'db'
,
res
.
slug
);
})
.
then
(
res
=>
{
res
.
dashboard
.
rows
[
0
].
panels
[
0
].
folderId
=
res
.
dashboard
.
id
;
return
this
.
saveDashboard
(
res
.
dashboard
,
{
overwrite
:
false
});
});
}
}
...
...
public/app/features/dashboard/folder_modal/folder.ts
View file @
5c89c4b2
...
...
@@ -19,7 +19,7 @@ export class FolderCtrl {
const
title
=
this
.
title
.
trim
();
return
this
.
backendSrv
.
sav
eDashboardFolder
(
title
).
then
((
result
)
=>
{
return
this
.
backendSrv
.
creat
eDashboardFolder
(
title
).
then
((
result
)
=>
{
appEvents
.
emit
(
'alert-success'
,
[
'Dashboard saved'
,
'Saved as '
+
title
]);
appEvents
.
emit
(
'dashboard-saved'
,
result
);
...
...
public/app/plugins/panel/dashlist/editor.html
View file @
5c89c4b2
...
...
@@ -24,7 +24,7 @@
<div
class=
"gf-form"
>
<span
class=
"gf-form-label width-6"
>
Folder
</span>
<folder-picker
on-change=
"ctrl.onFolderChange"
root-folder-name=
"All"
></folder-picker>
<folder-picker
selected-folder=
"ctrl.panel.folderId"
on-change=
"ctrl.onFolderChange"
root-folder-name=
"All"
></folder-picker>
</div>
<div
class=
"gf-form"
>
...
...
public/app/plugins/panel/dashlist/module.ts
View file @
5c89c4b2
...
...
@@ -12,7 +12,6 @@ class DashListCtrl extends PanelCtrl {
modes
:
any
[];
panelDefaults
=
{
folder
:
''
,
query
:
''
,
limit
:
10
,
tags
:
[],
...
...
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