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
69c5efcf
Unverified
Commit
69c5efcf
authored
Mar 25, 2020
by
huanggze
Committed by
GitHub
Mar 25, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup: move interface ProvisioningService into provisioning package (#23061)
parent
0870ccea
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
35 deletions
+37
-35
pkg/api/dashboard_test.go
+2
-1
pkg/api/http_server.go
+16
-23
pkg/services/provisioning/dashboards/dashboard.go
+9
-0
pkg/services/provisioning/provisioning.go
+9
-10
pkg/services/provisioning/provisioning_test.go
+1
-1
No files found.
pkg/api/dashboard_test.go
View file @
69c5efcf
...
...
@@ -987,7 +987,8 @@ func TestDashboardApiEndpoint(t *testing.T) {
})
}
func
GetDashboardShouldReturn200WithConfig
(
sc
*
scenarioContext
,
provisioningService
ProvisioningService
)
dtos
.
DashboardFullWithMeta
{
func
GetDashboardShouldReturn200WithConfig
(
sc
*
scenarioContext
,
provisioningService
provisioning
.
ProvisioningService
)
dtos
.
DashboardFullWithMeta
{
if
provisioningService
==
nil
{
provisioningService
=
provisioning
.
NewProvisioningServiceMock
()
}
...
...
pkg/api/http_server.go
View file @
69c5efcf
...
...
@@ -27,6 +27,7 @@ import (
"github.com/grafana/grafana/pkg/services/datasources"
"github.com/grafana/grafana/pkg/services/hooks"
"github.com/grafana/grafana/pkg/services/login"
"github.com/grafana/grafana/pkg/services/provisioning"
"github.com/grafana/grafana/pkg/services/quota"
"github.com/grafana/grafana/pkg/services/rendering"
"github.com/grafana/grafana/pkg/setting"
...
...
@@ -44,14 +45,6 @@ func init() {
})
}
type
ProvisioningService
interface
{
ProvisionDatasources
()
error
ProvisionNotifications
()
error
ProvisionDashboards
()
error
GetDashboardProvisionerResolvedPath
(
name
string
)
string
GetAllowUiUpdatesFromConfig
(
name
string
)
bool
}
type
HTTPServer
struct
{
log
log
.
Logger
macaron
*
macaron
.
Macaron
...
...
@@ -59,21 +52,21 @@ type HTTPServer struct {
streamManager
*
live
.
StreamManager
httpSrv
*
http
.
Server
RouteRegister
routing
.
RouteRegister
`inject:""`
Bus
bus
.
Bus
`inject:""`
RenderService
rendering
.
Service
`inject:""`
Cfg
*
setting
.
Cfg
`inject:""`
HooksService
*
hooks
.
HooksService
`inject:""`
CacheService
*
localcache
.
CacheService
`inject:""`
DatasourceCache
datasources
.
CacheService
`inject:""`
AuthTokenService
models
.
UserTokenService
`inject:""`
QuotaService
*
quota
.
QuotaService
`inject:""`
RemoteCacheService
*
remotecache
.
RemoteCache
`inject:""`
ProvisioningService
ProvisioningService
`inject:""`
Login
*
login
.
LoginService
`inject:""`
License
models
.
Licensing
`inject:""`
BackendPluginManager
backendplugin
.
Manager
`inject:""`
PluginManager
*
plugins
.
PluginManager
`inject:""`
RouteRegister
routing
.
RouteRegister
`inject:""`
Bus
bus
.
Bus
`inject:""`
RenderService
rendering
.
Service
`inject:""`
Cfg
*
setting
.
Cfg
`inject:""`
HooksService
*
hooks
.
HooksService
`inject:""`
CacheService
*
localcache
.
CacheService
`inject:""`
DatasourceCache
datasources
.
CacheService
`inject:""`
AuthTokenService
models
.
UserTokenService
`inject:""`
QuotaService
*
quota
.
QuotaService
`inject:""`
RemoteCacheService
*
remotecache
.
RemoteCache
`inject:""`
ProvisioningService
provisioning
.
ProvisioningService
`inject:""`
Login
*
login
.
LoginService
`inject:""`
License
models
.
Licensing
`inject:""`
BackendPluginManager
backendplugin
.
Manager
`inject:""`
PluginManager
*
plugins
.
PluginManager
`inject:""`
}
func
(
hs
*
HTTPServer
)
Init
()
error
{
...
...
pkg/services/provisioning/dashboards/dashboard.go
View file @
69c5efcf
...
...
@@ -9,6 +9,15 @@ import (
"github.com/grafana/grafana/pkg/util/errutil"
)
type
DashboardProvisioner
interface
{
Provision
()
error
PollChanges
(
ctx
context
.
Context
)
GetProvisionerResolvedPath
(
name
string
)
string
GetAllowUiUpdatesFromConfig
(
name
string
)
bool
}
type
DashboardProvisionerFactory
func
(
string
)
(
DashboardProvisioner
,
error
)
type
DashboardProvisionerImpl
struct
{
log
log
.
Logger
fileReaders
[]
*
fileReader
...
...
pkg/services/provisioning/provisioning.go
View file @
69c5efcf
...
...
@@ -15,18 +15,17 @@ import (
"github.com/grafana/grafana/pkg/setting"
)
type
DashboardProvisioner
interface
{
Provision
()
error
PollChanges
(
ctx
context
.
Context
)
GetProvisionerResolvedPath
(
name
string
)
string
type
ProvisioningService
interface
{
ProvisionDatasources
()
error
ProvisionNotifications
()
error
ProvisionDashboards
()
error
GetDashboardProvisionerResolvedPath
(
name
string
)
string
GetAllowUiUpdatesFromConfig
(
name
string
)
bool
}
type
DashboardProvisionerFactory
func
(
string
)
(
DashboardProvisioner
,
error
)
func
init
()
{
registry
.
RegisterService
(
NewProvisioningServiceImpl
(
func
(
path
string
)
(
DashboardProvisioner
,
error
)
{
func
(
path
string
)
(
dashboards
.
DashboardProvisioner
,
error
)
{
return
dashboards
.
NewDashboardProvisionerImpl
(
path
)
},
notifiers
.
Provision
,
...
...
@@ -35,7 +34,7 @@ func init() {
}
func
NewProvisioningServiceImpl
(
newDashboardProvisioner
DashboardProvisionerFactory
,
newDashboardProvisioner
dashboards
.
DashboardProvisionerFactory
,
provisionNotifiers
func
(
string
)
error
,
provisionDatasources
func
(
string
)
error
,
)
*
provisioningServiceImpl
{
...
...
@@ -51,8 +50,8 @@ type provisioningServiceImpl struct {
Cfg
*
setting
.
Cfg
`inject:""`
log
log
.
Logger
pollingCtxCancel
context
.
CancelFunc
newDashboardProvisioner
DashboardProvisionerFactory
dashboardProvisioner
DashboardProvisioner
newDashboardProvisioner
dashboards
.
DashboardProvisionerFactory
dashboardProvisioner
dashboards
.
DashboardProvisioner
provisionNotifiers
func
(
string
)
error
provisionDatasources
func
(
string
)
error
mutex
sync
.
Mutex
...
...
pkg/services/provisioning/provisioning_test.go
View file @
69c5efcf
...
...
@@ -92,7 +92,7 @@ func setup() *serviceTestStruct {
}
serviceTest
.
service
=
NewProvisioningServiceImpl
(
func
(
path
string
)
(
DashboardProvisioner
,
error
)
{
func
(
path
string
)
(
dashboards
.
DashboardProvisioner
,
error
)
{
return
serviceTest
.
mock
,
nil
},
nil
,
...
...
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