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
4ce0bf4d
Commit
4ce0bf4d
authored
May 11, 2017
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mysql: improved mysql data source, added test feature when adding data source, fixed cache issue
parent
ab6740c6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
3 deletions
+35
-3
pkg/api/datasources.go
+3
-1
pkg/models/datasource.go
+3
-2
pkg/services/sqlstore/datasource.go
+1
-0
public/app/plugins/datasource/mysql/datasource.ts
+28
-0
No files found.
pkg/api/datasources.go
View file @
4ce0bf4d
...
...
@@ -149,8 +149,8 @@ func fillWithSecureJsonData(cmd *m.UpdateDataSourceCommand) error {
if
err
!=
nil
{
return
err
}
secureJsonData
:=
ds
.
SecureJsonData
.
Decrypt
()
secureJsonData
:=
ds
.
SecureJsonData
.
Decrypt
()
for
k
,
v
:=
range
secureJsonData
{
if
_
,
ok
:=
cmd
.
SecureJsonData
[
k
];
!
ok
{
...
...
@@ -158,6 +158,8 @@ func fillWithSecureJsonData(cmd *m.UpdateDataSourceCommand) error {
}
}
// set version from db
cmd
.
Version
=
ds
.
Version
return
nil
}
...
...
pkg/models/datasource.go
View file @
4ce0bf4d
...
...
@@ -116,8 +116,9 @@ type UpdateDataSourceCommand struct {
JsonData
*
simplejson
.
Json
`json:"jsonData"`
SecureJsonData
map
[
string
]
string
`json:"secureJsonData"`
OrgId
int64
`json:"-"`
Id
int64
`json:"-"`
OrgId
int64
`json:"-"`
Id
int64
`json:"-"`
Version
int
`json:"-"`
}
type
DeleteDataSourceByIdCommand
struct
{
...
...
pkg/services/sqlstore/datasource.go
View file @
4ce0bf4d
...
...
@@ -141,6 +141,7 @@ func UpdateDataSource(cmd *m.UpdateDataSourceCommand) error {
JsonData
:
cmd
.
JsonData
,
SecureJsonData
:
securejsondata
.
GetEncryptedJsonData
(
cmd
.
SecureJsonData
),
Updated
:
time
.
Now
(),
Version
:
cmd
.
Version
+
1
,
}
sess
.
UseBool
(
"is_default"
)
...
...
public/app/plugins/datasource/mysql/datasource.ts
View file @
4ce0bf4d
...
...
@@ -52,6 +52,34 @@ export class MysqlDatasource {
}).
then
(
this
.
processQueryResult
.
bind
(
this
));
}
testDatasource
()
{
return
this
.
backendSrv
.
datasourceRequest
({
url
:
'/api/tsdb/query'
,
method
:
'POST'
,
data
:
{
from
:
'5m'
,
to
:
'now'
,
queries
:
[{
refId
:
'A'
,
intervalMs
:
1
,
maxDataPoints
:
1
,
datasourceId
:
this
.
id
,
rawSql
:
"SELECT 1"
,
format
:
'table'
,
}],
}
}).
then
(
res
=>
{
return
{
status
:
"success"
,
message
:
"Database Connection OK"
,
title
:
"Success"
};
}).
catch
(
err
=>
{
console
.
log
(
err
);
if
(
err
.
data
&&
err
.
data
.
message
)
{
return
{
status
:
"error"
,
message
:
err
.
data
.
message
,
title
:
"Error"
};
}
else
{
return
{
status
:
"error"
,
message
:
err
.
status
,
title
:
"Error"
};
}
});
}
processQueryResult
(
res
)
{
var
data
=
[];
...
...
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