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
1d4cace8
Commit
1d4cace8
authored
Nov 09, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(testdata): fixed query in default grafana data source
parent
d1bedfc1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
6 deletions
+28
-6
public/app/plugins/datasource/grafana/datasource.ts
+28
-6
No files found.
public/app/plugins/datasource/grafana/datasource.ts
View file @
1d4cace8
///<reference path="../../../headers/common.d.ts" />
import
_
from
'lodash'
;
class
GrafanaDatasource
{
/** @ngInject */
constructor
(
private
backendSrv
)
{}
query
(
options
)
{
return
this
.
backendSrv
.
get
(
'/api/metrics/test'
,
{
from
:
options
.
range
.
from
.
valueOf
(),
to
:
options
.
range
.
to
.
valueOf
(),
scenario
:
'random_walk'
,
interval
:
options
.
intervalMs
,
maxDataPoints
:
options
.
maxDataPoints
return
this
.
backendSrv
.
post
(
'/api/tsdb/query'
,
{
from
:
options
.
range
.
from
.
valueOf
().
toString
(),
to
:
options
.
range
.
to
.
valueOf
().
toString
(),
queries
:
[
{
"refId"
:
"A"
,
"scenarioId"
:
"random_walk"
,
"intervalMs"
:
options
.
intervalMs
,
"maxDataPoints"
:
options
.
maxDataPoints
,
}
]
}).
then
(
res
=>
{
var
data
=
[];
if
(
res
.
results
)
{
_
.
forEach
(
res
.
results
,
queryRes
=>
{
for
(
let
series
of
queryRes
.
series
)
{
data
.
push
({
target
:
series
.
name
,
datapoints
:
series
.
points
});
}
});
}
return
{
data
:
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