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
6d1e3613
Unverified
Commit
6d1e3613
authored
Mar 14, 2018
by
Carl Bergquist
Committed by
GitHub
Mar 14, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11246 from grafana/11227_import
dashboard: fix import dashboard with alert rule(s)
parents
a8918047
87284d28
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
1 deletions
+20
-1
pkg/plugins/dashboard_importer.go
+1
-1
pkg/services/dashboards/dashboard_service.go
+19
-0
No files found.
pkg/plugins/dashboard_importer.go
View file @
6d1e3613
...
@@ -80,7 +80,7 @@ func ImportDashboard(cmd *ImportDashboardCommand) error {
...
@@ -80,7 +80,7 @@ func ImportDashboard(cmd *ImportDashboardCommand) error {
User
:
cmd
.
User
,
User
:
cmd
.
User
,
}
}
savedDash
,
err
:=
dashboards
.
NewService
()
.
Save
Dashboard
(
dto
)
savedDash
,
err
:=
dashboards
.
NewService
()
.
Import
Dashboard
(
dto
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
...
...
pkg/services/dashboards/dashboard_service.go
View file @
6d1e3613
...
@@ -13,6 +13,7 @@ import (
...
@@ -13,6 +13,7 @@ import (
// DashboardService service for operating on dashboards
// DashboardService service for operating on dashboards
type
DashboardService
interface
{
type
DashboardService
interface
{
SaveDashboard
(
dto
*
SaveDashboardDTO
)
(
*
models
.
Dashboard
,
error
)
SaveDashboard
(
dto
*
SaveDashboardDTO
)
(
*
models
.
Dashboard
,
error
)
ImportDashboard
(
dto
*
SaveDashboardDTO
)
(
*
models
.
Dashboard
,
error
)
}
}
// DashboardProvisioningService service for operating on provisioned dashboards
// DashboardProvisioningService service for operating on provisioned dashboards
...
@@ -214,6 +215,20 @@ func (dr *dashboardServiceImpl) SaveDashboard(dto *SaveDashboardDTO) (*models.Da
...
@@ -214,6 +215,20 @@ func (dr *dashboardServiceImpl) SaveDashboard(dto *SaveDashboardDTO) (*models.Da
return
cmd
.
Result
,
nil
return
cmd
.
Result
,
nil
}
}
func
(
dr
*
dashboardServiceImpl
)
ImportDashboard
(
dto
*
SaveDashboardDTO
)
(
*
models
.
Dashboard
,
error
)
{
cmd
,
err
:=
dr
.
buildSaveDashboardCommand
(
dto
,
false
)
if
err
!=
nil
{
return
nil
,
err
}
err
=
bus
.
Dispatch
(
cmd
)
if
err
!=
nil
{
return
nil
,
err
}
return
cmd
.
Result
,
nil
}
type
FakeDashboardService
struct
{
type
FakeDashboardService
struct
{
SaveDashboardResult
*
models
.
Dashboard
SaveDashboardResult
*
models
.
Dashboard
SaveDashboardError
error
SaveDashboardError
error
...
@@ -230,6 +245,10 @@ func (s *FakeDashboardService) SaveDashboard(dto *SaveDashboardDTO) (*models.Das
...
@@ -230,6 +245,10 @@ func (s *FakeDashboardService) SaveDashboard(dto *SaveDashboardDTO) (*models.Das
return
s
.
SaveDashboardResult
,
s
.
SaveDashboardError
return
s
.
SaveDashboardResult
,
s
.
SaveDashboardError
}
}
func
(
s
*
FakeDashboardService
)
ImportDashboard
(
dto
*
SaveDashboardDTO
)
(
*
models
.
Dashboard
,
error
)
{
return
s
.
SaveDashboard
(
dto
)
}
func
MockDashboardService
(
mock
*
FakeDashboardService
)
{
func
MockDashboardService
(
mock
*
FakeDashboardService
)
{
NewService
=
func
()
DashboardService
{
NewService
=
func
()
DashboardService
{
return
mock
return
mock
...
...
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