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
0f136a94
Commit
0f136a94
authored
Oct 26, 2017
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
datasource as cfg: enable editable ds's
parent
b72cdae5
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
12 additions
and
2 deletions
+12
-2
conf/datasources.yaml
+4
-0
pkg/services/provisioning/datasources/datasources_test.go
+1
-0
pkg/services/provisioning/datasources/test-configs/all-properties.yaml
+1
-0
pkg/services/provisioning/datasources/types.go
+3
-2
pkg/services/sqlstore/datasource.go
+1
-0
pkg/services/sqlstore/datasource_test.go
+2
-0
No files found.
conf/datasources.yaml
View file @
0f136a94
...
...
@@ -39,6 +39,10 @@ datasources:
# # <int> including this value garantees that instance with old configs cannot
# # overwrite your last change.
# version: 1
# # <bool> allow users to edit datasources from the UI.
# editable: true
# - name: Prometheus
# type: prometheus
# access: proxy
...
...
pkg/services/provisioning/datasources/datasources_test.go
View file @
0f136a94
...
...
@@ -137,6 +137,7 @@ func TestDatasourceAsConfig(t *testing.T) {
So
(
ds
.
BasicAuthPassword
,
ShouldEqual
,
"basic_auth_password"
)
So
(
ds
.
WithCredentials
,
ShouldBeTrue
)
So
(
ds
.
IsDefault
,
ShouldBeTrue
)
So
(
ds
.
Editable
,
ShouldBeTrue
)
})
})
}
...
...
pkg/services/provisioning/datasources/test-configs/all-properties.yaml
View file @
0f136a94
...
...
@@ -15,3 +15,4 @@ datasources:
is_default
:
true
json_data
:
'
{"graphiteVersion":"0.9"}'
secure_json_fields
:
'
'
editable
:
true
pkg/services/provisioning/datasources/types.go
View file @
0f136a94
...
...
@@ -26,6 +26,7 @@ type DataSourceFromConfig struct {
IsDefault
bool
`json:"is_default" yaml:"is_default"`
JsonData
string
`json:"json_data" yaml:"json_data"`
SecureJsonData
map
[
string
]
string
`json:"secure_json_data" yaml:"secure_json_data"`
Editable
bool
`json:"editable" yaml:"editable"`
}
func
createInsertCommand
(
ds
DataSourceFromConfig
)
*
models
.
AddDataSourceCommand
{
...
...
@@ -50,7 +51,7 @@ func createInsertCommand(ds DataSourceFromConfig) *models.AddDataSourceCommand {
IsDefault
:
ds
.
IsDefault
,
JsonData
:
jsonData
,
SecureJsonData
:
ds
.
SecureJsonData
,
ReadOnly
:
tru
e
,
ReadOnly
:
!
ds
.
Editabl
e
,
}
}
...
...
@@ -77,6 +78,6 @@ func createUpdateCommand(ds DataSourceFromConfig, id int64) *models.UpdateDataSo
IsDefault
:
ds
.
IsDefault
,
JsonData
:
jsonData
,
SecureJsonData
:
ds
.
SecureJsonData
,
ReadOnly
:
tru
e
,
ReadOnly
:
!
ds
.
Editabl
e
,
}
}
pkg/services/sqlstore/datasource.go
View file @
0f136a94
...
...
@@ -159,6 +159,7 @@ func UpdateDataSource(cmd *m.UpdateDataSourceCommand) error {
sess
.
UseBool
(
"is_default"
)
sess
.
UseBool
(
"basic_auth"
)
sess
.
UseBool
(
"with_credentials"
)
sess
.
UseBool
(
"read_only"
)
var
updateSession
*
xorm
.
Session
if
cmd
.
Version
!=
0
{
...
...
pkg/services/sqlstore/datasource_test.go
View file @
0f136a94
...
...
@@ -45,6 +45,7 @@ func TestDataAccess(t *testing.T) {
Access
:
m
.
DS_ACCESS_DIRECT
,
Url
:
"http://test"
,
Database
:
"site"
,
ReadOnly
:
true
,
})
So
(
err
,
ShouldBeNil
)
...
...
@@ -59,6 +60,7 @@ func TestDataAccess(t *testing.T) {
So
(
ds
.
OrgId
,
ShouldEqual
,
10
)
So
(
ds
.
Database
,
ShouldEqual
,
"site"
)
So
(
ds
.
ReadOnly
,
ShouldBeTrue
)
})
Convey
(
"Given a datasource"
,
func
()
{
...
...
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