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
b22b3e5b
Commit
b22b3e5b
authored
Apr 21, 2017
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mysql: added default query template
parent
ea53e722
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
5 deletions
+15
-5
pkg/services/sqlstore/sql_test_data.go
+0
-5
public/app/plugins/datasource/mysql/module.ts
+15
-0
No files found.
pkg/services/sqlstore/sql_test_data.go
View file @
b22b3e5b
...
...
@@ -61,11 +61,6 @@ func InsertSqlTestData(cmd *m.InsertSqlTestDataCommand) error {
sqlRandomWalk
(
"server2"
,
"frontend"
,
100
,
1.123
,
sess
)
sqlRandomWalk
(
"server3"
,
"frontend"
,
100
,
1.123
,
sess
)
sqlRandomWalk
(
"server1"
,
"backend"
,
100
,
1.123
,
sess
)
sqlRandomWalk
(
"server2"
,
"backend"
,
100
,
1.123
,
sess
)
sqlRandomWalk
(
"server3"
,
"backend"
,
100
,
1.123
,
sess
)
sqlRandomWalk
(
"db-server1"
,
"backend"
,
100
,
1.123
,
sess
)
return
err
})
}
public/app/plugins/datasource/mysql/module.ts
View file @
b22b3e5b
...
...
@@ -9,12 +9,23 @@ export interface MysqlQuery {
refId
:
string
;
format
:
string
;
alias
:
string
;
rawSql
:
string
;
}
export
interface
QueryMeta
{
sql
:
string
;
}
var
defaulQuery
=
`SELECT
UNIX_TIMESTAMP(<time_column>) as time_sec,
<value column> as value,
<series name column> as metric
FROM <table name>
WHERE $__timeFilter(time_column)
ORDER BY <time_column> ASC
`
;
class
MysqlQueryCtrl
extends
QueryCtrl
{
static
templateUrl
=
'partials/query.editor.html'
;
...
...
@@ -35,6 +46,10 @@ class MysqlQueryCtrl extends QueryCtrl {
{
text
:
'Table'
,
value
:
'table'
},
];
if
(
!
this
.
target
.
rawSql
)
{
this
.
target
.
rawSql
=
defaulQuery
;
}
this
.
panelCtrl
.
events
.
on
(
'data-received'
,
this
.
onDataReceived
.
bind
(
this
),
$scope
);
this
.
panelCtrl
.
events
.
on
(
'data-error'
,
this
.
onDataError
.
bind
(
this
),
$scope
);
}
...
...
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