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
84de76ff
Commit
84de76ff
authored
Feb 13, 2018
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
provisioning: code formating
parent
44baaeed
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
40 deletions
+38
-40
pkg/services/provisioning/dashboards/config_reader.go
+1
-1
pkg/services/provisioning/dashboards/types.go
+36
-38
pkg/services/provisioning/datasources/config_reader.go
+1
-1
No files found.
pkg/services/provisioning/dashboards/config_reader.go
View file @
84de76ff
...
...
@@ -46,7 +46,7 @@ func (cr *configReader) parseConfigs(file os.FileInfo) ([]*DashboardsAsConfig, e
if
v0
!=
nil
{
cr
.
log
.
Warn
(
"[Deprecated] the dashboard provisioning config is outdated. please upgrade"
,
"filename"
,
filename
)
return
convertv
0ToDashboardAsConfig
(
v0
),
nil
return
mapV
0ToDashboardAsConfig
(
v0
),
nil
}
}
...
...
pkg/services/provisioning/dashboards/types.go
View file @
84de76ff
...
...
@@ -27,51 +27,15 @@ type DashboardsAsConfigV0 struct {
Options
map
[
string
]
interface
{}
`json:"options" yaml:"options"`
}
func
convertv0ToDashboardAsConfig
(
v0
[]
*
DashboardsAsConfigV0
)
[]
*
DashboardsAsConfig
{
var
r
[]
*
DashboardsAsConfig
for
_
,
v
:=
range
v0
{
r
=
append
(
r
,
&
DashboardsAsConfig
{
Name
:
v
.
Name
,
Type
:
v
.
Type
,
OrgId
:
v
.
OrgId
,
Folder
:
v
.
Folder
,
Editable
:
v
.
Editable
,
Options
:
v
.
Options
,
})
}
return
r
}
type
ConfigVersion
struct
{
ApiVersion
int64
`json:"apiVersion" yaml:"apiVersion"`
}
type
DashboardAsConfigV1
struct
{
ApiVersion
int64
`json:"apiVersion" yaml:"apiVersion"`
Providers
[]
*
DashboardSource
`json:"providers" yaml:"providers"`
}
func
(
dc
*
DashboardAsConfigV1
)
mapToDashboardAsConfig
()
[]
*
DashboardsAsConfig
{
var
r
[]
*
DashboardsAsConfig
for
_
,
v
:=
range
dc
.
Providers
{
r
=
append
(
r
,
&
DashboardsAsConfig
{
Name
:
v
.
Name
,
Type
:
v
.
Type
,
OrgId
:
v
.
OrgId
,
Folder
:
v
.
Folder
,
Editable
:
v
.
Editable
,
Options
:
v
.
Options
,
})
}
return
r
Providers
[]
*
DashboardProviderConfigs
`json:"providers" yaml:"providers"`
}
type
Dashboard
Source
struct
{
type
Dashboard
ProviderConfigs
struct
{
Name
string
`json:"name" yaml:"name"`
Type
string
`json:"type" yaml:"type"`
OrgId
int64
`json:"orgId" yaml:"orgId"`
...
...
@@ -98,3 +62,37 @@ func createDashboardJson(data *simplejson.Json, lastModified time.Time, cfg *Das
return
dash
,
nil
}
func
mapV0ToDashboardAsConfig
(
v0
[]
*
DashboardsAsConfigV0
)
[]
*
DashboardsAsConfig
{
var
r
[]
*
DashboardsAsConfig
for
_
,
v
:=
range
v0
{
r
=
append
(
r
,
&
DashboardsAsConfig
{
Name
:
v
.
Name
,
Type
:
v
.
Type
,
OrgId
:
v
.
OrgId
,
Folder
:
v
.
Folder
,
Editable
:
v
.
Editable
,
Options
:
v
.
Options
,
})
}
return
r
}
func
(
dc
*
DashboardAsConfigV1
)
mapToDashboardAsConfig
()
[]
*
DashboardsAsConfig
{
var
r
[]
*
DashboardsAsConfig
for
_
,
v
:=
range
dc
.
Providers
{
r
=
append
(
r
,
&
DashboardsAsConfig
{
Name
:
v
.
Name
,
Type
:
v
.
Type
,
OrgId
:
v
.
OrgId
,
Folder
:
v
.
Folder
,
Editable
:
v
.
Editable
,
Options
:
v
.
Options
,
})
}
return
r
}
pkg/services/provisioning/datasources/config_reader.go
View file @
84de76ff
...
...
@@ -52,7 +52,7 @@ func (cr *configReader) parseDatasourceConfig(path string, file os.FileInfo) (*D
}
var
apiVersion
*
ConfigVersion
err
:
=
yaml
.
Unmarshal
(
yamlFile
,
&
apiVersion
)
err
=
yaml
.
Unmarshal
(
yamlFile
,
&
apiVersion
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
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